{# Shared Jinja macros for the generator wizard, in Bootstrap 5.2 with feather icons and the few rules of the generator's own stylesheet (assets/css/generator.css). #} {#- The info mark beside a field. The tooltip sits on a focusable wrapper and not on the icon, so a keyboard reaches the wrapper too. ui.js and wizard-spa.js start it. -#} {%- macro info(text) -%} {{ icon('info', size=24) }} {%- endmacro %} {%- macro section(title, subtitle=None) -%}

{{ title }}

{% if subtitle %}
{{ subtitle }}
{% endif %}
{%- endmacro %} {%- macro slider_field(name, label, tip, values, errors, default=1, min=1, max=50, step=1, min_from=None, max_from=None) -%}
{{ values.get(name, default) }}
{{ min }} {{ max }}
{% if errors.get(name) %}
{{ errors[name] }}
{% endif %}
{%- endmacro %} {%- macro number_field(name, label, tip, values, errors, default=0, min=None, max=None, step=None, clamp=True, min_from=None, max_from=None) -%}
{% if errors.get(name) %}
{{ errors[name] }}
{% endif %}
{%- endmacro %} {%- macro range_field(min_name, max_name, label, tip, values, errors, default_min=1, default_max=10, hard_min=1, hard_max=None) -%}
Min
{% if errors.get(min_name) %}
{{ errors[min_name] }}
{% endif %}
Max
{% if errors.get(max_name) %}
{{ errors[max_name] }}
{% endif %}
{%- endmacro %} {%- macro probability_field(name, label, tip, values, errors, default=0.0, symbol=None, disabled=False) -%}
{% if disabled %} {# A disabled input won't submit; mirror the value so the server still sees 0 for this field and the distribution stays consistent. #} {% endif %} {% if errors.get(name) %}
{{ errors[name] }}
{% endif %}
{%- endmacro %} {%- macro check_field(name, label, tip, values, default=False, disabled=False, hidden_fallback=False, hidden=False) -%} {%- endmacro %} {%- macro sum_badge(id, label, initial='1.0000') -%}
{{ label }} {{ initial }}
{%- endmacro %} {%- macro _kv(label, value) -%}
{{ label }} {{ value }}
{%- endmacro %} {%- macro _pct(v) -%}{{ '%d' | format(((v or 0) * 100) | round | int) }}%{%- endmacro %} {%- macro summary_panel(p, current_step=0) -%} {# Live summary of the user's choices. One section per wizard step so the panel mirrors the stepper beside it. Each section is suppressed until the relevant step has been filled — the panel grows as the user advances. #} {% if p %}
Your setup
{# 1 — Batch #} {% if p.get('NUM_MODELS') or p.get('SEED') or p.get('NAME_PREFIX') %}
1 · Batch
{% if p.get('NUM_MODELS') %}{{ _kv('Models', p.NUM_MODELS) }}{% endif %} {% if p.get('SEED') is not none %}{{ _kv('Seed', p.SEED) }}{% endif %} {% if p.get('NAME_PREFIX') %}{{ _kv('Prefix', "'" ~ p.NAME_PREFIX ~ "'") }}{% endif %}
{% endif %} {# 2 — Language levels #} {% set majors = [] %} {% if p.get('BOOLEAN_LEVEL') %}{% set _ = majors.append('Boolean') %}{% endif %} {% if p.get('ARITHMETIC_LEVEL') %}{% set _ = majors.append('Arithmetic') %}{% endif %} {% if p.get('TYPE_LEVEL') %}{% set _ = majors.append('Type') %}{% endif %} {% set minors = [] %} {% if p.get('GROUP_CARDINALITY') %}{% set _ = minors.append('Group card.') %}{% endif %} {% if p.get('FEATURE_CARDINALITY') %}{% set _ = minors.append('Feature card.') %}{% endif %} {% if p.get('AGGREGATE_FUNCTIONS') %}{% set _ = minors.append('Aggregates') %}{% endif %} {% if p.get('STRING_CONSTRAINTS') %}{% set _ = minors.append('String ctc') %}{% endif %} {% if majors or minors %}
2 · Language levels
{% if majors %}{{ _kv('Majors', majors | join(', ')) }}{% endif %} {{ _kv('Minors', minors | join(', ') if minors else '—') }}
{% endif %} {# 3 — Feature tree #} {% if p.get('MIN_FEATURES') or p.get('MAX_FEATURES') or p.get('MAX_TREE_DEPTH') %}
3 · Feature tree
{% if p.get('MIN_FEATURES') or p.get('MAX_FEATURES') %} {{ _kv('Features', '%s – %s' | format(p.get('MIN_FEATURES','?'), p.get('MAX_FEATURES','?'))) }} {% endif %} {% if p.get('MAX_TREE_DEPTH') %}{{ _kv('Depth ≤', p.MAX_TREE_DEPTH) }}{% endif %} {% set rel_bits = [] %} {% if p.get('DIST_OPTIONAL', 0) > 0 %}{% set _ = rel_bits.append('opt ' ~ _pct(p.DIST_OPTIONAL)) %}{% endif %} {% if p.get('DIST_MANDATORY', 0) > 0 %}{% set _ = rel_bits.append('mand ' ~ _pct(p.DIST_MANDATORY)) %}{% endif %} {% if p.get('DIST_ALTERNATIVE', 0) > 0 %}{% set _ = rel_bits.append('alt ' ~ _pct(p.DIST_ALTERNATIVE)) %}{% endif %} {% if p.get('DIST_OR', 0) > 0 %}{% set _ = rel_bits.append('or ' ~ _pct(p.DIST_OR)) %}{% endif %} {% if p.get('DIST_GROUP_CARDINALITY', 0) > 0 %}{% set _ = rel_bits.append('group ' ~ _pct(p.DIST_GROUP_CARDINALITY)) %}{% endif %} {% if rel_bits %}{{ _kv('Rel mix', rel_bits | join(' · ')) }}{% endif %} {% if p.get('FEATURE_CARDINALITY') and p.get('PROB_FEATURE_CARDINALITY', 0) > 0 %} {{ _kv('Feat card.', '%s%% [%s..%s]' | format( (p.PROB_FEATURE_CARDINALITY * 100) | round | int, (p.get('MIN_FEATURE_CARDINALITY', [2]) or [2])[0], (p.get('MAX_FEATURE_CARDINALITY', [5]) or [5])[0])) }} {% endif %} {% if p.get('GROUP_CARDINALITY') %} {{ _kv('Group card.', '[%s..%s]' | format(p.get('GROUP_CARDINALITY_MIN', '?'), p.get('GROUP_CARDINALITY_MAX', '?'))) }} {% endif %}
{% endif %} {# 4 — Constraints #} {% if p.get('MIN_CONSTRAINTS') or p.get('MAX_CONSTRAINTS') or p.get('MIN_VARS_PER_CONSTRAINT') or p.get('MAX_VARS_PER_CONSTRAINT') %}
4 · Constraints
{% if p.get('MIN_CONSTRAINTS') or p.get('MAX_CONSTRAINTS') %} {{ _kv('Count', '%s – %s' | format(p.get('MIN_CONSTRAINTS','?'), p.get('MAX_CONSTRAINTS','?'))) }} {% endif %} {% if p.get('MIN_VARS_PER_CONSTRAINT') or p.get('MAX_VARS_PER_CONSTRAINT') %} {{ _kv('Vars/ctc', '%s – %s' | format(p.get('MIN_VARS_PER_CONSTRAINT','?'), p.get('MAX_VARS_PER_CONSTRAINT','?'))) }} {% endif %} {% set ctc_bits = [] %} {% if p.get('CTC_DIST_BOOLEAN', 0) > 0 %}{% set _ = ctc_bits.append('B ' ~ _pct(p.CTC_DIST_BOOLEAN)) %}{% endif %} {% if p.get('CTC_DIST_INTEGER', 0) > 0 %}{% set _ = ctc_bits.append('ℤ ' ~ _pct(p.CTC_DIST_INTEGER)) %}{% endif %} {% if p.get('CTC_DIST_REAL', 0) > 0 %}{% set _ = ctc_bits.append('ℝ ' ~ _pct(p.CTC_DIST_REAL)) %}{% endif %} {% if p.get('CTC_DIST_STRING', 0) > 0 %}{% set _ = ctc_bits.append('S ' ~ _pct(p.CTC_DIST_STRING)) %}{% endif %} {% if ctc_bits %}{{ _kv('Type mix', ctc_bits | join(' · ')) }}{% endif %}
{% endif %} {# 5 — Attributes #} {% if p.get('RANDOM_ATTRIBUTES') is not none or p.get('ATTRIBUTES_LIST') %}
5 · Attributes
{% if p.get('RANDOM_ATTRIBUTES') %} {{ _kv('Mode', 'random') }} {% if p.get('MIN_ATTRIBUTES') is not none or p.get('MAX_ATTRIBUTES') is not none %} {{ _kv('Count', '%s – %s' | format(p.get('MIN_ATTRIBUTES','?'), p.get('MAX_ATTRIBUTES','?'))) }} {% endif %} {% set att_bits = [] %} {% if p.get('DIST_BOOLEAN', 0) > 0 %}{% set _ = att_bits.append('B ' ~ _pct(p.DIST_BOOLEAN)) %}{% endif %} {% if p.get('DIST_INTEGER', 0) > 0 %}{% set _ = att_bits.append('ℤ ' ~ _pct(p.DIST_INTEGER)) %}{% endif %} {% if p.get('DIST_REAL', 0) > 0 %}{% set _ = att_bits.append('ℝ ' ~ _pct(p.DIST_REAL)) %}{% endif %} {% if p.get('DIST_STRING', 0) > 0 %}{% set _ = att_bits.append('S ' ~ _pct(p.DIST_STRING)) %}{% endif %} {% if att_bits %}{{ _kv('Type mix', att_bits | join(' · ')) }}{% endif %} {% else %} {{ _kv('Mode', 'manual') }} {% if p.get('ATTRIBUTES_LIST') %}{{ _kv('Defined', p.ATTRIBUTES_LIST | length) }}{% endif %} {% endif %}
{% endif %} {# 6 — Output #} {% if p.get('ENSURE_SATISFIABLE') is not none or p.get('INCLUDE_FEATURE_COUNT_SUFFIX') or p.get('INCLUDE_CONSTRAINT_COUNT_SUFFIX') %}
6 · Output
{{ _kv('Ensure SAT', 'yes' if p.get('ENSURE_SATISFIABLE') else 'no') }} {% set sfx = [] %} {% if p.get('INCLUDE_FEATURE_COUNT_SUFFIX') %}{% set _ = sfx.append('_Nf') %}{% endif %} {% if p.get('INCLUDE_CONSTRAINT_COUNT_SUFFIX') %}{% set _ = sfx.append('_Nc') %}{% endif %} {{ _kv('Suffixes', sfx | join(' ') if sfx else '—') }}
{% endif %}
{% endif %} {%- endmacro %}