diff --git a/template/grid_sections.html.njk b/template/grid_sections.html.njk new file mode 100644 index 0000000..3c3a4e5 --- /dev/null +++ b/template/grid_sections.html.njk @@ -0,0 +1,40 @@ +{% macro render_item(item) %} + +{% set class_str = "item" %} +{% if item.highlight %} +{% set class_str = class_str + " " + "highlight" %} +{% endif %} + +{% set href = "/#" %} +{% if item.permalink is defined and not item.hide_permalink %} +{% set href = item.permalink %} +{% endif %} + +{% set misc_attr = "" %} +{% if item.hide_permalink %} +{% set misc_attr = misc_attr + " " + "hidden_permalink=\"" + item.permalink + "\"" %} +{% set misc_attr = misc_attr + " " + "seed=\"" + item.seed + "\"" %} +{% endif %} + + +
+
{{ item.name }}
+ {% if item.description is defined %} +
{{ item.description }}
+ {% endif %} +
+
+ +{% endmacro %} + +{% macro render_section(sect) %} +
+

{{ sect.name }}

+ +
+ {% for item in sect.items %} + {{ render_item(item) }} + {% endfor %} +
+
+{% endmacro %} diff --git a/template/index.html.njk b/template/index.html.njk index 41d7a5c..4be9d0b 100644 --- a/template/index.html.njk +++ b/template/index.html.njk @@ -1,45 +1,6 @@ -{% macro render_item(item) %} - -{% set class_str = "item" %} -{% if item.highlight %} -{% set class_str = class_str + " " + "highlight" %} -{% endif %} - -{% set href = "/#" %} -{% if item.permalink is defined and not item.hide_permalink %} -{% set href = item.permalink %} -{% endif %} - -{% set misc_attr = "" %} -{% if item.hide_permalink %} -{% set misc_attr = misc_attr + " " + "hidden_permalink=\"" + item.permalink + "\"" %} -{% set misc_attr = misc_attr + " " + "seed=\"" + item.seed + "\"" %} -{% endif %} - - -
-
{{ item.name }}
- {% if item.description is defined %} -
{{ item.description }}
- {% endif %} -
-
- -{% endmacro %} - -{% macro render_section(sect) %} -
-

{{ sect.name }}

- -
- {% for item in sect.items %} - {{ render_item(item) }} - {% endfor %} -
-
-{% endmacro %} +{% import "grid_sections.html.njk" as grid_sections %} @@ -66,7 +27,7 @@ {% for s in section %} - {{ render_section(s) }} + {{ grid_sections.render_section(s) }} {% endfor %}