jinja2 as renderer
"Sebastian Spaeth" <[email protected]> Wed, 24 Feb 2010 14:26:03 +0100
| Newsgroups | gmane.comp.web.pyblosxom.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi all, as I wanted to learn more about the pyblosxom architecture, I coded a Renderer plugin that uses jinja2 as a renderer. jinja2 is an excellent templating system that gives you lots of functionality and closely resembles the style in django web apps. I put it up here: http://bitbucket.org/spaetz/pyblosxom_blog/ You can clone it with hg clone https://spaetz-HWgY0/vhk/[email protected]/spaetz/pyblosxom_blog/ (it contains all my private blog posts, sorry for that :)) All the changes are in 6 commits from 5abac1380cd7 .. 5eea5ffa0b60 Most of them are amazingly trivial. It can be turned on by just loading it as a plugin and setting py['renderer']='jinja2' in your config.py (of course you need to have jinja2 installed). And you also need the corresponding template files in <datadir>/flavours/jinja/<flavor>.flav. In one of the above commits I add template files for atom, rss20, snarfed (html based on snarfed but heavily modified). What breaks: - I had problems with non-ascii chars in filenames, using python2.5. UTF-8 in posts works fine though. - I am a bit unsure which callback will break when you switch away from the blosxom renderer though. The cb_story one will break for sure (I added a cb_jinja2 one though that plugins can use). - I don't have beautiful documentation written for it. Why do I like it? - I like the templating language. It is powerful and easy to understand - One template for stories that inherits from base templates, rather than concatenating lots of individual templates. For example, this let me set set the 'title' in <head> in a story view. Usually the story title is only available in the story template at which time it is too late to manipulate <head>. - It was amazingly simple to plug in a new Renderer. - I learned a lot while coding it :) If you find it useful, have fun. Otherwise sorry for the noise. Sebastian P.S. You can see it in action at http://sspaeth.de/ (some German, some English posts). ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev