{#- How a value that is one of a few is drawn: a badge in the tone its field gives it, or nothing where the field draws that value with no badge. -#} {% macro badge(item, raw, text) -%} {%- set tone = item.tone_of(raw) if item.tone_of is defined else 3 -%} {%- if tone is not none -%} {{ text }} {%- endif -%} {%- endmacro %} {#- The same on a record page, where every field names its value: the text alone where the field gives that value no badge, such as a plain No. -#} {% macro badge_or_text(item, raw, text) -%} {%- set tone = item.tone_of(raw) if item.tone_of is defined else 3 -%} {%- if tone is not none -%} {{ text }} {%- else -%} {{ text }} {%- endif -%} {%- endmacro %}