Output the raw source of an evoque template

Just evoque() with raw=True and, if we would like to escape html/xml 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:

$if{items}
    <ul>
    $for{ i, item in enumerate(items) }
        <li>${item}</li>
    $rof
    </ul>
$fi

And we can evoque it as raw source from an application:

domain.get_template("template.html").evoque(raw=True, quoting="str")

Or, from another template in the same collection:

$evoque{template.html, raw=True, quoting="str"}

Additional raw source 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-no-more string class to use, while the second specifies which one to use for this evoque'ation.

Using the $evoque{template.html, raw=True, quoting="str"} form, i.e. simultaneously loading and evoking a template from within another template, also has the implications that if the template is not yet loaded then it will be (a) loaded with unicode as its default quoted-no-more string class and (b) loaded 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.

The same suggestion above applies also for quoting, e.g. $prefer{quoting="str"}.