perlmeditation
metaperl
<p>Push-style templating was defined by Terence Parr has in his seminal article. He also <a href="http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf">articulated the benefits</a> of push-style templating, as well as
defined the requirements for a system to be called as such. If the above paper seems a bit dense, there is now an <a href="http://bit.ly/bXaYt7">HTML Template Entanglement</a> survey which simplifies the criteria for a templating system to be push-style. HINT: JSP, Template Toolkit, HTML::Mason, Genshi, <a href=
"http://www.makotemplates.org">Mako</a>, and pure PHP do not qualify as push-style systems. Those packages are an invitation to create <a href="http://www.codinghorror.com/blog/2008/07/web-development-as-tag-soup.html">Tag Soup</a>, something that is impossible with push-style templating. The goal of this node is to <i>record</i> push-style templating systems, across languages. James Robson recently <a href=
"http://www.perl.com/pub/a/2008/03/14/reverse-callback-templating.html">published an article</a> on perl.com about his module [mod://Template::Recall] which is similar to [mod://HTML::Seamstress].
<h2>Perl-based</h2>
<dl>
<dt>[mod://HTML::Zoom]</dt>
<dd>written by Matt S Trout. similar to [mod://Template::Semantic] but with more streaming capabilities</dd>
<dt>[mod://HTML::Seamstress]</dt>
<dd>based on [mod://HTML::TreeBuilder]</dd>
<dt>[mod://Template::Replace]</dt>
<dd>author is aware of push-style templating. Similar to [mod://Template::Simple] by Uri Guttman.</dd>
<dt>[mod://Nes]</dt>
<dd>by [Skriptke]</dd>
<dt>[mod://Cindy]</dt>
<dd>by Joachim Zobel (monk name: [ElDiabolo])</dd>
<dt>[mod://Template::Semantic]</dt>
<dd>inspired by [mod://Template::Refine] and very similar to <a href="http://amrita.sourceforge.jp/">Amrita</a></dd>
<dt>[mod://Template::Recall]</dt>
<dd>by James Robson.. string-based.</dd>
<dt><a href="http://blog.thul.org/technik/programmierung/templatepower-perl-module/">Template Power</a></dt>
<dd>Perl port of the PHP package</dd>
<dt>[mod://HTML::Template]</dt>
<dd>by Sam Tregar string-based. Using the optional [mod://HTML::Template::Expr] raises the entanglement index.</dd>
<dt>[mod://HTML::TagTree]</dt>
<dd>pure perl html generation</dd>
<dt>[mod://Text::Caml]</dt>
<dd>by Viacheslav Tykhanovskyi. Similar to Mustache</dd>
<dt>[mod://Template::Flute]</dt>
<dd>by Stefan Hornburg</dd>
<dt>[mod://HTML::Transmorgify]</dt>
<dd>by David Muir Sharnoff</dd>
<dt>[mod://Text::Haml] and [mod://Text::Sass]</dt>
<dd>based on the ruby <a href="http://haml-lang.com/">HAML</a> HTML shortcut language and SASS shortcut languages.</dd>
<dt>[mod://CGI::FastTemplate]</dt>
<dd>by Jason Moore.. string-based. The authors Perl module site (linked from <a href="http://search.cpan.org/~jmoore/">his CPAN page</a>) is currently down.</dd>
<dt>[mod://ZM::Template]</dt>
<dd>by Maxim Kashliak</dd>
<dt>[mod://XML::Twig] or [mod://XML::Rules] or even [mod://XML::LibXML]</dt>
<dd>if you are into strict xHTML, you might like these</dd>
<dt>[mod://HTML::Chunks]</dt>
<dd>had brief friendly conversation with author</dd>
</dl>
<h2>Language-Neutral</h2>
<ul>
<li><a href="http://mustache.github.com/">Mustache</a> - public domain version of <a href="http://google-ctemplate.googlecode.com/svn/trunk/doc/guide.html">CTemplate</a>, the template engine responsible for many of the
public-facing pages at Google.</li>
<li><a href="http://www.clearsilver.org/">ClearSilver</a></li>
</ul>
<h2><a id="python" name="python">Python-based</a></h2>
<p>A <a href="http://groups.google.com/group/comp.lang.python/browse_thread/thread/d1a696a676379024#">good discussion</a> of Python-based solutions occurred recently. And there have been <a href=
"http://groups.google.com/group/comp.lang.python/search?group=comp.lang.python&q=push+style+templating&qt_g=Search+this+group">others</a>. One important thing that came out that thread is that my list of templating
systems can be found <a href="http://wiki.python.org/moin/Templating">here</a> under "Engines with Annotated Templates".</p>
<p>It should also be noted that the <a href="http://www.Nagare.org">Nagare</a> web framework has updated meld3 with some enhancements.</p>
<table border="1">
<tr>
<th>name</th>
<th>comments<br /></th>
</tr>
<tbody>
<tr>
<td><a href="http://www.muntiacus.org/" target="_self">Muntjac</a></td>
<td>completely abstracts the client-side templating</td>
</tr>
<tr>
<td><a href="http://www.webelements.in" target="_self">Web elements</a></td>
<td>Powerful. Concise.</td>
</tr>
<tr>
<td><a href="http://www.plope.com/software/meld3" target="_self">meld3</a></td>
<td>based on elementTree</td>
</tr>
<tr>
<td><a href="http://jonpy.sourceforge.net/" target="_self">wt</a></td>
<td>clean simple powerful system<br /></td>
</tr>
<tr>
<td><a href="http://templess.johnnydebris.net/wiki/TemplessExamples" target="_self">Templess</a></td>
<td>based on nanosax<br /></td>
</tr>
<tr>
<td><a href="http://psilib.sourceforge.net/webstring.html" target="_self">Webstring</a></td>
<td>uses elementTree or lxml underneath</td>
</tr>
<tr>
<td><a href="http://py-templates.sourceforge.net/" target="_self">HTMLTemplate</a></td>
<td>HTMLParser</td>
</tr>
<tr>
<td><a href="http://entrian.com/PyMeld/" target="_self">PyMeld</a></td>
<td>internal</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<h2>Java-based</h2>
<table border="1">
<tr>
<th>module</th>
<th>comments</th>
</tr>
<tbody>
<tr>
<td><a href="http://xmlc.enhydra.org">XMLC</a></td>
<td>There is <a href="http://www.amazon.com/Enhydra-XMLC-Java-Presentation-Development/dp/0672322110">an Addison-Wesley text</a> which documents this DOM-based module.<br /></td>
</tr>
<tr>
<td><a href="http://www.stringtemplate.org/" target="_self">StringTemplate</a></td>
<td>written by Terence Parr. Has Python and C# implementations as well.<br /></td>
</tr>
<tr>
<td><a href="http://jabhts.org/">JABHTS</a></td>
<td>very well thought-out thesis project</td>
</tr>
<tr>
<td><a href="http://tapestry.apache.org/">Apache Tapestry</a></td>
<td>A framework whose non-pluggable template system is push-style... I thought push-style was all about separation!</td>
</tr>
</tbody>
</table><br />
<h2>Javascript</h2>
<ol>
<li><a href="http://richardanaya.github.com/shibari.js/">Shibari.js</a></li>
<li><a href="http://hoejs.schettino72.net/">HOE.js</a></li>
<li>jQuery's <a href="http://jquery.malsup.com/taconite/">Taconite</a></li>
<li><a href="https://github.com/flatiron/plates">Plates</a></li>
<li><a href="https://github.com/simonmcmanus/sizlate">Sizlate</a></li>
</ol>
<h2>Haskell</h2>
<ol>
<li><a href="http://softwaresimply.blogspot.com/2011/04/heist-in-60-seconds.html">Heist</a></li>
</ol>
<h2>Ruby</h2><a href="http://www.hokstad.com/mini-reviews-of-19-ruby-template-engines.html">summary review of ruby template systems</a>
<table border="1">
<tr>
<th>module</th>
<th>comments</th>
</tr>
<tbody>
<tr>
<td><a href="http://amrita.sourceforge.jp/">Amrita</a></td>
<td></td>
</tr>
<tr>
<td>Ruby on Rails</td>
<td>Through the AJAX interface, <a href="http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/89aad4cf66e0994/e614b16ac9847e74?lnk=gst&q=invasive#e614b16ac9847e74">dom style rewrites are
possible</a></td>
</tr>
<tr>
<td><a href="http://www.kuwata-lab.com/kwartz/kwartz3ruby-users-guide.01.html#example1">KWARTZ</a></td>
<td></td>
</tr>
</tbody>
</table>
<h2>PHP</h2>
<ul>
<li><a href="http://templatepower.codocad.com/">Template Power</a> definitely push-style.. theres also a Perl version</li>
<li><a href="http://www.smarty.net/">Smarty</a> is the earliest PHP push-style approach.</li>
<li><a href="http://dwoo.org/">Dwoo</a> is an "evolution" of smarty</li>
<li><a href="http://www.koolphp.net/">KoolPHP</a> is an AJAX library that definitely is push-style</li>
<li><a href="http://www.piprime.fr/1472/efficient-html-code-generation-without-templating-system/#xmltag">XmlTag</a> is an html generation module for PHP, one of several. The author lists others.</li>
</ul>
<h2><a href="#prolog">Prolog-based</a></h2><a href="http://www.cs.otago.ac.nz/staffpriv/ok/pwp.pl">Prolog Well-Formed Pages</a> by Richard O'Keefe