{% macro slugify(text) -%} {{ text|string|lower|replace(" ", "-")|replace("--", "-")|regex_replace("/^-+/", "")|regex_replace("/-+$/","") }} {%- endmacro %} {% macro inlineDynamicStyles(styleDict) -%} {% for prop, value in styleDict.items() %} {{ prop|replace('_', '-') ~ ': ' ~ value ~ ( loop.last ? '' : '; ') }} {% endfor %} {%- endmacro %} {% macro mapFromKey(array = [],key = '') -%} {% set res = [] %} {% if key %} {% for val in array %} {% do res.append(val|attr(key)) %} {% endfor %} {% endif %} {{ res|tojson }} {%- endmacro %} {% macro getAttrWithDot(dict = {}, path = '') -%} {% set value = dict %} {% set path = path|split('.') %} {% for next in path %} {% set value = value|attr(next) %} {{ loop.last ? value|tojson : '' }} {% endfor %} {%- endmacro %} {% macro getFromHubDB(table = '', values = [],column = 'slug') -%} {% set res = [] %} {% if values|length %} {% for value in values %} {% set row = hubdb_table_rows(table, column+'='~value)|first %} {% do res.append(row) %} {% endfor %} {% endif %} {{ res|unique('hs_id')|tojson }} {%- endmacro %}