HTML Generation

Daniel Fetchinson fetchinson at googlemail.com
Fri Apr 3 10:51:03 CEST 2009


> Hello all,
>
> I'm writing a web app and wanted to do some html generation (I really do not
> like to maintain or write html).
>
> I'm thinking of writing a dsl based on the following:
>
> def html():
>     return
>
> def a():
>     return
>
> def body():
>     return
> (html,
> ...(head, (style, "id", {"font-color":"black"}))
> ...(body,
> ...... (a, "id", {"title":"bla"}, ("link title","http://www.link.com")),
> ......(p, "paragraph text")
> ...... )
> ...)
> )
>
> And then parsing the resulting list. (the specification of sorts is as far
> as I've got) I'd have to create the list as a string and then call a method
> which executes the contents as the methods would not be in the local scope.
>
> The reason I'm posting is I'm curious what people think, I've been starting
> to perfer this style and am curious if a similar solution exists or if this
> is a good idea :)
>
> I'll proberly finish it as a learning experience regardless.
>
> I appreciate any responses :)

You might find the following helpful:

http://wiki.python.org/moin/Templating

HTH,
Daniel



-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown



More information about the Python-list mailing list