ANN: Munch 0.2 -- Embed Python in template text as markup (was ANN: Munch 0.1 ...)
Erik Max Francis
max at alcyone.com
Sat Apr 13 15:45:24 EDT 2002
A new version is available: It supports specifying the prefix character
to something other than @, and properly refusing to expand a None as an
expression evaluation so that proper procedures (functions evaluated for
side effects not return value) can be used. The full information
follows.
.
Summary
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
special characters involving a special character (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 interpeter). Textual data not
explicitly delimited in this way is sent unmolested to the output
file, allowing Python to be used effectively as a markup language.
Explicit expansion within Python code 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], or
'@function(arguments)'. Full-fledged statements are embedded with
'@{...}'.
Getting the software
The software is available in a tarball here:
http://www.alcyone.com/pyos/munch/munch-0.2.tar.gz.
The official URL for this Web site is
http://www.alcyone.com/pyos/munch/.
--
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ Nationalism is an infantile sickness.
\__/ Albert Einstein
Alcyone Systems' Daily Planet / http://www.alcyone.com/planet.html
A new, virtual planet, every day.
More information about the Python-list
mailing list