a 100-line indentation-based preprocessor for HTML

Colin W. cjwilliams43 at gmail.com
Sat Nov 28 07:46:16 EST 2009


On 27-Nov-09 22:04 PM, Steve Howell wrote:
> Python has this really neat idea called indentation-based syntax, and
> there are folks that have caught on to this idea in the HTML
> community.
>
> AFAIK the most popular indentation-based solution for generating HTML
> is a tool called HAML, which actually is written in Ruby.
>
> I have been poking around with the HAML concepts in Python, with the
> specific goal of integrating with Django.   But before releasing that,
> I thought it would be useful to post code that distills the basic
> concept with no assumptions about your target renderer.  I hope it
> also serves as a good example of what you can do in exactly 100 lines
> of Python code.
>
> Here is what it does...
>
>      You can use indentation syntax for HTML tags like table.
>
>      From this...
>
>      table
>          tr
>              td
>                  Left
>              td
>                  Center
>              td
>                  Right
>
>      ...you get this:
>  ...

[snip]

This is a neat idea but would a two character indentation not be enough?

Colin W.



More information about the Python-list mailing list