Birch Street Computing -

about me

John M is a Linux fan in Lowell, MA.

I work at at a company writing software. I fool around with Free and Open Source software for fun & profit.

I was big into Last.fm and you can still see some of what I listen to there. I can also be found using github and recently sourcehut as well as bitbucket (historically). I don't care for most popular social media sites. If I have an account on one or the other it's probably either old and unused or was created just for tinkering.

promo

Links to things I like, use, or otherwise feel is worth sharing. Things I'd like to see get more popular.

NeonTAL

NeonTAL is an implementation of Zope's Page Templates with a simple interface that makes it easy to start using. There are some deviations from the Zope spec, which is documented in the source code package. NeonTAL's TAL implementation is built using a basic plug-in style interface, making it relatively easy to add new tal types specific to your application. NeonTAL also supports both lists and iterators in repeat statements. (Iterator support was the main impetus to start the project a few years ago.)

NeonTAL's been used in a number of personal projects of mine before I decided it was time to let the rest of the internet look at it.

Example

NeonTAL is easy to use. The following example loads two files with macros, before compiling the main output template.

>>> import neontal
>>> my_dict = { 'name':'John', 'city':'Lowell', 'state':'MA' }
>>> nt = neontal.NeonTAL( my_dict )
>>> nt.include( 'main_macros.pt', 'main_macros' )
>>> nt.include( 'extra_macros.pt', 'extra_macros' )
>>> nt.compile( 'my_template.pt' )
>>> nt.generate( 'my_ouput.html' )

If you wanted to load your template and/or macros before creating a data dictionary, simply create a NeonTAL object without arguments. Then, call the setData( dict ) function before calling generate.

Details

Current Version
0.1
Language
Python 2.3+
Downloads
neontal-0.1.tar.gz
Downloads
Type hg clone http://invalid.asynchrono.us/hg/neontal at the command prompt to get a copy of the development source code.
Source Code Web View

Every blog page or article on this site is available under the CC-BY-SA license unless otherwise noted.