From 9c3f37035e594f203106d45d9e6e726ec643682c Mon Sep 17 00:00:00 2001 From: YuviPanda Date: Tue, 11 Feb 2025 12:43:21 -0800 Subject: [PATCH] Add djlint for automatic template formatting + fixing In response to https://github.com/jupyterhub/mybinder.org-deploy/pull/3178#issuecomment-2634380928, I realized we can automate all this now. --- .pre-commit-config.yaml | 7 ++ docs/source/_templates/navigation.html | 16 +-- docs/source/_templates/relations.html | 29 +++-- images/analytics-publisher/index.html | 109 +++++++++--------- .../files/etc/jupyter/templates/login.html | 51 ++++---- .../files/etc/jupyter/templates/page.html | 70 +++++------ .../files/etc/jupyter/templates/tree.html | 23 ++-- 7 files changed, 157 insertions(+), 148 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e09e893e5..8c0b62e0a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -71,6 +71,13 @@ repos: images/minesweeper/requirements.txt| images/federation-redirect/requirements.txt + # Autoformat jinja2 templates + - repo: https://github.com/Riverside-Healthcare/djLint + rev: v1.36.4 + hooks: + - id: djlint-reformat-jinja + - id: djlint-jinja + # Lint: Python code - repo: https://github.com/PyCQA/flake8 rev: "7.1.1" diff --git a/docs/source/_templates/navigation.html b/docs/source/_templates/navigation.html index 9fa52ff25..ee5addab5 100644 --- a/docs/source/_templates/navigation.html +++ b/docs/source/_templates/navigation.html @@ -4,13 +4,15 @@ be overridden so this custom theme handles title and toctree for sidebar #} -

{{ _('Table of Contents') }}

+

{{ _("Table of Contents") }}

{{ toctree(includehidden=theme_sidebar_includehidden, collapse=theme_sidebar_collapse) }} {% if theme_extra_nav_links %} -
- +
+ {% endif %} diff --git a/docs/source/_templates/relations.html b/docs/source/_templates/relations.html index d7ace3837..9c6d4b5e6 100644 --- a/docs/source/_templates/relations.html +++ b/docs/source/_templates/relations.html @@ -3,15 +3,22 @@ alabaster theme does not provide previous/next page by default #}
-

Navigation

- +

Navigation

+
diff --git a/images/analytics-publisher/index.html b/images/analytics-publisher/index.html index 8bdbdb6be..2f23fa2a1 100644 --- a/images/analytics-publisher/index.html +++ b/images/analytics-publisher/index.html @@ -1,57 +1,54 @@ - + - - - - - - - - MyBinder.org Events Archive - - - -
-
-

MyBinder.org Events Archive

-

- Daily archive of analytics events emitted by MyBinder.org. - Documentation -

-

- Machine readable index also available. - Ask questions about this dataset or show off cool stuff built with it at the - the Jupyter Discourse Forum. -

-

- Released under the CC0 license. -

-
- - - - - - - {% for archive in archives %} - - - - - - {% endfor %} -
DateFilenameNumber of Events
{{ archive.date }}{{ archive.name }}{{ archive.count }}
- -
-