{% match metadata %}
{% when Some with (metadata) %}
{% match metadata.description %}
{% when Some with (description) %}
{{ description }}
{% when None %}
{% endmatch %}
{% match metadata.servings %}
{% when Some with (servings) %}
👥 {{ servings }} {{ tr.t("recipe-servings-label") }}
{% when None %}
{% endmatch %}
{% match metadata.time %}
{% when Some with (time) %}
⏱️ {{ time }}
{% when None %}
{% endmatch %}
{% match metadata.author %}
{% when Some with (author) %}
👤 {{ author }}
{% when None %}
{% endmatch %}
{% match metadata.source %}
{% when Some with (source) %}
📖 {{ source }}
{% when None %}
{% endmatch %}
{% match metadata.source_url %}
{% when Some with (source_url) %}
🔗 {{ source_url|hostname }}
{% when None %}
{% endmatch %}
{% for (key, value) in metadata.custom %}
{{ key }}: {{ value }}
{% endfor %}
{% when None %}
{% endmatch %}
{% for section in sections %}
{% match section.name %}
{% when Some with (name) %}
{{ name }}
{% when None %}
{% endmatch %}
{% for line in section.lines %}
{% if line.len() == 1 %}
{% match line[0] %}
{% when crate::server::templates::MenuSectionItem::Text with (text) %}
{% if text.trim().ends_with(":") %}
{{ text }}
{% else %}
{{ text }}
{% endif %}
{% when _ %}
{% match line[0] %}
{% when crate::server::templates::MenuSectionItem::RecipeReference with { name, scale } %}
{{ name.strip_prefix("./").unwrap_or(name).replace("/", " › ") }}
{% match scale %}
{% when Some with (s) %}
(×{{ s }})
{% when None %}
{% endmatch %}
{% when crate::server::templates::MenuSectionItem::Ingredient with { name, quantity, unit } %}
{{ name }}
{% match quantity %}
{% when Some with (q) %}
{{ q }}
{% when None %}
{% endmatch %}
{% match unit %}
{% when Some with (u) %}
{{ u }}
{% when None %}
{% endmatch %}
{% when _ %}
{% endmatch %}
{% endmatch %}
{% else %}
{% for item in line %}
{% match item %}
{% when crate::server::templates::MenuSectionItem::Text with (text) %}
{{ text }}
{% when crate::server::templates::MenuSectionItem::RecipeReference with { name, scale } %}
{{ name.strip_prefix("./").unwrap_or(name).replace("/", " › ") }}
{% match scale %}
{% when Some with (s) %}
(×{{ s }})
{% when None %}
{% endmatch %}
{% when crate::server::templates::MenuSectionItem::Ingredient with { name, quantity, unit } %}
{{ name }}
{% match quantity %}
{% when Some with (q) %}
{{ q }}
{% when None %}
{% endmatch %}
{% match unit %}
{% when Some with (u) %}
{{ u }}
{% when None %}
{% endmatch %}
{% endmatch %}
{% endfor %}