From 5b41e1b42a806ed088b6fc7fc5d8a9a810821ad0 Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Sun, 2 Mar 2025 00:26:41 +0100 Subject: [PATCH 1/2] Indent Django templates using djhtml (#48) --- .github/workflows/ci.yaml | 6 ++++++ Makefile | 1 + dev_requirements.txt | 1 + 3 files changed, 8 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6fa14369..c2cb0d5c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,3 +27,9 @@ jobs: - name: Run Biome run: biome ci . + + - name: Install djhtml + run: pip install djhtml + + - name: Run djhtml + run: djhtml pgcommitfest/*/templates/*.html --tabwidth=1 --check diff --git a/Makefile b/Makefile index 2a9ad3a9..4950827f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ format: ruff format npx @biomejs/biome format --write + djhtml pgcommitfest/*/templates/*.html --tabwidth=1 lint: ruff check diff --git a/dev_requirements.txt b/dev_requirements.txt index 66d7ae13..2b0518b5 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -2,3 +2,4 @@ uwsgi pycodestyle ruff +djhtml From 3b3e7b87a4f59f46537ea6244cc869e553b87b28 Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Sun, 2 Mar 2025 00:29:10 +0100 Subject: [PATCH 2/2] Autoindent django templates (#48) --- pgcommitfest/commitfest/templates/404.html | 4 +- .../commitfest/templates/activity.html | 40 +- pgcommitfest/commitfest/templates/base.html | 72 +-- .../commitfest/templates/base_form.html | 180 +++---- .../commitfest/templates/commitfest.html | 312 +++++------ pgcommitfest/commitfest/templates/home.html | 38 +- pgcommitfest/commitfest/templates/patch.html | 510 +++++++++--------- .../commitfest/templates/patchsearch.html | 50 +- .../commitfest/templates/report_authors.html | 42 +- .../templates/userprofileform.html | 56 +- 10 files changed, 652 insertions(+), 652 deletions(-) diff --git a/pgcommitfest/commitfest/templates/404.html b/pgcommitfest/commitfest/templates/404.html index ccf5146c..73a24c02 100644 --- a/pgcommitfest/commitfest/templates/404.html +++ b/pgcommitfest/commitfest/templates/404.html @@ -1,7 +1,7 @@ {%extends "base.html" %} {%block title%}Not found{%endblock%} {%block contents%} -

Not found

-

The specified URL was not found.

+

Not found

+

The specified URL was not found.

{%endblock%} diff --git a/pgcommitfest/commitfest/templates/activity.html b/pgcommitfest/commitfest/templates/activity.html index 1d5a060f..621155ee 100644 --- a/pgcommitfest/commitfest/templates/activity.html +++ b/pgcommitfest/commitfest/templates/activity.html @@ -2,25 +2,25 @@ {%load commitfest %} {%block contents%} - - - - - - - - - - -{%for a in activity %} - - - - - - -{%endfor%} - -
TimeUserPatchActivity
{{a.date}}{{a.by}}{{a.name}}{{a.what}}
+ + + + + + + + + + + {%for a in activity %} + + + + + + + {%endfor%} + +
TimeUserPatchActivity
{{a.date}}{{a.by}}{{a.name}}{{a.what}}
{%endblock%} diff --git a/pgcommitfest/commitfest/templates/base.html b/pgcommitfest/commitfest/templates/base.html index 382c43bc..4e564908 100644 --- a/pgcommitfest/commitfest/templates/base.html +++ b/pgcommitfest/commitfest/templates/base.html @@ -1,48 +1,48 @@ {%load commitfest%} - + {{title}} -{%block extrahead%}{%endblock%} -{%if rss_alternate%} {%endif%} - - -
- + {%block extrahead%}{%endblock%} + {%if rss_alternate%} {%endif%} + + +
+ -

{{title}}

+

{{title}}

-{%if messages%} - {%for m in messages%} -
{{m}}
- {%endfor%} -{%endif%} + {%if messages%} + {%for m in messages%} +
{{m}}
+ {%endfor%} + {%endif%} -{%block contents%} -{%endblock%} -
- - - - -{%block morescript%}{%endblock%} - + {%block contents%} + {%endblock%} +
+ + + + + {%block morescript%}{%endblock%} + diff --git a/pgcommitfest/commitfest/templates/base_form.html b/pgcommitfest/commitfest/templates/base_form.html index 3bfaca85..1facd506 100644 --- a/pgcommitfest/commitfest/templates/base_form.html +++ b/pgcommitfest/commitfest/templates/base_form.html @@ -2,113 +2,113 @@ {%load commitfest%} {%block contents%} -
{%csrf_token%} -{%if form.errors%} -
Please correct the errors below, and re-submit the form.
-{%endif%} -{%if form.non_field_errors%} -
{{form.non_field_errors}}
-{%endif%} -{%if note%} -
{{note|safe}}
-{%endif%} - {%for field in form%} - {%if not field.is_hidden%} -
- {{field|label_class:"control-label col-lg-1"}} -
- {%if field.errors %} - {%for e in field.errors%} -
{{e}}
- {%endfor%} + {%csrf_token%} + {%if form.errors%} +
Please correct the errors below, and re-submit the form.
{%endif%} -{%if not field.name in form.selectize_multiple_fields%}{{field|field_class:"form-control"}}{%else%}{{field}}{%endif%} -{%if field.help_text%}
{{field.help_text|safe}}{%endif%}
-
- {%else%} -{{field}} - {%endif%} -{%endfor%} -
-
-
+ {%if form.non_field_errors%} +
{{form.non_field_errors}}
+ {%endif%} + {%if note%} +
{{note|safe}}
+ {%endif%} + {%for field in form%} + {%if not field.is_hidden%} +
+ {{field|label_class:"control-label col-lg-1"}} +
+ {%if field.errors %} + {%for e in field.errors%} +
{{e}}
+ {%endfor%} + {%endif%} + {%if not field.name in form.selectize_multiple_fields%}{{field|field_class:"form-control"}}{%else%}{{field}}{%endif%} + {%if field.help_text%}
{{field.help_text|safe}}{%endif%}
+
+ {%else%} + {{field}} + {%endif%} + {%endfor%} +
+
+
+
-
- + -{%if threadbrowse %} -{%include "thread_attach.inc" %} -{%endif%} + {%if threadbrowse %} + {%include "thread_attach.inc" %} + {%endif%} -{%if user.is_staff%} -