[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] More thoughts on Ersatz
From: |
Peter Bex |
Subject: |
Re: [Chicken-users] More thoughts on Ersatz |
Date: |
Tue, 12 Mar 2013 21:59:21 +0100 |
User-agent: |
Mutt/1.4.2.3i |
On Tue, Mar 12, 2013 at 08:15:14PM +0000, Ivan Shmakov wrote:
> > Not to sound like a broken record, but I'd add that this applies 100%
> > to HTML/XML as well. I would suggest using SXML or something similar
> > over a string-based templating language. This allows you to prevent
> > injection bugs as well as accidental mismatching of opening/closing
> > tags.
>
> Yet another idea is to prepare an XML document (using either
> notation) holding the “mostly static” part of the result, and
> also an XML document holding all the “repeated” (or “optional”)
> subtrees. Both the “insertion points” in the former, and such
> subtrees, are then marked, one way or another (e. g., I opted to
> use the HTML ‘class’ attribute), and the code simply composes
> the result by attaching such pieces to each other.
Is this code available somewhere? It sounds like a good alternative to
SXML, but somewhat friendlier to designers (who aren't likely to be
using emacs with paredit :P).
> There's a minor convenience in the use of the “XML” notation for
> the templates, too: such templates may be constructed in a way
> that allows for them to be viewed with the target application
> itself (such as a Web browser, should XHTML be considered.)
The disadvantage of that notation is of course the opportunity for
generating ill-formed XML, unless you run some kind of parsing step
over it and raise an error as soon as you encounter bad nesting/syntax.
Cheers,
Peter
--
http://www.more-magic.net
Re: [Chicken-users] More thoughts on Ersatz, Ivan Raikov, 2013/03/13