ANN: empy 2.1 -- Python templating system
Erik Max Francis
max at alcyone.com
Mon Oct 21 17:10:47 EDT 2002
Summary
empy is a system for embedding Python expressions and statements
in template text; it takes an empy source file, processes it, and
produces output. This is accomplished via expansions, which are
special signals to the empy system and are set off by a special
prefix (by default the at sign, '@'). empy can expand arbitrary
Python expressions and statements in this way, as well as a
variety of special forms. Textual data not explicitly delimited
in this way is sent unaffected to the output, allowing Python to
be used in effect as a markup language. Also supported are "hook"
callbacks, recording and playback via diversions, and dynamic,
chainable filters. The system is highly configurable via command
line options and embedded commands.
Expressions are embedded in text with the '@(...)' notation;
variations include conditional expressions with '@(...?...:...)'
and the ability to handle thrown exceptions with '@(...$...)'. As
a shortcut, simple variables and expressions can be abbreviated as
'@variable', '@object.attribute', '@function(arguments)',
'@sequence' [index], and combinations. Full-fledged statements
are embedded with '@{...}'. Forms of conditional, repeated, and
recallable expansion are available via '@[...]'. A '@' followed
by a whitespace character (including a newline) expands to
nothing, allowing string concatenations and line continuations.
Comments are indicated with '@#' and consume the rest of the line,
up to and including the trailing newline. '@%' indicate
"significators," which are special forms of variable assignment
intended to specify per-file identification information in a
format which is easy to parse externally. Escape sequences
analogous to those in C can be specified with '@\...', and finally
a '@@' sequence expands to a single literal at sign.
Getting the software
The current version of empy is 2.1.
The latest version of the software is available in a tarball here:
http://www.alcyone.com/pyos/empy/empy-latest.tar.gz.
The official URL for this Web site is
http://www.alcyone.com/pyos/empy/.
Requirements
empy should work with any version of Python from 1.5.x onward.
License
This code is released under the GPL.
...
Release history [since 2.0]
- 2.1; 2002 Oct 18. 'empy.atExit' registry separate from hooks to
allow for normal interpreter support; include a benchmark sample
and test.sh verification script; expose 'empy.string' directly;
-D option for explicit defines on command line; remove
ill-conceived support for '@else:' separator in '@[if ...]'
substitution; handle nested substitutions properly; '@[macro
...]' substitution for creating recallable expansions.
- 2.0.1; 2002 Oct 8. Fix missing usage information; fix
after_evaluate hook not getting called; add 'empy.atExit' call
to register values.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/ \ The purpose of man's life is not happiness but worthiness.
\__/ Felix Adler
CAGE / http://www.alcyone.com/pyos/cage/
A cellular automaton simulation system in Python.
More information about the Python-list
mailing list