dirckb at my-deja.com dirckb at my-deja.com
Thu May 18 07:03:45 CEST 2000

In article <392345E4.6F94832E at san.rr.com>,
  Courageous <jkraska1 at san.rr.com> wrote:
> I am considering writing a Python preproccesor,
> and I'm wondering if prior work has been done,
> and if there's any collective wisdom or thoughts
> on the concept...


I have a Python based macro engine I've been working on as part of
a project for code publishing, similar to py2html and py2pdf.
It wasn't intended as a pre-processor for Python itself, but you might
find some of the ideas useful if you are headed in that direction.

The macro syntax I've been playing with looks something like this:

    @symbol - variable replacement or function call (no arguments)
    @symbol{string} - call a function (or % a string) with a string
    @symbol(args) - call a function with args
    @{any Python code} - execute any Python
    @(any Python expression) - evaluate any Python and display result

The Python functions invoked can return a result string or print to
sys.stdout, and the result will be substituted inline.

The code publishing tool uses macros to simplify HTML representation,
for example:

        @b{Bold Text}

        row 1;col 2;col 3
        row 2;col 2;col 3


The full package is at http://www.danbala.com/python/lpy

The macro module is pymacro.py in

This stuff isn't production-quality yet, but if you're interested and
would like to take a look, any comments would be greatly appreciated.



Dirck Blaskey
Danbala Software

Sent via Deja.com http://www.deja.com/
Before you buy.

More information about the Python-list mailing list