Add/rework the options for {% attr %} and {% definevar %}.
Review Request #9055 — Created July 5, 2017 and submitted
My recent change added some control over stripping to
{% definevar %}
and made stripping mandatory for{% attr %}
. This change builds upon
that by refining the behavior and adding more options.
{% attr %}
now condenses the whitespace within the value by default
(turning sequences of spaces, tabs, and newlines into a single space).
All the new behavior can be turned off with the "nocondense" option.It also now marks the value as unsafe, instead of making that the
caller's responsibility.
{% definevar %}
now has astrip
option for stripping
leading/trailing whitespace (replacing the newstripped
), a
spaceless
option for making the text spaceless (equivalent to wrapping
the value within as{% spaceless %}
), and anunsafe
option for
marking the value as unsafe.Along with this (and to support these options),
@blocktag
now works with
template tags taking*args
. When found, the check for the maximum number
of arguments will be turned off.
Unit tests passed.
Description | From | Last Updated |
---|---|---|
Maybe slightly more consistent to use mark_for_escaping? |
david |