[Web-SIG] htmlgen

Ian Bicking ianb at colorstudy.com
Wed Oct 29 22:52:52 EST 2003


On Wednesday, October 29, 2003, at 07:04 PM, Bill Janssen wrote:
> Can you describe what HTMLgen does?

http://starship.python.net/crew/friedrich/HTMLgen/html/main.html

But the core portion is really about creating HTML, something along the 
lines of:

HTML(HEAD(TITLE('my page')),
      BODY(H1('my page'), IMG(src="/mypicture.jpg" width=100, 
height=100),
      ...)

With the output -- either directly or through str() -- being 
corresponding HTML.

There's several similar systems, with slight differences.  I used a 
class with magic attributes, like html.br(), for one system.  Someone 
else did something like BODY(bgcolor="#aaaaaa")[H1('title'), P()['some 
content']], and some other variations exist.

HTMLgen also includes some aspects that are more like templating, where 
you define the structure for an entire page.  But in its more basic 
form it's often useful for creating valid HTML snippets inside Python 
code.

--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org




More information about the Web-SIG mailing list