{% set xml_image_not_done = [1] %}{# why must nunjucks suck so much? #} {% macro figure_layer(figure) %} {% set figure_style %}{% filter cull_whitespace %} {% if figure.opacity!=1 %} opacity: {{ figure.opacity }}; {% endif %} {% if figure.color!=1 %} color: {{ figure.color }}; {% endif %} transform: {% if figure.offset and figure.offset|any %} translate({{ figure.offset[0]*100 }}%, {{ figure.offset[1]*100 }}%) {% endif %} {% if figure.rotation %} rotate({{ figure.rotation }}deg) {% endif %} {% if figure.flip_x %} scaleX(-1) {% endif %} {% if figure.flip_y %} scaleY(-1) {% endif %} {% if figure.scale and figure.scale!=1 %} scale({{figure.scale | string | replace("[", "") | replace("]", "") }}) {% endif %} ; {% endfilter %}{% endset %} {% if figure.source == "xml" %} {% set figure_name = xml.image if xml.image | startswith("http") else xml.image | split(":") | tail | join(":") %} {% set figure_source = "url" if xml.image | startswith("http") else xml.image | split(":") | first %} {% if xml_image_not_done.pop() %}{% endif %} {% else %} {% set figure_name = figure.name %} {% set figure_source = figure.source %} {% endif %}