diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9c86afb..ef37d38 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -103,6 +103,11 @@ mypy: script: - mypy . +curlylint: + <<: *python_test_template + script: + - curlylint . + prettier: <<: *node_test_template script: diff --git a/justfile b/justfile index 545e0a2..15f46ac 100644 --- a/justfile +++ b/justfile @@ -37,6 +37,7 @@ lint_python: isort --check . flake8 mypy . --show-error-codes + curlylint . @lint_node: npm run lint diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..184721f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.curlylint] +include = '/(website|templates)/.*\.html' +exclude = ''' +( + navbar\.html + | referrallink_snippet_link\.html + | onlineaccount_snippet_link\.html + | base\.html + | 500\.html +) +''' + +[tool.curlylint.rules] +indent = 2 +html_has_lang = 'en-GB' diff --git a/requirements/dev.in b/requirements/dev.in index a23d30e..3fad42e 100644 --- a/requirements/dev.in +++ b/requirements/dev.in @@ -10,3 +10,4 @@ django-browser-reload django-debug-toolbar types-requests mypy +curlylint diff --git a/requirements/dev.txt b/requirements/dev.txt index e54f2b0..d8a83b5 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -7,13 +7,15 @@ anyascii==0.3.1 # via -r requirements/base.txt, wagtail asgiref==3.5.2 # via -r requirements/base.txt, django async-timeout==4.0.2 # via -r requirements/base.txt, redis +attrs==22.1.0 # via curlylint beautifulsoup4==4.9.3 # via -r requirements/base.txt, wagtail black==22.6.0 # via -r requirements/dev.in brotli==1.0.9 # via -r requirements/base.txt, whitenoise build==0.8.0 # via pip-tools certifi==2022.6.15 # via -r requirements/base.txt, requests charset-normalizer==2.1.0 # via -r requirements/base.txt, requests -click==8.1.3 # via -r requirements/base.txt, black, pip-tools, rq +click==8.1.3 # via -r requirements/base.txt, black, curlylint, pip-tools, rq +curlylint==0.13.1 # via -r requirements/dev.in deprecated==1.2.13 # via -r requirements/base.txt, redis django==4.0.6 # via -r requirements/base.txt, django-browser-reload, django-debug-toolbar, django-filter, django-htmx, django-modelcluster, django-permissionedforms, django-redis, django-rq, django-taggit, django-treebeard, djangorestframework, wagtail django-browser-reload==1.6.0 # via -r requirements/dev.in @@ -44,7 +46,8 @@ mypy==0.971 # via -r requirements/dev.in mypy-extensions==0.4.3 # via black, mypy openpyxl==3.0.10 # via -r requirements/base.txt, tablib packaging==21.3 # via -r requirements/base.txt, build, redis -pathspec==0.9.0 # via black +parsy==1.1.0 # via curlylint +pathspec==0.9.0 # via black, curlylint pep517==0.12.0 # via build pillow==9.2.0 # via -r requirements/base.txt, wagtail pip-tools==6.8.0 # via -r requirements/dev.in @@ -63,6 +66,7 @@ soupsieve==2.3.2.post1 # via -r requirements/base.txt, beautifulsoup4 sqlparse==0.4.2 # via -r requirements/base.txt, django, django-debug-toolbar tablib[xls,xlsx]==3.2.1 # via -r requirements/base.txt, wagtail telepath==0.2 # via -r requirements/base.txt, wagtail +toml==0.10.2 # via curlylint tomli==2.0.1 # via black, build, mypy, pep517 types-requests==2.28.5 # via -r requirements/dev.in types-urllib3==1.26.17 # via types-requests diff --git a/templates/404.html b/templates/404.html index f19ab95..d31e54c 100644 --- a/templates/404.html +++ b/templates/404.html @@ -5,7 +5,7 @@ {% block body_class %}template-404{% endblock %} {% block content %} -

Page not found

+

Page not found

-

Sorry, this page could not be found.

+

Sorry, this page could not be found.

{% endblock %} diff --git a/templates/500.html b/templates/500.html index 77379e5..65b5416 100644 --- a/templates/500.html +++ b/templates/500.html @@ -1,13 +1,12 @@ - - - - Internal server error - - - -

Internal server error

- -

Sorry, there seems to be an error. Please try again soon.

- + + + +Internal server error + + + +

Internal server error

+

Sorry, there seems to be an error. Please try again soon.

+ diff --git a/templates/base.html b/templates/base.html index 02ecbc4..c8aae3a 100644 --- a/templates/base.html +++ b/templates/base.html @@ -1,14 +1,14 @@ {% load static wagtailcore_tags wagtailuserbar navbar_tags footer_tags cache %} - + {% block title %}{% endblock %} {% block title_suffix %} - {% wagtail_site as current_site %} - {% if current_site and current_site.site_name %}:: {{ current_site.site_name }}{% endif %} + {% wagtail_site as current_site %} + {% if current_site and current_site.site_name %}:: {{ current_site.site_name }}{% endif %} {% endblock %} @@ -25,7 +25,7 @@ {% wagtailuserbar %} {% cache 3600 "navbar" %} - {% navbar %} + {% navbar %} {% endcache %} {% block main %} @@ -35,10 +35,9 @@ {% endblock %} {% cache 3600 "footer" %} - {% footer %} + {% footer %} {% endcache %} - diff --git a/website/blog/templates/blog/blog_collection_list_page.html b/website/blog/templates/blog/blog_collection_list_page.html index cb82a20..841a414 100644 --- a/website/blog/templates/blog/blog_collection_list_page.html +++ b/website/blog/templates/blog/blog_collection_list_page.html @@ -2,18 +2,18 @@ {% block content %} -{% include "common/hero.html" %} + {% include "common/hero.html" %} -{% if page.body_html %} -
- {{ page.body_html|safe }} + {% if page.body_html %} +
+ {{ page.body_html|safe }} +
+ {% endif %} + +
+ {% for collection in collections %} + {% include "common/listing-item.html" with page=collection %} + {% endfor %}
-{% endif %} - -
- {% for collection in collections %} - {% include "common/listing-item.html" with page=collection %} - {% endfor %} -
{% endblock content %} diff --git a/website/blog/templates/blog/blog_collection_page.html b/website/blog/templates/blog/blog_collection_page.html index cdf2916..9f439cd 100644 --- a/website/blog/templates/blog/blog_collection_page.html +++ b/website/blog/templates/blog/blog_collection_page.html @@ -2,18 +2,18 @@ {% block content %} -{% include "common/hero.html" %} + {% include "common/hero.html" %} -{% if page.body_html %} -
- {{ page.body_html|safe }} + {% if page.body_html %} +
+ {{ page.body_html|safe }} +
+ {% endif %} + +
+ {% for page in pages %} + {% include "common/listing-item.html" %} + {% endfor %}
-{% endif %} - -
- {% for page in pages %} - {% include "common/listing-item.html" %} - {% endfor %} -
{% endblock content %} diff --git a/website/blog/templates/blog/blog_list_page.html b/website/blog/templates/blog/blog_list_page.html index 5d34ee5..e30a68b 100644 --- a/website/blog/templates/blog/blog_list_page.html +++ b/website/blog/templates/blog/blog_list_page.html @@ -2,26 +2,26 @@ {% block content %} -{% include "common/hero.html" %} + {% include "common/hero.html" %} -{% if page.body_html %} -
- {{ page.body_html|safe }} + {% if page.body_html %} +
+ {{ page.body_html|safe }} +
+ {% endif %} + +
+ {% for page in child_pages %} + {% if not filtering_by_tag %} + {% ifchanged %} + + {% endifchanged %} + {% endif %} + + {% include "common/listing-item.html" %} + {% endfor %}
-{% endif %} - -
- {% for page in child_pages %} - {% if not filtering_by_tag %} - {% ifchanged %} - - {% endifchanged %} - {% endif %} - - {% include "common/listing-item.html" %} - {% endfor %} -
{% endblock content %} diff --git a/website/blog/templates/blog/blog_post_tag_list_page.html b/website/blog/templates/blog/blog_post_tag_list_page.html index 5a21c0b..0a102be 100644 --- a/website/blog/templates/blog/blog_post_tag_list_page.html +++ b/website/blog/templates/blog/blog_post_tag_list_page.html @@ -2,18 +2,18 @@ {% block content %} -{% include "common/hero.html" %} + {% include "common/hero.html" %} -{% if page.body_html %} -
- {{ page.body_html|safe }} + {% if page.body_html %} +
+ {{ page.body_html|safe }} +
+ {% endif %} + +
+ {% for tag in tags %} + {% include "common/listing-item.html" with page=tag %} + {% endfor %}
-{% endif %} - -
- {% for tag in tags %} - {% include "common/listing-item.html" with page=tag %} - {% endfor %} -
{% endblock content %} diff --git a/website/blog/templates/blog/blog_post_tag_page.html b/website/blog/templates/blog/blog_post_tag_page.html index cdf2916..9f439cd 100644 --- a/website/blog/templates/blog/blog_post_tag_page.html +++ b/website/blog/templates/blog/blog_post_tag_page.html @@ -2,18 +2,18 @@ {% block content %} -{% include "common/hero.html" %} + {% include "common/hero.html" %} -{% if page.body_html %} -
- {{ page.body_html|safe }} + {% if page.body_html %} +
+ {{ page.body_html|safe }} +
+ {% endif %} + +
+ {% for page in pages %} + {% include "common/listing-item.html" %} + {% endfor %}
-{% endif %} - -
- {% for page in pages %} - {% include "common/listing-item.html" %} - {% endfor %} -
{% endblock content %} diff --git a/website/common/templates/common/content_page.html b/website/common/templates/common/content_page.html index fa398b9..7d953b4 100644 --- a/website/common/templates/common/content_page.html +++ b/website/common/templates/common/content_page.html @@ -4,13 +4,13 @@ {% block content %} -{% include "common/hero.html" %} + {% include "common/hero.html" %} -
- {{ page.body_html|safe }} -
+
+ {{ page.body_html|safe }} +
-{% include "common/shareon.html" %} + {% include "common/shareon.html" %} {% endblock %} diff --git a/website/common/templates/common/listing_page.html b/website/common/templates/common/listing_page.html index 6ce8a08..032ade4 100644 --- a/website/common/templates/common/listing_page.html +++ b/website/common/templates/common/listing_page.html @@ -2,18 +2,18 @@ {% block content %} -{% include "common/hero.html" %} + {% include "common/hero.html" %} -{% if page.body_html %} -
- {{ page.body_html|safe }} + {% if page.body_html %} +
+ {{ page.body_html|safe }} +
+ {% endif %} + +
+ {% for page in child_pages %} + {% include "common/listing-item.html" %} + {% endfor %}
-{% endif %} - -
- {% for page in child_pages %} - {% include "common/listing-item.html" %} - {% endfor %} -
{% endblock content %} diff --git a/website/common/templates/common/navbar.html b/website/common/templates/common/navbar.html index 33b311e..576e6b3 100644 --- a/website/common/templates/common/navbar.html +++ b/website/common/templates/common/navbar.html @@ -35,5 +35,4 @@ - diff --git a/website/common/templates/common/toc-item.html b/website/common/templates/common/toc-item.html index 0389dd8..1f1c35e 100644 --- a/website/common/templates/common/toc-item.html +++ b/website/common/templates/common/toc-item.html @@ -1,10 +1,10 @@
  • {{ toc_item.title }} {% if toc_item.children %} -
      - {% for toc_item in toc_item.children %} - {% include "common/toc-item.html" %} - {% endfor %} -
    +
      + {% for toc_item in toc_item.children %} + {% include "common/toc-item.html" %} + {% endfor %} +
    {% endif %}
  • diff --git a/website/contact/templates/contact/contact_page.html b/website/contact/templates/contact/contact_page.html index 2e204c2..67202bd 100644 --- a/website/contact/templates/contact/contact_page.html +++ b/website/contact/templates/contact/contact_page.html @@ -2,25 +2,24 @@ {% block content %} -{% include "common/hero.html" %} + {% include "common/hero.html" %} -
    - {{ page.body_html|safe }} -
    +
    + {{ page.body_html|safe }} +
    -
    - {% for account in accounts %} -
    -
    -
    -
    -

    {{ account.name }}

    -

    {{ account.username }}

    +
    + {% for account in accounts %} +
    +
    +
    +
    +

    {{ account.name }}

    +

    {{ account.username }}

    +
    -
    - {% endfor %} -
    - + {% endfor %} +
    {% endblock %} diff --git a/website/home/templates/home/home_page.html b/website/home/templates/home/home_page.html index cddaae2..34bb1be 100644 --- a/website/home/templates/home/home_page.html +++ b/website/home/templates/home/home_page.html @@ -3,16 +3,16 @@ {% load wagtailcore_tags wagtailimages_tags %} {% block main %} -
    -
    -

    {{ page.heading }}

    - -
    - - {% if latest_blog_post %} -
    - Latest Post: {{ latest_blog_post.title }} → +
    +
    +

    {{ page.heading }}

    +
    - {% endif %} -
    + + {% if latest_blog_post %} +
    + Latest Post: {{ latest_blog_post.title }} → +
    + {% endif %} +
    {% endblock %} diff --git a/website/search/templates/search/search_page.html b/website/search/templates/search/search_page.html index 965a645..c93072f 100644 --- a/website/search/templates/search/search_page.html +++ b/website/search/templates/search/search_page.html @@ -4,48 +4,48 @@ {% block content %} -{% include "common/hero.html" %} + {% include "common/hero.html" %} -{% if page.body_html %} -
    - {{ page.body_html|safe }} + {% if page.body_html %} +
    + {{ page.body_html|safe }} +
    + {% endif %} + +
    +
    +

    + + + + + + + +

    +
    -{% endif %} -
    -
    -

    - - - - - - - -

    -
    -
    +
    +

    -
    -

    - -
    - {% if not search_query %} - {% include "search/enter-search-term.html" %} - {% endif %} -
    -
    +
    + {% if not search_query %} + {% include "search/enter-search-term.html" %} + {% endif %} +
    +
    {% endblock %}