views:

25

answers:

2

I'd love to use a nice template-engine with IronPython but havent succeded doing so. Would be best to be able to without needing to add Python standard lib's. Dont know if that's possible.

I like the Ruby Erb syntax, and hoped to be able to use something similar.

+1  A: 

My personal favourite is Jinja2, but it's much closer to Django syntax than to ERB syntax (Mako seems reasonably close in that respect). You can take a look at this question about Python templating engines for more ideas.

I can vouch for Jinja2 working on IronPython. It does need the standard library (and I'd guess most of the others do too), and beware of this bug if you're running IronPython < v2.7b1 (see the comments for a workaround specific to Jinja2 for earlier releases of IronPython), but otherwise it works great.

One thing to keep in mind is that template engines tend to import a lot of code (even if it's only standard libraries), which makes them slow to load on IronPython, but fast after the initial JIT compilation.

Cameron