Michael Kerrin

Web, Python, JavaScript and related technologies

Archive for April 5th, 2011

pwt.jinja2js 0.6.0

with 2 comments

I have just uploaded a version 0.6.0 of pwt.jinja2js. This adds support for default values for macros arguments. So now you can do this:

{% macro defaultparam1(name = "World") -%}
Hello {{ name }}!
{%- endmacro %}

 

And you can call this like so to produce the desired output:

defaultparam1({}) -> "Hello World"
defaultparam({name: 'Michael'}) -> "Hello Michael"

 

Written by mkerrin

2011, April 5 at 10:33 am

Follow

Get every new post delivered to your Inbox.