in reply to The history of a templating engine
Please don't take my comment as "I'm rock, you suck", I'm just wanna show design differences between our systems to prove this task can be solved much ease.
My system has same features as yours, except 'include template' feature and 'caching' feature (my parser is small and fast so I just don't need caching for now).
My template syntax was designed to work well in WYSIWYG-editors like Dreamweaver. For code which should be executed without outputing anything I've used <!--& ... --> constuct, so it looks like html-comments for such editors. For code which should insert something into html I've used three different construct: @~...~@, ^~...~^ and #~...~#, so web designer is able to see: here will be inserted some text.
Only difference between them is escaping: @~~@ add html-escaping, ^~~^ add uri-escaping and #~~# leave text as is for case I need to generate html tags from my code (bad idea usually - because make web designer work too hard - and used rarely).
That's all, only 4 special tags!
I've also used eperl idea "A template is just a program, but you quote the code, not the output.", but for solving ';' issue I've used do{}, as Jenda proposed in previous comment.
My module has many other features in addition to template processing (outputing die() message to browser, sending files to browser, sending redirects, reloading changed files from disk (for mod_perl environment), supporting correct line numbers for error messages).
And all these tasks solved in 150 lines of code (parser itself is 30 lines), less than 6KB.
Some other notes:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: The history of a templating engine
by jimt (Chaplain) on Sep 12, 2006 at 21:34 UTC | |
by powerman (Friar) on Sep 12, 2006 at 21:59 UTC | |
by Anonymous Monk on Sep 20, 2006 at 07:18 UTC | |
by powerman (Friar) on Sep 20, 2006 at 10:43 UTC | |
by ursus (Acolyte) on Jan 03, 2008 at 19:54 UTC |