Re: Templates and customization

Georg Bauer <gb-BRhJDZTO+/[email protected]> Fri, 12 Mar 2004 17:40:49 +0100
Newsgroups gmane.comp.pythin.pyds.devel
Message-ID <r02010100-1028-058E4EB7744411D8BE7D000A9573A72A@[10.0.0.145]>
Hi!

> I've been customizing my templates lately, and I've been finding it a 
> challenge. I don't mean to sound arrogant, but if I'm finding it a 
> challenge many others will find it impossible.

Yep, it's a bit complicated. I did choose Cheetah over other - more
restricted - template engines for a good reason: I highly dislike
template engines that aren't full programming languages, but only simple
fill-in-the-blanks systems. Especially I prefer template languages that
at least try to mimik most of the host language.

This has a downside: the templates _are_ complicated, because you write
real code in them.

My current idea on this is as follows:

- move as much code out to templates from the Python code as possible,
as that makes customizing possible. It doesn't make it easy, but it
makes it possible. Important first step.
- move code snippets that only handle a specific block of code into the
NuggetTool - look for the linkBox as an example.
- make the templates HTML code as simple and clean as possible, move
away from tables as far as possible. Add CSS hooks. This makes
customizing much easier, as most customizing will be done with CSS and
not with HTML code. That makes simple changes very easy, while the
templates themselves make complicated things possible.
- move complicated code into makros to make nugget and template code
cleaner. There can be logic in the templates, but I think there
shouldn't be complicatd logic in them with default templates - if there
is need for complicated logic, it should be the user putting it in
because he needed it.
- enhance ThemeTool in the way that it is able to store macros and
nuggets with their templates, so people fetching a theme.zip don't need
to add additional stuff. This is actually not very easy, but necessary,
as nuggets and macros might be important parts of the theme.

The first two points are already started, but from the third one on
everything is still waiting to happen. Actually I don't want the desktop
to be table-less, as the desktop should be useable with w3m - that's my
main browser when using text mode. Yes, I am a big egoistic on this one
;-)

But all *Rendering.tmpl should be table less and CSS friendly. Make the
complicated stuff possible and the simple stuff easy, that would be the
goal for this problem.

bye, Georg