{#
NOTES — a field's copy with its footnote and citation markers rendered (#182, #310).
`marked(parts, raw)` walks what `apparatus.split_markers` cut: a run of copy
prints as it always did, escaped unless the field is one of the blessed
raw-HTML five, and a marker prints as a linked superscript. On paper the
note itself follows the marker in a span the paged skeleton floats to the
sheet foot (`float: footnote`, a WeasyPrint feature); an email collects its
notes as endnotes instead, so the span is not emitted there. The number is
the document's, never a CSS counter, so the text part prints the same one.
A marker straight after another opens on a comma inside its superscript, so
notes 2 and 3 read "2,3" and not "23" (#402); the comma is not part of the link.
A citation prints in the bibliography's style, each key linked to its entry;
its label comes from a Reference, so it is escaped in every field.
Every tag below sits on one logical line with whitespace control, because
a field with no marker must render byte-identically to before.
`ids=false` drops the marker's `id`, keeping its link. It is for a second
copy of a field that only one engine reads (#403's Outlook caption), so the
document still names each marker exactly once.
#}
{% macro marked(parts, raw=false, ids=true) -%}
{%- for part in parts -%}
{%- if part.note -%}
{% if part.after_note %},{% endif %}{{ part.note }}
{%- if medium.paged -%}
{%- endif -%}
{%- elif part.cites -%}
{{ part.citing.open }}{% for cite in part.cites %}{% if not loop.first %}{{ part.citing.separator }}{% endif %}{{ cite.label | escape_html }}{% endfor %}{{ part.citing.close }}
{%- elif raw -%}
{{ part.text }}
{%- else -%}
{{ part.text | escape_html }}
{%- endif -%}
{%- endfor -%}
{%- endmacro %}