diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6ec95d00..172022ec 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,6 +42,9 @@ repos: - id: djlint-reformat-jinja files: ".*templates/.*.html" types_or: ["html"] + - id: djlint-jinja + files: ".*templates/.*.html" + types_or: ["html"] # Autoformat and linting, misc. details - repo: https://github.com/pre-commit/pre-commit-hooks diff --git a/docs/source/_templates/redoc.html b/docs/source/_templates/redoc.html index bf764d11..6e457719 100644 --- a/docs/source/_templates/redoc.html +++ b/docs/source/_templates/redoc.html @@ -19,14 +19,18 @@ {%- block content %} {%- endblock content %} diff --git a/examples/service-announcement/templates/page.html b/examples/service-announcement/templates/page.html index de980f51..23c544ab 100644 --- a/examples/service-announcement/templates/page.html +++ b/examples/service-announcement/templates/page.html @@ -1,10 +1,12 @@ {% extends "templates/page.html" %} -{% block announcement %}
{% endblock %} +{% block announcement %} +
+{% endblock announcement %} {% block script %} {{ super() }} -{% endblock %} +{% endblock script %} diff --git a/jupyterhub/singleuser/templates/page.html b/jupyterhub/singleuser/templates/page.html index 6dd57ca3..2243f36b 100644 --- a/jupyterhub/singleuser/templates/page.html +++ b/jupyterhub/singleuser/templates/page.html @@ -17,38 +17,38 @@ It makes the following modifications: style="margin-right: 4px; margin-left: 2px">Control Panel -{% endblock %} +{% endblock header_buttons %} {% block logo %} Jupyter Notebook {% endblock logo %} {% block script %} {{ super() }} {% endblock script %} diff --git a/pyproject.toml b/pyproject.toml index e5c8c5f4..8edb94b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -124,6 +124,18 @@ select = [ # https://djlint.com/docs/configuration/ [tool.djlint] indent = 2 +# ignore often-incorrect lint +# H006: image height/width attributes +# ignore style lint that formatter doesn't catch +# H008: double-quotes +# H029: form method case +ignore = "H006,H008,H021,H029" +use_gitignore = true + +format_js = true + +[tool.djlint.js] +indent_size = 2 # tbump is used to simplify and standardize the release process when updating # the version, making a git commit and tag, and pushing changes. diff --git a/share/jupyterhub/templates/404.html b/share/jupyterhub/templates/404.html index 2fc227aa..04c74942 100644 --- a/share/jupyterhub/templates/404.html +++ b/share/jupyterhub/templates/404.html @@ -1,2 +1,4 @@ {% extends "error.html" %} -{% block error_detail %}

Jupyter has lots of moons, but this is not one...

{% endblock %} +{% block error_detail %} +

Jupyter has lots of moons, but this is not one...

+{% endblock error_detail %} diff --git a/share/jupyterhub/templates/accept-share.html b/share/jupyterhub/templates/accept-share.html index fd8d8d69..450795e1 100644 --- a/share/jupyterhub/templates/accept-share.html +++ b/share/jupyterhub/templates/accept-share.html @@ -1,5 +1,6 @@ {% extends "page.html" %} -{% block login_widget %}{% endblock %} +{% block login_widget %} +{% endblock login_widget %} {% block main %}
@@ -16,7 +17,7 @@ to start the server before you can access it.

{% endif %} -
+
By accepting the invitation, you will be granted the following permissions, @@ -48,4 +49,4 @@
-{% endblock %} +{% endblock main %} diff --git a/share/jupyterhub/templates/admin.html b/share/jupyterhub/templates/admin.html index c5936c7c..572003d9 100644 --- a/share/jupyterhub/templates/admin.html +++ b/share/jupyterhub/templates/admin.html @@ -2,12 +2,12 @@ {% block main %}
-{% endblock %} +{% endblock main %} {% block footer %} -{% endblock %} +{% endblock footer %} diff --git a/share/jupyterhub/templates/error.html b/share/jupyterhub/templates/error.html index 1a63fe04..b7e8d9c0 100644 --- a/share/jupyterhub/templates/error.html +++ b/share/jupyterhub/templates/error.html @@ -1,5 +1,6 @@ {% extends "page.html" %} -{% block login_widget %}{% endblock %} +{% block login_widget %} +{% endblock login_widget %} {% block main %}
{% block h1_error %} @@ -11,7 +12,7 @@ {% if extra_error_html %}

{{ extra_error_html | safe }}

{% endif %} {% endblock error_detail %}
-{% endblock %} +{% endblock main %} {% block script %} {{ super() }} -{% endblock %} +{% endblock script %} diff --git a/share/jupyterhub/templates/home.html b/share/jupyterhub/templates/home.html index 0ccc4308..17565ed4 100644 --- a/share/jupyterhub/templates/home.html +++ b/share/jupyterhub/templates/home.html @@ -86,5 +86,7 @@ {% endblock main %} {% block script %} {{ super() }} - -{% endblock %} + +{% endblock script %} diff --git a/share/jupyterhub/templates/login.html b/share/jupyterhub/templates/login.html index 03ad65b5..8c8e83bd 100644 --- a/share/jupyterhub/templates/login.html +++ b/share/jupyterhub/templates/login.html @@ -2,7 +2,8 @@ {% if announcement_login is string %} {% set announcement = announcement_login %} {% endif %} -{% block login_widget %}{% endblock %} +{% block login_widget %} +{% endblock login_widget %} {% block main %} {% block login %}
@@ -86,21 +87,21 @@ {% endblock login_container %}
{% endblock login %} -{% endblock %} +{% endblock main %} {% block script %} {{ super() }} -{% endblock %} +{% endblock script %} diff --git a/share/jupyterhub/templates/logout.html b/share/jupyterhub/templates/logout.html index 910c580f..994e7769 100644 --- a/share/jupyterhub/templates/logout.html +++ b/share/jupyterhub/templates/logout.html @@ -6,4 +6,4 @@

Successfully logged out.

-{% endblock %} +{% endblock main %} diff --git a/share/jupyterhub/templates/not_running.html b/share/jupyterhub/templates/not_running.html index 52d56c77..49fb2025 100644 --- a/share/jupyterhub/templates/not_running.html +++ b/share/jupyterhub/templates/not_running.html @@ -11,7 +11,7 @@ Server not running {% endif %} - {% endblock %} + {% endblock heading %} {% block message %}

{% if failed %} @@ -35,7 +35,7 @@ {% endif %} {% endif %}

- {% endblock %} + {% endblock message %} {% block start_button %} - {% endblock %} + {% endblock start_button %}
-{% endblock %} +{% endblock main %} {% block script %} {{ super () }} {% if implicit_spawn_seconds %} {% endif %} - + {% endblock script %} diff --git a/share/jupyterhub/templates/oauth.html b/share/jupyterhub/templates/oauth.html index 4756312f..edb11bc7 100644 --- a/share/jupyterhub/templates/oauth.html +++ b/share/jupyterhub/templates/oauth.html @@ -1,5 +1,6 @@ {% extends "page.html" %} -{% block login_widget %}{% endblock %} +{% block login_widget %} +{% endblock login_widget %} {% block main %}
@@ -14,7 +15,7 @@ your behalf. {% endif %}

- +

This will grant the application permission to:

@@ -26,22 +27,26 @@ {% for scope_info in scope_descriptions %}
-
- {% endfor %} -
- + {# disabled because it's required #} + + + {{ scope_info['description'] }} + {% if scope_info['filter'] %}Applies to {{ scope_info['filter'] }}.{% endif %} + + +
+ {% endfor %}
- -
+ + + - {% endblock %} + + +{% endblock main %} diff --git a/share/jupyterhub/templates/page.html b/share/jupyterhub/templates/page.html index 533e8311..7583473b 100644 --- a/share/jupyterhub/templates/page.html +++ b/share/jupyterhub/templates/page.html @@ -10,9 +10,7 @@
-{% endblock %} +{% endblock main %} {% block script %} {{ super() }} -{% endblock %} +{% endblock script %} diff --git a/share/jupyterhub/templates/stop_pending.html b/share/jupyterhub/templates/stop_pending.html index 390f6429..cbad48b6 100644 --- a/share/jupyterhub/templates/stop_pending.html +++ b/share/jupyterhub/templates/stop_pending.html @@ -14,17 +14,17 @@ -{% endblock %} +{% endblock main %} {% block script %} {{ super() }} -{% endblock %} +{% endblock script %} diff --git a/share/jupyterhub/templates/token.html b/share/jupyterhub/templates/token.html index 347088cd..b74c41fa 100644 --- a/share/jupyterhub/templates/token.html +++ b/share/jupyterhub/templates/token.html @@ -166,16 +166,19 @@ - {% endblock client_row %} - - {% endfor %} - - - - {% endif %} - - {% endblock main %} - {% block script %} - {{ super() }} - - {% endblock script %} + + {% endblock client_row %} + + {% endfor %} + + + + {% endif %} + +{% endblock main %} +{% block script %} + {{ super() }} + +{% endblock script %}