Hey,

Just letting you know I have recently started a project on github at
https://github.com/mkerrin/pwt.jscompiler that extends Jinja2 to
generate JavaScript instead of Python. The project also contains a
simple WSGI application to serve template files as JavaScript.

I started using Closure Templates recently which does this and I got a
big win out of it in terms of productivity and not having to include
other JavaScript templates within the body of my page. Last week I
started looking at the internals of Jinja2 and found it to be very
well written and easy to get around. So after a few days I have
managed to get it a working JavaScript backend and managed to write a
some tests for it in Python and JavaScript.

Currently it supports the following features: variables, for / else,
if / else, macros, calling macros, and not much else. This project is
in the very early stages and it won't support every feature of Jinja2.
I have currently ruled out supporting extends and blocks at the moment
as these features don't translate well into JavaScripts namespace.

The generated code is very similar to closure templates (actually I
copied it in order to get this off the ground as quickly as possible).

Jinja2 has been a joy to work wit but the only change within Jinja2
that I need for my code to work is that someone deletes the last 3
lines of jinja2/nodes.py that tries and stops people writing new
namespace nodes.

This isn't going to be everyones cup of tea but I find it useful and I
have uploaded it as I believe some people will find it useful like me.

Hope you find it interesting if any thing else,
Michael

-- 
You received this message because you are subscribed to the Google Groups 
"pocoo-libs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pocoo-libs?hl=en.

Reply via email to