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

ANN: empy 1.0 -- Embed Python in template text as markup

0 views
Skip to first unread message

Erik Max Francis

unread,
Jul 23, 2002, 4:35:47 PM7/23/02
to
Summary

empy (formerly Munch) is a system for embedding Python expressions
and statements in template text (or any other unexecuted content);
it takes source files, processes them, and produces output. These
are done via expansions, which are snippets of Python code delimited
by character sequences involving a special prefix (by default the at
sign, '@'), and are substituted in the output with the return
value (for expressions) or with any in-Python printing to stdout
that takes place (for both expressions and statements). If the
value of an evaluated expression is None, nothing is expanded
(that is, it acts like the interactive Python interpreter).
Textual data not explicitly delimited in this way is sent
unaffected to the output file, allowing Python to be used in
effect as a markup language. Explicit expansion, or inclusion of
other files to be expanded, is possible. Also supported are
m4-style diversions, where output can be systematically deferred
and recalled.

Expressions are embedded in text with the '@(...)' notation; as a
shortcut, simple variables and expressions can be abbreviated as
'@variable', '@object.attribute', '@array' [index],
'@function(arguments)', or variations. Full-fledged statements
are embedded with '@{...}'. A '@' followed by a whitespace
character (including a newline) expands to nothing, allowing line
continuations. Comments are indicated with '@#' and consume the
rest of the line, including the trailing newline. A '@@' sequence
expands to a single literal at sign.


Getting the software

The software is available in a tarball here:
http://www.alcyone.com/pyos/empy/empy-1.0.tar.gz.

The official URL for this Web site is
http://www.alcyone.com/pyos/empy/.

--
Erik Max Francis / m...@alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ See the son in your bad day / Smell the flowers in the valley
\__/ Chante Moore
Bosskey.net: Aliens vs. Predator 2 / http://www.bosskey.net/avp2/
A personal guide to Aliens vs. Predator 2.

0 new messages