A new text templating system for python!

C

Chris Withers

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.

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:
.... <div id="title">A title</div>
.... <select name="items">
.... <option id="item">An item</option>
.... </select>
.... said:
>>> t['title'].replace('My title')
>>> r = t['item'].repeater()
>>> for i in range(1,4):
.... r.repeat('Item '+str(i),value=i,name=False)
<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>
>>> from twiddler.input.plaintext import PlainText
>>> t = Twiddler('''To: $to
>>> t['to'].replace('John Smith')
>>> r = t['item'].repeater()
>>> for i in range(1,4):
.... r.repeat('Item '+str(i),value=i,name=False)
To: John Smith
Item 1
Item 2
Item 3

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

cheers,

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,222
Members
46,810
Latest member
Kassie0918

Latest Threads

Top