Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ANN: Evoque - managed eval-based templating

1 view
Skip to first unread message

mario ruggier

unread,
Mar 7, 2008, 10:45:36 AM3/7/08
to python-ann...@python.org, QP/QPY Discussion
I'm proud to announce the first public release of the Evoque templating
engine for python, version 0.1.

Evoque is a full-featured and generic text templating system for python
using a simple $-substitution syntax and providing support for flow
control, nested templates, overlays, inter-template addressing and
invocation, cache management, arbitrary python expressions, advanced
python % operator string formatting, restricted execution, automatic
cross-site scripting protection, advanced encoding guessing algorithm,
and more.

Allowing only python expressions and a managed evaluation namespace,
Evoque offers a surprising level of simplicity, versatility and
performance.

Buzz

* Full-featured pure python templating engine / 970 SLOC
* Automatic input quoting / XSS protection (thanks to Qpy)
* Restricted execution
* Every text file is a template
* Unicode
* Simplicity
* Speed (+/- same as Mako)
* Academic Free License v. 3.0

Template Syntax

$ -> escape, replaced with $
${expr} -> substitution, like %(expr)s
${expr!format} -> substitution, like %(expr)format
$if{expr} ... $elif{expr} ... $else ... $fi
$for{item in items} ... $else ... $rof
$begin{label} ... $end{label}
$prefer{raw=False, data=None, quoting=None, filters=None}
$evoque{name, src=None, collection=None, raw=False,
quoting=None, input_encoding=None, filters=None, **kw}
$overlay{name, space="positive", src=None, collection=None,
raw=False, quoting=None, input_encoding=None, **kw}
$test{**kw}
#[ comment ]#
"\" at end-of-line consumes the following newline

Usage

domain = Domain("/home/user/templates")
print domain.get_template("snap.html").evoque(vars())

Homepage

http://evoque.gizmojo.org/

--
Mario Ruggier

0 new messages