<commit_before>{#=== OPTIONS ========================================================================================================#}

{% set option = {
    class:        field.class|default(''),
    label:        field.label|default(''),
    placeholder:  field.placeholder|default(''),
    required:     field.required|default(false),
    readonly:     field.readonly|default(false),
    title:        field.title|default(''),
    info:         field.info|default(''),
    errortext:    field.error|default(''),
    min:          field.min|default(''),
    max:          field.max|default(''),
    step:         field.step|default('0.00000001'),
} %}

{#=== INIT ===========================================================================================================#}

{% set attr_number = {
    class:          option.class ~ ' narrow',
    name_id:        key,
    placeholder:    option.placeholder,
    required:       option.required,
    readonly:       option.readonly,
    step:           option.step,
    min:            option.min,
    max:            option.max,
    title:          option.title,
    type:           'text',
    value:          0 + context.content.get(key),
    data_errortext: option.errortext,
} %}

{#=== FIELDSET =======================================================================================================#}

<fieldset class="float">
<commit_msg>Add validation info to input element<commit_after>{#=== OPTIONS ========================================================================================================#}

{% set option = {
    class:        field.class|default(''),
    label:        field.label|default(''),
    placeholder:  field.placeholder|default(''),
    required:     field.required|default(false),
    readonly:     field.readonly|default(false),
    title:        field.title|default(''),
    info:         field.info|default(''),
    errortext:    field.error|default(''),
    min:          field.min|default(''),
    max:          field.max|default(''),
    step:         field.step|default('0.00000001'),
} %}

{#=== INIT ===========================================================================================================#}

{% set validation = {type: 'float'} %}

{% if option.required %}
    {% set validation = validation|merge({required: true}) %}
{% endif %}

{% if option.min %}
    {% set validation = validation|merge({min: option.min}) %}
{% endif %}

{% if option.max %}
    {% set validation = validation|merge({max: option.max}) %}
{% endif %}

{% set attr_number = {
    class:          option.class ~ ' narrow',
    name_id:        key,
    placeholder:    option.placeholder,
    required:       option.required,
    readonly:       option.readonly,
    step:           option.step,
    min:            option.min,
    max:            option.max,
    title:          option.title,
    type:           'text',
    value:          0 + context.content.get(key),
    data_errortext: option.errortext,
    data_validate:  validation|json_encode,
} %}

{#=== FIELDSET =======================================================================================================#}

<fieldset class="float">

{'fraction_non_alphanumeric': 0.3270735524256651, 'fraction_numerical': 0.006259780907668232, 'mean_word_length': 3.0404551201011376, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6429299', 'n_tokens_mistral': 872, 'n_tokens_neox': 786, 'n_words': 148}