[Zope-Annce] A new templating system available!

Chris Withers chris at simplistix.co.uk
Sat Dec 16 09:42:05 EST 2006


Hi All,

I'm proud to announce that after almost a year's development, the first
public release of Twiddler is available!

Twiddler is a simple but flexible templating system for dynamically
generating textual output. It comes with bindings for Zope 2 and should 
easily slot into a Zope 3 view in place of a ZPT.

The key features are:

- No need to learn a templating language.

- As simple as possible while still catering for all possible templating
   operations.

- Configurable input parsing so source can be html, xml, plain text or
   anything you write an input parser for.

- Configurable output rendering so output can be rendered to a unicode
   string, an email, or anything you write an output renderer for.

You can find out more and download from here:

http://www.simplistix.co.uk/software/python/twiddler

If you wish to ask questions, pass judgement or get help, please do so
in the following mailing list:

http://groups.google.com/group/twiddler

This is the first public release, so I'm looking for help with the
following:

- Finding anything that should be possible in a templating system but
   isn't with Twiddler

- Packaging it up for easier distribution. I know nothing about eggs,
   distutils, etc, and so could do with help to package Twiddler so that
   it can be more easily installed.

Finally, here's a couple of quick examples:

>>> from twiddler import Twiddler
>>> t = Twiddler('''<body>
... <div id="title">A title</div>
... <select name="items">
... <option id="item">An item</option>
... </select>
... </body>''')

>>> t['title'].replace('My title')
>>> r = t['item'].repeater()
>>> for i in range(1,4):
...   r.repeat('Item '+str(i),value=i,name=False)

>>> print t.render()
<body>
<div id="title">My title</div>
<select name="items">
<option id="item" value="1">Item 1</option>
<option id="item" value="2">Item 2</option>
<option id="item" value="3">Item 3</option>
</select>
</body>

>>> from twiddler.input.plaintext import PlainText
>>> t = Twiddler('''To: $to
... <item>An item</item>
... ''',input=PlainText)

>>> t['to'].replace('John Smith')
>>> r = t['item'].repeater()
>>> for i in range(1,4):
...   r.repeat('Item '+str(i),value=i,name=False)

>>> print t.render()
To: John Smith
Item 1
Item 2
Item 3

Thanks for reading this far, I hope you enjoy it!

cheers,

Chris

-- 
Simplistix - Content Management, Zope & Python Consulting
            - http://www.simplistix.co.uk



More information about the Zope-Announce mailing list