{# Shared recipient block macro. Usage: {% import "_recipient.html" as r %}{{ r.block(RECIPIENT_OBJ, STRINGS) }} RECIPIENT_OBJ shape: { name, company, address (multi-line string), uid, private (bool), extra_lines (string[]) } #} {% macro block(rec, strings) %} {%- if rec.company -%} {{ rec.company }} {%- if rec.name %}{{ rec.name }}
{% endif %} {%- elif rec.name -%} {{ rec.name }} {%- endif %} {%- if rec.address %} {%- set lines = rec.address.split('\n') -%} {%- for line in lines -%}{{ line }}{% if not loop.last %}
{% endif %}{%- endfor -%} {%- endif %} {%- if rec.extra_lines %} {%- for line in rec.extra_lines %}
{{ line }}{% endfor -%} {%- endif %} {%- if rec.uid %}
{{ strings.uid_label }} {{ rec.uid }}{% endif %} {%- if rec.private %}
{{ strings.private_label }}{% endif %} {% endmacro %}