diff --git a/templates/macros.html b/templates/macros.html new file mode 100644 index 0000000..cb02c69 --- /dev/null +++ b/templates/macros.html @@ -0,0 +1,47 @@ +{% 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 %} +