Using comments to hide templating stuff is pretty cruddy. If you need to stick values in attributes, you’ll be writing invalid markup, which HTML editing tools that don’t know your template syntax will complain about. And if you have loops building the output, it’s likely that the markup around those areas will be both invalid as well as very different from the final output. Even if the markup were perfectly sensible, there’s no default content in your template, so if it is rendered unprocessed the result will make little sense. Also, it looks as though you make no attempt to HTML-escape anything, so if you use your system on a public site you’ll have to spend a lot of effort making very sure it’s not vulnerable to cross-site scripting attacks.

The best templating system I have found is Petal, an implementation of TAL, which addresses all of these points by keeping template-related stuff in special attributes. (Actually, Kid is better yet, with a TAL-inspired but better syntax – but it’s a Python lib, not a Perl module.)

I haven’t looked at the implementation in much detail (only at your example template and output) because there is way too much in there for a templating system that’s supposed to be simple. You appear to be mixing together concerns wildly instead of separating them.

Makeshifts last the longest.


In reply to Re: RFC: Templating without a System by Aristotle
in thread RFC: Templating without a System by shmem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.