in reply to RFC: Templating without a System
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: RFC: Templating without a System
by shmem (Chancellor) on Jul 25, 2006 at 00:15 UTC | |
by Aristotle (Chancellor) on Sep 08, 2006 at 12:34 UTC | |
by shmem (Chancellor) on Oct 22, 2006 at 22:39 UTC | |
by Aristotle (Chancellor) on Oct 24, 2006 at 07:41 UTC |