fix(options): render newline in button optionlabels as <br> (Base font size "XLarge / (20 px)")

The fontsize option label "XLarge&#10;(20 px)" in config.xml survived XML
parsing as a real newline, but gT() html-escapes LF to &#10; (HTMLEscape),
so splitting the gT()'d label on "\n" was a no-op and the entity printed
literally. Split the raw label first, then gT() each part separately.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
Tammo ter Hark 2026-11-26 20:21:33 +01:00
commit 94a203a133
2 changed files with 7 additions and 2 deletions

View file

@ -381,7 +381,7 @@
size/weight options below. HOUSE-STYLE: fontcolor, primarycolor and size/weight options below. HOUSE-STYLE: fontcolor, primarycolor and
secondarycolor are set per variant via variants/<client>.json. --> secondarycolor are set per variant via variants/<client>.json. -->
<fontcolor type="colorpicker" category="Fonts" width="12" title="Default font color (body text)" options="on|off" optionlabels="Yes|No">#444444</fontcolor> <fontcolor type="colorpicker" category="Fonts" width="12" title="Default font color (body text)" options="on|off" optionlabels="Yes|No">#444444</fontcolor>
<fontsize type="buttons" category="Fonts" width="12" title="Base font size (body text)" options="14px|16px|18px|20px" optionlabels="Small (14px)|Normal (16px)|Large (18px)|XLarge (20 px)">16px</fontsize> <fontsize type="buttons" category="Fonts" width="12" title="Base font size (body text)" options="14px|16px|18px|20px" optionlabels="Small (14px)|Normal (16px)|Large (18px)|XLarge&#10;(20 px)">16px</fontsize>
<!-- Row 124: "Default background color" — column 1 of the colors row in the <!-- Row 124: "Default background color" — column 1 of the colors row in the
"Default fonts and colors" tab (that row is now 4 columns). It is also the "Default fonts and colors" tab (that row is now 4 columns). It is also the
5th preset of the experimental color-chooser (navbarfontcolor dropdown + 5th preset of the experimental color-chooser (navbarfontcolor dropdown +

View file

@ -593,7 +593,12 @@
{% if currentValue == optValue %}checked{% endif %} {% if currentValue == optValue %}checked{% endif %}
class="btn-check selector_option_radio_field simple_edit_options_{{ key }}{% if attr.parent != '' %} selector_radio_childfield{% endif %}" class="btn-check selector_option_radio_field simple_edit_options_{{ key }}{% if attr.parent != '' %} selector_radio_childfield{% endif %}"
{% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}/> {% if attr.parent != '' %}data-parent="{{ attr.parent }}"{% endif %}/>
<label for="{{ key }}_{{ optValue }}" class="btn btn-outline-secondary{% if currentValue == optValue %} active{% endif %}">{{ gT(optLabels[loop.index0]|default(optValue)) }}</label> {# row 144: a newline in an option label (&#10; in config.xml survives
XML attribute normalization) renders as a <br>. Split the RAW
label first: gT() html-escapes a newline to &#10;, which would
make the split a no-op. Each part is then gT()'d (html-escaped)
separately, so no raw HTML from translations #}
<label for="{{ key }}_{{ optValue }}" class="btn btn-outline-secondary{% if currentValue == optValue %} active{% endif %}">{% set lblParts = (optLabels[loop.index0]|default(optValue))|split("\n") %}{% for lp in lblParts %}{% if not loop.first %}<br>{% endif %}{{ gT(lp) }}{% endfor %}</label>
{% endfor %} {% endfor %}
{% if bInherit %} {% if bInherit %}
<input id="{{ key }}_inherit" type="radio" name="{{ key }}" value="inherit" <input id="{{ key }}_inherit" type="radio" name="{{ key }}" value="inherit"