The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Dotiac::DTL::Tag::autoescape - The {% autoescape [on/off] %} tag

SYNOPSIS

Template file:

{% autoescape on %}
	This variable will be HTML escaped: {{ "&'\"" }}
{% endautoescape %}
{% autoescape off %}
	This variable will NOT be HTML escaped: {{ "&'\"" }}
{% endautoescape %}

DESCRIPTION

Controls the autoescape behavior of an area.

Parameter:

[on/off]

Optional parameter:

on

Autoescaping is on for that whole area till {% endautoescape %}

off

Autoescaping is on for that whole area till {% endautoescape %}

[default]

Defaults to no change at all.

BUGS AND DIFFERENCES TO DJANGO

autoescape in extend without a block

This won't work around blocks in an extend:

{% extend "main.html %}
{% autoescape off %}
	{% block content %}
	This variable will be HTML escaped: {{ "&'\"" }}, even if there is an autoescape tag setting it off around it.
	{% endblock content %}
{% endautoescape %}

If you but the autoescape tags into the block, it will work:

{% extend "main.html %}
{% block content %}
	{% autoescape off %}
	This variable will NOT be HTML escaped: {{ "&'\"" }}
	{% endautoescape %}
{% endblock content %}

SEE ALSO

http://www.djangoproject.com, Dotiac::DTL

LEGAL

Dotiac::DTL was built according to http://docs.djangoproject.com/en/dev/ref/templates/builtins/.

AUTHOR

Marc-Sebastian Lucksch

perl@marc-s.de