[ANN] HTMLTemplate 1.0.0

Walter Dörwald walter at livinglogic.de
Fri Jun 4 13:26:23 EDT 2004


Ian Sparks wrote:

> Walter Dörwald wrote :
> 
>>XIST follows a different philosophy: All templates are pure XML (in
>>fact most of our templates consist of a root element only (something
>>like <newsPage/>)). The rest is done in pure Python code. The designer
>>develops the XML elements for the layout.
> 
> So this is JSP taglibs for python?

... and PHP taglibs and PSP taglibs (not yet, but simple
to implement) and EZT templates (ViewCVS) and ...

XIST is not so much about how to get your business logic
into the web pages, but how to simplify creating the
repetitive parts of the web pages.

> Taglibs seem like a good idea,
 > code-up your own tags and sprinkle them throughout your HTML.
 > But taken to the logical conclusion you get to monolithic tags
 > like your <newsPage/> example.

You have tags on all levels of a webpage, from a simple one
that e.g. formats positive numbers green and negative ones red
to complete web pages.

>>Our main designer had no previous programming experience and was using
>>Adobe GoLive before joining our company. Now he's programming all his
>>HTML templates in Python without any problems.
> 
> I can see how this would play out. You hire a web-designer and
 > explain to them your custom tags and what they do. They start
 > using them in GoLive (or whatever their tool of choice is) but
 > the custom tags don't render in their tool.

But if the web page consists of a large table, and you
want to replace the table tag with an XIST plaintable (with
adds border="0" cellspacing="0" cellpadding="0" automatically)
you suddenly loose the formatting of the complete page.

> As the tag libraries
 > build up in complexity the HTML migrates from the templates into
 > the python taglib code and inevitably the designer will follow
 > the HTML there.

I dont' think it's feasible to combine XIST and HTML editors.

> Eventually the taglib becomes so customized that there is no HTML left,
 > only custom tags. Eventually the designer abandons the "HTML template"
 > completely and it is left as a stub like <newsPage/> (which
 > looks a bit vestigal to me, the code equivalent of tonsils).

Of course you can instantiate your page element directly instead
of putting it in an XML file. Then generating the final web page
template looks like this:
print newsPage().conv().asBytes(encoding="utf-8")

> I'm not criticising XIST (it looks very powerful). I'm genuinely
 > interested in what happens when you mutate HTML into a custom XML markup
 > via taglibs : How far does it go?

As far as you want. You can have a file that looks like
HTML and uses only a few simple tag, or go all the way up
to <newsPage/>.

> Is there some safe middle ground?
 > Can you share the resulting markup language with 3rd parties
 > or has it simply become too customized to your uses?

If you design frameworks for specific application areas,
it should certainly be possible to share them with 3rd parties.

> For instance,
 > what would be the learning curve to bring in a new HTML designer?

Compared to "hack together a HTML file in frontpage and ship
it to the programmer", you have a learn a bit: Real HTML/CSS and
Python.

> I've seen some advice on JSP taglibs to the effect of
 > "keep them small and specific and don't create monolithic tags",
 > what would your advice be for using XIST with python?

I guess this depends on the application area: You can use XIST
for HTML scraping, importing and exporting XML content,
standalone web servers on CDROMs, for generating static pages
(or PDFs via XSL-FO) and for generating templates for other
systems like JSP and PHP.

Bye,
    Walter Dörwald






More information about the Python-list mailing list