{% if arg.header %}
	<strong>{{ arg.header }}</strong><span></span><span></span>
{% endif %}

{# Note: Argument.choices may run code to determine resp. values; running these only once via 'with' variables does speed things up. #}
{% with id=token|add:"-"|add:arg.identity choices=arg.choices strdefault=arg.strdefault %}
	<label for="{{ id }}" title="{{ arg.identity }}: {{ arg.doc }}"><em>{{ arg.identity }}</em></label>
	<span>
		{% if arg.HTML_TYPE == "text" or arg.HTML_TYPE == "url" or arg.HTML_TYPE == "number" %}
			<input id="{{ id }}"
						 name="{{ arg.identity }}"
						 type="{{ arg.HTML_TYPE }}"
						 {% if choices %}list="{{ id }}-choices"{% endif %}
						 {{ arg.needs_value|yesno:"required," }}
						 value="{{ arg.strgiven }}"
						 {% if strdefault %}placeholder="{{ strdefault }}" size="{{ strdefault|length }}"{% endif %}>

			{% if choices %}
				<datalist id="{{ id }}-choices">
					{% for choice in choices %}
						<option value="{{ choice }}"></option>
					{% endfor %}
				</datalist>
			{% endif %}

			<img class="mbd-icon mbd-icon-small" src="{% static 'icons/actions/edit-clear.svg' %}" alt="Clear" title="Clear" onclick="$('#{{ id }}').prop('value', null);">
			{% if arg.strgiven %}
				<img class="mbd-icon mbd-icon-small" src="{% static 'icons/actions/edit-redo.svg' %}" alt="Restore" title="Restore initial value" onclick="$('#{{ id }}').prop('value', '{{ arg.strgiven }}');">
			{% endif %}
			{% if strdefault %}
				<img class="mbd-icon mbd-icon-small" src="{% static 'icons/actions/edit-paste.svg' %}" alt="Paste default" title="Paste default value for edit" onclick="$('#{{ id }}').prop('value', '{{ strdefault }}');">
			{% endif %}

		{% elif arg.HTML_TYPE == "checkbox" %}
			<input id="{{ id }}" name="{{ arg.identity }}" type="{{ arg.HTML_TYPE }}" value="{{ True }}" {{ arg.given|yesno:"checked," }}>
		{% elif arg.HTML_TYPE == "textarea" %}
			<textarea id="{{ id }}" name="{{ arg.identity }}"{{ arg.needs_value|yesno:"required," }}>{{ arg.strgiven }}</textarea>
		{% else %}
			{{ arg.identity }}: Internal error: Unknown argument type {{ arg.HTML_TYPE }}.
		{% endif %}

	</span>
	<pre>{% if verbose %}{{ arg.doc }}{% endif %}</pre>
{% endwith %}
