[Templates] "smart indentation" hack
Michael Holzt
tt2 at michael.holzt.de
Sun Dec 30 02:59:22 GMT 2007
> The code is a crude hack as it makes it own analysis of the directives
> but having it run before split_text made it much more simple to program.
Oh and what i forgot, this is only half the job. Consider this:
| [% BLOCK foo %]
| Hello
| 1234
| [% BLOCK %]
This would be deintend to
| Hello
| 1234
However when used like this:
| <foo>
| <bar>
| [% INCLUDE foo %]
| </bar>
| </foo>
the output should of course be:
| <foo>
| <bar>
| Hello
| 1234
| </bar>
| </foo>
So the identation in this case must be saved and added while
processing the called block. So i guess all the identation
and deindentation must be done later in the parsing of the
template.
Regards
Michael
--
It's an insane world, but i'm proud to be a part of it. -- Bill Hicks
More information about the templates
mailing list