Created a new feature branch on my github -> new-template, with the
following commit:
commit 838ba2425d3e8c0d4c8e04c827eb88fe6e87b1cb
Author: James Cammarata <jimi(a)sngx.net>
Date: Sun Aug 28 00:23:19 2011 -0500
Initial commit for adding support for other template languages,
namely jinja2 in this case
This was pretty easy to add, most was moving the render() function to
render_cheetah() and reorganizing some code that would be common to
all render_* functions.:
Created commit 838ba24: Initial commit for adding support for other
template languages, namely jinja2 in this case
1 files changed, 79 insertions(+), 22 deletions(-)
To use jinja2 for your templates, just put #template=jinja2 on the
first line of the template (it is white-space sensitive, so it must
match that exactly). If you don't have jinja2 installed, you'll just
get an error string back for your template - it won't fail to run
cobblerd or throw exceptions.
This is EXTREMELY basic at the moment, and doesn't do much of anything
special. This is pretty much just a proof of concept, and to see how
people like the idea.
Here's a sample template:
#template=jinja2
Hi from Jinja2!
{%- for i in [1,2,3,4] %}
For loop line {{ i }}{% endfor %}
The http_server variable = @@http_server@@
The profile variable for this system is {{ profile }}
And here's how it renders:
Hi from Jinja2!
For loop line 1
For loop line 2
For loop line 3
For loop line 4
The http_server variable = 127.0.0.1
The profile variable for this system is centos-5.5-x86_64
Show replies by date