======= CHANGES ======= Release 1.1.0 (2012-02-16) -------------------------- * [Change] !! IMPORTANT!! Default cache file format is changed from marshal format to text format. You should remove all cache files to use this release. $ find . -name '*.cache' | xargs rm There are some reason about this change: * User can see converted Python code very easily with text format, but not easy with marshal format. * Benefit of marshal format is that loading speed is a little faster than text format. But this benefit is very little, especially persistent process or Google App Engine. * Marshal format is not compatible between different version of Python. * Jython can't load marshal format. If you prefer marshal format rather than text format, please specify MarshalCacheStorage object to 'cache' option of Engine class. engine = tenjin.Engine(cache=tenjin.MarshalCacheStorage()) ### or tenjin.Engine.cache = tenjin.MarshalCacheStorage() * [Enhance] Embedded pattern '${}' and '#{}' can contain pair of '{' and '}'. ::

${foo({'x':1})}

# OK

${foo({}+{}+{})}

# OK

${foo({'x':{'y':1}})}

# NG * [Enhance] New preprocessing mechanism. You can specify your own preprocessor class by 'pp' parameter. :: require 'tenjin' pp = [ tenjin.TemplatePreprocessor(), # preprocessing tenjin.TrimPreprocessor(), # remove spaces at beginning of lines tenjin.PrefixedLinePreprocessor(), # converts ':: ...' to '' ] engine = tenjin.Engine(pp=pp) # pass preprocessors This release keeps backward compatibilidy. You can still use 'preprocess=True' option. * [Enhance] Add 'TrimPreprocessor' which removes spaces ad the beginning of lines. You can reduce size of output by it. For example::
will be converted into:
by TrimPreprocessor and passed into tenjin.Engine object. How to use it:: require 'tenjin' pp = [ tenjin.TrimPreprocessor() ] engine = tenjin.Engine(pp=pp) context = { 'items': ["Haruhi", "Mikuru", "Yuki"] } output = engine.render('example.pyhtml', context) print(html) * [Enhance] Add 'PrefixedLinePreprocessor' which converts ':: ...' into ''. You may like ':: ...' because it is simpler than ''. For example::
will be converted into::
by PrefixedLinePreprocessor and passed to tenjin.Engine. How to use it:: pp = [ tenjin.PrefixedLinePreprocessor() ] engine = tenjin.Engine(pp=pp) context = { 'items': ["Haruhi", "Mikuru", "Yuki"] } output = engine.render('example.pyhtml', context) print(html) * [Enhance] Add 'JavaScriptPreprocessor' class which enables you to embed client-side javascript template code into server-side template. For example::
#{i} ${items[i]}
will be converted into::
by JavaScriptPreprocessor. Notice that you should embed 'tenjin.JS_FUNC' to run client-side code. How to use it:: pp = [ tenjin.JavaScriptPreprocessor() ] engine = tenjin.Engine(pp=pp) output = engine.render('example.pyhtml', {}) print(html) * [Enhance] Now supports Jython 2.5.2. (thanks to Lars Hupfeldt Nielsen) * [Enhance] Now supports PyPy 1.7 or later officially. * [Change] Template#convert() now converts "\r\n" into "\\r\n". This is necessary to follow change of language specification on Python 2.7 and 3.2. Release 1.0.2 (2011-04-29) -------------------------- * [Bugfix] * Set 'sys.modules["tenjin.helpers.html"]' for backward compatibility * Fix wrong url on document. Release 1.0.1 (2010-02-22) -------------------------- * [Bugfix] * Add 'new_cycle' into 'tenjin.helpers.__al__' Release 1.0.0 (2010-02-22) -------------------------- * [Enhancements] * (IMPORTANT!!) Performance is improved (about 5 percent). To improve performance, compiled Python code is changed. This means that YOU MUST TOUCH ALL TEMPLATE FILES AND UPDATE TIME STAMPS OF THEM in order to clear cache data before using this release. ## touch all template files to clear cache data $ find . -name '*.pyhtml' | xargs touch ## show compiled python code $ cat ex.pyhtml