From 295c9151f44736baaa89eddef34e3e008658fd4b Mon Sep 17 00:00:00 2001 From: Cyril MARPAUD Date: Tue, 14 Mar 2023 11:29:35 +0100 Subject: [PATCH] refactor: rationalize whitespace --- templates/base.html | 7 ++++--- templates/cards/columns.html | 25 +++++++++++-------------- templates/cards/list.html | 35 ++++++++++++++++------------------- templates/index.html | 20 ++++++++++---------- templates/macros.html | 16 +++++++++------- 5 files changed, 50 insertions(+), 53 deletions(-) diff --git a/templates/base.html b/templates/base.html index c224fe7..530c37c 100644 --- a/templates/base.html +++ b/templates/base.html @@ -19,12 +19,13 @@ - {% block content %}{% endblock %} - +{% block content %}{% endblock -%} - \ No newline at end of file + + + diff --git a/templates/cards/columns.html b/templates/cards/columns.html index 821ebb6..035db99 100644 --- a/templates/cards/columns.html +++ b/templates/cards/columns.html @@ -1,15 +1,12 @@ {{ section.content | safe }} - -
- {% for page in section.pages %} -
-

{{ page.title }}

- - {% for icon in page.extra.icons | default(value=[]) %} - - {% endfor %} - - {{ page.content | safe }} -
- {% endfor %} -
\ No newline at end of file +
+ {%- for page in section.pages %} +
+

{{ page.title }}

+ {% for icon in page.extra.icons | default(value=[]) -%} + + {%- endfor %} + {{ page.content | safe }} +
+ {%- endfor %} +
diff --git a/templates/cards/list.html b/templates/cards/list.html index bdec63f..8d731b3 100644 --- a/templates/cards/list.html +++ b/templates/cards/list.html @@ -1,19 +1,16 @@ -{{ section.content | safe }} - -{% for page in section.pages %} -{% set_global link_after = not link_after | default(value=false) %} -

{{ page.title }}

-
- {% if link_after %} - {{ page.content | safe }} - {% endif %} - - {% if page.extra.link %} - {{ section.extra.discover | default(value="Discover") }} - {% endif %} - - {% if not link_after %} - {{ page.content | safe }} - {% endif %} -
-{% endfor %} \ No newline at end of file +{{ section.content | safe -}} + {% for page in section.pages %} + {% set_global link_after = not link_after | default(value=false) %} +

{{ page.title }}

+
+ {%- if link_after %} + {{ page.content | safe }} + {%- endif -%} + {% if page.extra.link %} + {{ section.extra.discover | default(value="Discover") }} + {%- endif -%} + {% if not link_after %} + {{ page.content | safe -}} + {% endif %} +
+ {%- endfor -%} diff --git a/templates/index.html b/templates/index.html index 457dada..207fb6d 100644 --- a/templates/index.html +++ b/templates/index.html @@ -36,28 +36,28 @@

{%- for role in section.extra.roles %} {{ role }}
- {% endfor %} + {%- endfor %}

- {%- endif -%} + {%- endif %} {% if config.extra.links -%} - {% endif %} + {%- endif %} {% if sections -%} {%- endif %} @@ -65,8 +65,8 @@ -{% for section in sections -%} +{%- for section in sections %} {{ macro::card(section=section) }} -{% endfor -%} +{%- endfor %} {% endblock content %} \ No newline at end of file diff --git a/templates/macros.html b/templates/macros.html index 7c9771a..fa420f2 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -1,6 +1,7 @@ {% macro card(section) -%} -{% set section_name = macro::get_section_name(section=section) -%} +{% set section_name = macro::get_section_name(section=section) %}
+
@@ -9,21 +10,22 @@
+

{{ macro::get_section_title(section=section) }}

- {% set card_type = section.extra.card_type | default(value="simple") %} + {% set card_type = section.extra.card_type | default(value="simple") -%} {% if card_type == "simple" -%} - {%- include "cards/simple.html" -%} + {% include "cards/simple.html" -%} {% elif card_type == "columns" -%} - {%- include "cards/columns.html" -%} + {% include "cards/columns.html" -%} {% elif card_type == "list" -%} - {%- include "cards/list.html" -%} + {% include "cards/list.html" -%} {% else -%}

Unknown Card Type 🤷

- {% endif -%} + {%- endif %}
-{% endmacro %} +{%- endmacro %}