Templayer 1.4 reviewDownload
Templayer is a layered template library for Python
Templayer is a layered template library for Python. Templayer currently supports only HTML generation, but its simple design is easily extended to support other file formats.
Templayer was created to offer an alternative to the more common ways of generating dynamic HTML: embedding code within the HTML (PHP etc.) , or embedding HTML within code (traditional CGI).
Neither of these methods allow for a clean separation of the form, or layout, of a page and the function of page generation. Instead of mixing HTML and Python, two rich and extremely expressive languages, we can add a small amount of syntax to each and keep the two separate and coherent.
What's New in This Release:
Added a django_form convenience function for using Templayer with the Django web framework's FormWrapper objects.
Added an allow_degenerate parameter to Template.__init__. If set to True then a template file that is missing a contents block will be accepted and not cause an exception to be raised.
Added a special layer name '*' that treats the entire contents of a template file as a layer.
Added two new HTML Markup elements: - ('pluralize',count,singular_markup,plural_markup) inserts singular_markup if count equals one, and plural_markup otherwise. - ('&',entity) inserts the given HTML entity where valid entity values include "gt", "#161" and "#xA9".
FileLayer.close now returns the file object to which it wrote.
This simplifies the code required to use Templayer in Django view functions.
Fixed a really obvious bug in the html_href function.
Templayer 1.4 search tags