{% macro typeof(thing) %} {% if thing is iterable %} {% if thing is object %} dict {% else %} list {% endif %} {% else %} {% if thing is string %} str {% elif thing is number %} num {% else %} other {% endif %} {% endif %} {% endmacro typeof %} {% macro debug(thing, label="", recurse=0) %} {% set type = self::typeof(thing=thing) | trim %} {% if label %}{{ label }}: {% endif %}{{ type }} {% set rdepth = recurse - 1 %}
{% if type == "dict" %} {% for k, v in thing %} {% if v is iterable and recurse %} {{ k }}: {{ self::debug(thing=v, recurse=rdepth) }} {% else %} {{ k }}: {{ v }}
{% endif %} {% endfor %} {% elif type == "list" %} {% for v in thing %} {% if v is iterable and recurse %} {{ self::debug(thing=v, recurse=rdepth) }} {% else %} {{ v }}
{% endif %} {% endfor %} {% else %} {{ thing }} {% endif %}
{% endmacro debug %} {% macro parent_tree(ancestors) %}
{% for sect in ancestors %} {% set sect = get_section(path=sect) %} {{ sect.title }}/ {% endfor %}
{% endmacro section_tree %} {% macro subsection_tree(subs) %} {% endmacro subsection_tree %}