{% if display_label %}
{# The card above is the primary content; the label is always a real link
too, on top of it - route_pac_id_url_for lets an issuer route it through
their own page instead of linking straight to the PAC-ID's own URL. #}
{% if route_pac_id_url_for is defined %}
{{ label or value }}
{% else %}
{{ label or value }}
{% endif %}
{% endif %}
{% if pac_card_url_for is defined %}
{% for value in a.value_list%}
{%- if is_image(value) -%}
{{ label }}
{%- elif is_reference(value) -%}
{# Checked before is_url - a PAC-ID is itself a valid URL, so a
bare (non-pyReference) PAC-ID string would otherwise always hit
the generic link branch below and never reach the card. #}
{{ reference(value)}}
{%- elif is_url(value) -%}
{# Same icon+label format as service_links' elements -
reuses its classes rather than a parallel set, since the look is
meant to be identical. #}
{{ value }}
{%- else -%}
{{ render_text(value) }}
{%- endif -%}
{% if not loop.last %} {% endif %}
{% endfor%}
{%- for name, trex in attached_data.items() -%}
{{ attached_data_trex(name, trex) }}
{%- endfor -%}
{%- endmacro -%}
{# One pictogram , preferring an explicitly-supplied image over the
code-derived guess (see explicit_pictogram_images/hazard_pictogram_codes in
lib/render_predicates.py). resolve_static_image() only searches flat filenames
directly in the static root (Path(base_name).stem strips any directory
component before it even searches) - no subdirectory, no extension needed, it
tries svg/png/jpg/jpeg/webp itself. #}
{%- macro pictogram_image(code, explicit_images=dict()) -%}
{%- if code in explicit_images -%}
{%- else -%}
{%- endif -%}
{%- endmacro -%}
{# Shown once above the hazard/precautionary statement table (see
hazard_pictogram_codes) rather than repeated per row - a hazard statement's
pictogram is a property of the substance as a whole, and several codes
commonly share the same one (e.g. H300/H310/H330 are all Skull-and-crossbones). #}
{%- macro pictogram_strip(codes, explicit_images=dict()) -%}
{%- if codes -%}
{%- for code in codes -%}
{{ pictogram_image(code, explicit_images) }}
{%- endfor -%}
{%- endif -%}
{%- endmacro -%}
{# GHS hazard/precautionary statement rows - code beside its full text, resolved
from labfreed/utilities/ghs/ghs_statements.json (UNECE GHS Rev.7 Annex 3)
rather than requiring the attribute value to carry the full text itself. Falls
back to showing the raw value if the code isn't in that table (e.g. an
EU-specific EUH code, which isn't part of the UN GHS document this was sourced
from) - see developer-docs/design-choices.md. #}
{# th/td classes match every other key/value table (key_value_table, attribute_row) -
same 1/3-2/3 column widths and label bolding from .lf-table--kv, for free, no
GHS-specific CSS needed. #}
{%- macro hazard_statement_row(raw_value) -%}
{%- set code = extract_statement_code(raw_value) -%}