Output the raw source of an evoque template
Just evoque() with raw=True and, if we would like to escape html source,
then also specify quoting="str". It does not matter how the evoque
template is defined, or what source format it is in. Here's an example,
let's first define a template template.html:
And we can evoque it as raw source from an application:
Or, from another template in the same collection:
Notes
Either of
get_template(raw=True).evoque() or
get_template().evoque(raw=True) is valid,
but there is a significant difference here:
stating get_template(raw=True) will
(when template is not yet loaded) load it and not compile it;
stating evoque(raw=True) will, after loading and compiling
the template if necessary, render the template's raw source.
Similarly, it is possible to do either of
get_template(quoting="str").evoque() or
get_template().evoque(quoting="str"): the first, used when
the template is loaded, sets the template's default
quoted string class to use, while the second specifies
which one to use for this evoque'ation.
Using the $evoque{} form, quoting="str" and
raw=True also have the implications that if the template is
not yet loaded then it will be loaded with unicode as its
default quoted string class, and as a raw template, i.e. it will
not be compiled and any subsequent attempts of evoque(raw=False)
will result in an error.
Any template may be rendered raw.
Sometimes you know beforehand that a template will be almost always rendered raw.
In those cases it is more practical to specify a $prefer{ raw=True }
directive once in the template itself, as opposed to specify same on each
evoque'ation of the template. Same suggestion applies for quoting.