<commit_before>{% set originalValue = originalValue is defined ? originalValue : value %}
{% set value = (value is null ? field.default : value) %}
{% set vertical = field.style == 'vertical' %}

{% if field.yaml and value is iterable %}
    {% set value = value|toYaml %}
{% endif %}

{% block field %}
    <div class="form-field grid{% if vertical %} vertical{% endif %}">
        {% block contents %}
            <div class="form-label{% if not vertical %} block size-1-3{% endif %}">
                {% if field.toggleable %}
                    <span class="checkboxes toggleable" data-grav-field="toggleable" data-grav-field-name="{{ field.name|fieldName }}">
                        <input type="checkbox"
                               id="toggleable_{{ field.name }}"
                               {% if originalValue is not null and originalValue is not empty %}value="1"{% endif %}
                               name="toggleable_{{ (scope ~ field.name)|fieldName }}"
                               {% if originalValue is not null and originalValue is not empty %}checked="checked"{% endif %}
                        >
                        <label for="toggleable_{{ field.name }}"></label>
                    </span>
                {% endif %}
                <label class="{{ field.toggleable ? 'toggleable' : '' }}">
                {% block label %}
                    {% if field.help %}
                    <span class="hint--bottom" data-hint="{{ field.help|e|tu }}">{{ field.label|tu }}</span>
                    {% else %}
                    {{ field.label|tu }}
                    {% endif %}
                    {{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}
                {% endblock %}
                </label>
            </div>
            <div class="form-data{% if not vertical %} block size-2-3{% endif %}"
                {% block global_attributes %}
                data-grav-field="{{ field.type }}"
                data-grav-disabled="{{ originalValue is null ? 'true' : 'false' }}"
                data-grav-default="{{ field.default|json_encode()|e('html_attr') }}"
                {% endblock %}
            >
                {% block group %}
                    {% block input %}
                        <div class="form-input-wrapper {{ field.size }}">
                            <input
                                {# required attribute structures #}
                                name="{{ (scope ~ field.name)|fieldName }}"
                                value="{{ value|join(', ') }}"
                                {# input attribute structures #}
                                {% block input_attributes %}
                                    {% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
                                    {% if field.id is defined %}id="{{ field.id|e }}" {% endif %}
                                    {% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
                                    {% if field.disabled %}disabled="disabled"{% endif %}
                                    {% if field.placeholder %}placeholder="{{ field.placeholder|tu }}"{% endif %}
                                    {% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
                                    {% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
                                    {% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
                                    {% if field.autocomplete in ['on', 'off'] %}autocomplete="{{ field.autocomplete }}"{% endif %}
                                    {% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
                                    {% if field.validate.pattern %}pattern="{{ field.validate.pattern }}"{% endif %}
                                    {% if field.validate.message %}title="{{ field.validate.message|e|tu }}"
                                    {% elseif field.title is defined %}title="{{ field.title|e|tu }}" {% endif %}
                                {% endblock %}
                                />
                        </div>
                    {% endblock %}
                {% endblock %}
            </div>
        {% endblock %}
    </div>
{% endblock %}
<commit_msg>Fix for HTML in text input fields<commit_after>{% set originalValue = originalValue is defined ? originalValue : value %}
{% set value = (value is null ? field.default : value) %}
{% set vertical = field.style == 'vertical' %}

{% if field.yaml and value is iterable %}
    {% set value = value|toYaml %}
{% endif %}

{% block field %}
    <div class="form-field grid{% if vertical %} vertical{% endif %}">
        {% block contents %}
            <div class="form-label{% if not vertical %} block size-1-3{% endif %}">
                {% if field.toggleable %}
                    <span class="checkboxes toggleable" data-grav-field="toggleable" data-grav-field-name="{{ field.name|fieldName }}">
                        <input type="checkbox"
                               id="toggleable_{{ field.name }}"
                               {% if originalValue is not null and originalValue is not empty %}value="1"{% endif %}
                               name="toggleable_{{ (scope ~ field.name)|fieldName }}"
                               {% if originalValue is not null and originalValue is not empty %}checked="checked"{% endif %}
                        >
                        <label for="toggleable_{{ field.name }}"></label>
                    </span>
                {% endif %}
                <label class="{{ field.toggleable ? 'toggleable' : '' }}">
                {% block label %}
                    {% if field.help %}
                    <span class="hint--bottom" data-hint="{{ field.help|e|tu }}">{{ field.label|tu }}</span>
                    {% else %}
                    {{ field.label|tu }}
                    {% endif %}
                    {{ field.validate.required in ['on', 'true', 1] ? '<span class="required">*</span>' }}
                {% endblock %}
                </label>
            </div>
            <div class="form-data{% if not vertical %} block size-2-3{% endif %}"
                {% block global_attributes %}
                data-grav-field="{{ field.type }}"
                data-grav-disabled="{{ originalValue is null ? 'true' : 'false' }}"
                data-grav-default="{{ field.default|json_encode()|e('html_attr') }}"
                {% endblock %}
            >
                {% block group %}
                    {% block input %}
                        <div class="form-input-wrapper {{ field.size }}">
                            <input
                                {# required attribute structures #}
                                name="{{ (scope ~ field.name)|fieldName }}"
                                value="{{ value|e('html_attr')|join(', ') }}"
                                {# input attribute structures #}
                                {% block input_attributes %}
                                    {% if field.classes is defined %}class="{{ field.classes }}" {% endif %}
                                    {% if field.id is defined %}id="{{ field.id|e }}" {% endif %}
                                    {% if field.style is defined %}style="{{ field.style|e }}" {% endif %}
                                    {% if field.disabled %}disabled="disabled"{% endif %}
                                    {% if field.placeholder %}placeholder="{{ field.placeholder|tu }}"{% endif %}
                                    {% if field.autofocus in ['on', 'true', 1] %}autofocus="autofocus"{% endif %}
                                    {% if field.novalidate in ['on', 'true', 1] %}novalidate="novalidate"{% endif %}
                                    {% if field.readonly in ['on', 'true', 1] %}readonly="readonly"{% endif %}
                                    {% if field.autocomplete in ['on', 'off'] %}autocomplete="{{ field.autocomplete }}"{% endif %}
                                    {% if field.validate.required in ['on', 'true', 1] %}required="required"{% endif %}
                                    {% if field.validate.pattern %}pattern="{{ field.validate.pattern }}"{% endif %}
                                    {% if field.validate.message %}title="{{ field.validate.message|e|tu }}"
                                    {% elseif field.title is defined %}title="{{ field.title|e|tu }}" {% endif %}
                                {% endblock %}
                                />
                        </div>
                    {% endblock %}
                {% endblock %}
            </div>
        {% endblock %}
    </div>
{% endblock %}

{'fraction_non_alphanumeric': 0.15328302736794683, 'fraction_numerical': 0.002252505912828021, 'mean_word_length': 1.2927962819519752, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 38, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3822620', 'n_tokens_mistral': 2402, 'n_tokens_neox': 2003, 'n_words': 518}