diff --git a/templates/macros.html b/templates/macros.html new file mode 100644 index 0000000..4cbd05c --- /dev/null +++ b/templates/macros.html @@ -0,0 +1,30 @@ +{% macro print_tool(program) %} +
+ {% if program.extra.linkto and program.extra.directlink %} + + {% else %} + + {% endif %} +

{{ program.title }}

+ {% if program.extra.logo %} + {{ program.title }} + {% endif %} +
+

{{ program.description | safe }}

+ {% if program.extra.positive_short and program.extra.negative_short %} +
+ + +
+ {% endif %} +
+{% endmacro print_tool %} + diff --git a/templates/page.html b/templates/page.html index bdbe675..43ee733 100644 --- a/templates/page.html +++ b/templates/page.html @@ -1,4 +1,5 @@ {% extends "index.html" %} +{% import "macros.html" as macros %} {% block content %}
@@ -19,33 +20,16 @@
{% for program in section.pages %} {% if program.taxonomies.categories and program.taxonomies.categories is containing(page.slug) %} -
- {% if program.extra.linkto and program.extra.directlink %} - - {% else %} - - {% endif %} -

{{ program.title }}

- {% if program.extra.logo %} - {{ program.title }} - {% endif %} -
-

{{ program.description | safe }}

- {% if program.extra.positive_short and program.extra.negative_short %} -
-
    - {% for item in program.extra.positive_short %} -
  • {{ item }}
  • - {% endfor %} -
-
    - {% for item in program.extra.negative_short %} -
  • {{ item }}
  • - {% endfor %} -
-
- {% endif %} -
+ {% if program.extra.positive_short and program.extra.negative_short %} + {{ macros::print_tool(program=program) }} + {% endif %} + {% endif %} + {% endfor %} + {% for program in section.pages %} + {% if program.taxonomies.categories and program.taxonomies.categories is containing(page.slug) %} + {% if not program.extra.positive_short or not program.extra.negative_short %} + {{ macros::print_tool(program=program) }} + {% endif %} {% endif %} {% endfor %}