Python embedded like PHP

Andrew McNamara andrewm at object-craft.com.au
Thu Mar 21 18:50:29 EST 2002


> > Albatross encourages (but doesn't enforce) the separation of presentation
> > and logic. You might do something like this in Albatross:
> >
> >     <ul>
> >     <al-for iter="reptile" expr='["Crocodile", "Python", "Iguana", "Tortoise"]'>
> >       <li><al-value expr="reptile.value()" whitespace></li>
> >     </al-for>
> >     </ul>
>
> Why, oh why, does it use HTML-like syntax?  People keep implementing
> templating languages that do this over and over, and it's a bad, bad
> idea.  Any moderately complex example of templating will violate the
> rules of HTML/SGML, with things like <img src="<al-value
> expr="something">">, which is horrible to read, will anger WYSIWYG
> editors to no end, and isn't at all necessary.

The intention is that Albatross templates be valid XML - while Albatross
will do the expected thing in the example you give above, it generally
provides a "better" way, such as:

        <al-img expr="something">

> All you have to do is use [] instead of <> -- it look about the same,
> will have all the good cognitive associations (how nesting works,
> etc), but is orthogonal to HTML, just like your templating system is
> orthogonal to HTML.  I.e., you're templates would look like

But this wouldn't be XML... 8-)

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/




More information about the Python-list mailing list