From 99423f57f79499f13d021970c1efb4529072006b Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Wed, 29 May 2024 16:01:03 +0200 Subject: improve whitespace generation in output files --- templates/base.html | 14 +++++++------- templates/header.html | 4 ++-- templates/language_switcher.html | 6 +++--- templates/macros.html | 14 +++++++------- templates/nav.html | 24 ++++++++++++------------ templates/page.html | 6 +++--- templates/section.html | 20 +++++++++----------- templates/taxonomy_list.html | 6 +++--- templates/taxonomy_single.html | 10 +++++----- 9 files changed, 51 insertions(+), 53 deletions(-) (limited to 'templates') diff --git a/templates/base.html b/templates/base.html index ee206b3..a2c5187 100644 --- a/templates/base.html +++ b/templates/base.html @@ -8,7 +8,7 @@ {% include "favicon.html" ignore missing -%} {%- block title %}{{ config.title }}{%- endblock %} - {% include "seo_tags.html" ignore missing %} + {% include "seo_tags.html" ignore missing -%} {%- if config.generate_feed %} {% block rss -%} @@ -16,14 +16,14 @@ {%- endblock -%} {%- endif %} - {% include "custom_head.html" ignore missing -%} + {%- include "custom_head.html" ignore missing %} - {% include "header.html" ignore missing -%} - {% block main %}{%- endblock -%} - {% include "footer.html" ignore missing -%} - {% include "custom_body.html" ignore missing -%} + {% include "header.html" ignore missing %} + {%- block main -%}{%- endblock -%} + {%- include "footer.html" ignore missing -%} + {%- include "custom_body.html" ignore missing -%} diff --git a/templates/header.html b/templates/header.html index 6e56025..54106ea 100644 --- a/templates/header.html +++ b/templates/header.html @@ -1,9 +1,9 @@
- {% include "language_switcher.html" %} + {%- include "language_switcher.html" %}

{{ config.title }}

diff --git a/templates/language_switcher.html b/templates/language_switcher.html index 512b409..04ce9a5 100644 --- a/templates/language_switcher.html +++ b/templates/language_switcher.html @@ -1,6 +1,6 @@ -{% if config.extra.language_switcher %} +{%- if config.extra.language_switcher %} -{% endif %} +{%- endif -%} diff --git a/templates/macros.html b/templates/macros.html index 2ad23e6..571c6e0 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -1,12 +1,12 @@ -{% macro table_of_contents(toc, max_level) %} +{%- macro table_of_contents(toc, max_level) %} -{% endmacro %} +{%- endmacro %} diff --git a/templates/nav.html b/templates/nav.html index ba9f543..47a4254 100644 --- a/templates/nav.html +++ b/templates/nav.html @@ -1,17 +1,17 @@ -{% set current_lang = config.default_language %} -{% if page %} - {% set current_lang = page.lang %} -{% elif section %} - {% set current_lang = section.lang %} -{% endif %} +{%- set current_lang = config.default_language %} +{%- if page %} + {%- set current_lang = page.lang %} +{%- elif section %} + {%- set current_lang = section.lang %} +{%- endif %} {%- if config.extra.main_menu %} {%- for item in config.extra.main_menu %} - {% if current_lang == config.default_language %} - {% set title = item.name %} - {% else %} - {% set language_key = 'name_' ~ current_lang %} - {% set title = item[language_key] %} - {% endif %} + {%- if current_lang == config.default_language %} + {%- set title = item.name %} + {%- else %} + {%- set language_key = 'name_' ~ current_lang %} + {%- set title = item[language_key] %} + {%- endif %} {%- if item.url is matching("https?://") %} {{ title }} {%- else %} diff --git a/templates/page.html b/templates/page.html index cb33ab5..a51d965 100644 --- a/templates/page.html +++ b/templates/page.html @@ -4,7 +4,7 @@ {% block title %}{{ page.title }} | {{ super() }}{% endblock %} {% block main %} - {%- if not page.extra.menu %} + {%- if not page.extra.menu -%}

{{ page.title }}

{%- if page.date %}

@@ -17,9 +17,9 @@ {%- endif %} {%- endif %} {%- if config.extra.table_of_contents.show and not page.extra.hide_table_of_contents and page.toc %} -

+
{{ trans(key="table_of_contents", lang=lang) }} - {{ macros::table_of_contents(toc=page.toc, max_level=config.extra.table_of_contents.max_level) }} + {{- macros::table_of_contents(toc=page.toc, max_level=config.extra.table_of_contents.max_level) | indent() | safe() }}
{%- endif %}
diff --git a/templates/section.html b/templates/section.html index 9560719..a389c93 100644 --- a/templates/section.html +++ b/templates/section.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% block main %} +{%- block main -%}
{%- if taxonomy.term %}

{{ trans(key="filtering_for",lang=lang)}} "{{ section.title }}"

@@ -9,7 +9,7 @@ {%- endif %}
    - {% for page in section.pages %} + {%- for page in section.pages %}
  • @@ -20,18 +20,16 @@ {{ page.title }}
  • - {% else %} -
  • - {{ trans(key="no_posts", lang=lang) }} -
  • - {% endfor %} + {%- else %} +
  • {{ trans(key="no_posts", lang=lang) }}
  • + {%- endfor -%}
- {% set tags = get_taxonomy(kind="tags", lang=lang) %} - {% for post in tags.items %} - #{{ post.name }}  - {% endfor %} + {%- set tags = get_taxonomy(kind="tags", lang=lang) %} + {%- for post in tags.items %} + #{{ post.name }}  + {%- endfor %}
diff --git a/templates/taxonomy_list.html b/templates/taxonomy_list.html index 4b4e08a..f11519d 100644 --- a/templates/taxonomy_list.html +++ b/templates/taxonomy_list.html @@ -5,10 +5,10 @@

{{ taxonomy.name | capitalize }}

- {% set tags = get_taxonomy(kind="tags", lang=lang) %} - {% for post in tags.items %} + {%- set tags = get_taxonomy(kind="tags", lang=lang) %} + {%- for post in tags.items %} #{{ post.name }}  - {% endfor %} + {%- endfor %}
diff --git a/templates/taxonomy_single.html b/templates/taxonomy_single.html index 9c9cebb..ea58c99 100644 --- a/templates/taxonomy_single.html +++ b/templates/taxonomy_single.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% block main %} +{%- block main -%}
{%- if term %}

Filtering for "{{ term.name }}"

@@ -9,7 +9,7 @@ {%- endif %}
    - {% for page in term.pages %} + {%- for page in term.pages %}
  • @@ -20,11 +20,11 @@ {{ page.title }}
  • - {% else %} + {%- else %}
  • {{ trans(key="no_posts", lang=lang) }}
  • - {% endfor %} + {%- endfor %}
-{% endblock %} +{%- endblock -%} -- cgit 1.4.1