[Python-Dev] Re: User extendable literal modifiers ?!
Mon, 30 Sep 2002 10:16:12 -0500
On Mon, Sep 30, 2002 at 11:01:24AM +0200, Fredrik Lundh wrote:
> btw, the following note is slightly related to this topic, and has been
> generating some buzz lately (at least in my mailbox):
This is a little like what I implemented for 'pyhtml'. It was inteded
to be an extension to the Quixote templating system, so it used the idea
that a HTML tag embedded in the code should write itself directly to the
output, like the result of expression statements already does in
An excerpt the README:
The following code:
for i in range(10):
would output something like
As you can see, I let <TAG> start a block, and let blocks end according
to Python's normal indentation rules. The productions added to the
compound_stmt: ... | tag_stmt
tag_stmt: '<' NAME [tag_args] '>' suite
tag_args: NAME '=' expr (',' NAME '=' expr)* [',']
<DIV CLASS="blue"> "this might be blue"
would also work.
I thought it was rather cute to reverse the normal practice of finding a
way to shoehorn Python syntax into the midst of an HTML document, but
never wrote anything serious using pyhtml. The remains of the project
can be seen at