While working on round-trip html5 <-> Rdfa-lite query and editing, I've been struck by the primitive feeling of html template languages. {{mustache}} , <%escapes%> <–%ssi escapes %–> all work the same way as C preprocessor macros – string concatenation style – which ignores the underlying structure that we're working with.
Thankfully, HTML5 is changing everything – it has / will have a template tag
Along the way to finding that, I came across Weld.js (dead?), Transparency or Plates and Pure and not forgetting Knockout.js.
None of them quite goes where I want – as they either use class/id, or their own data- attributes.
What I'm after, is leveraging the already existing semantic annotations of existing (or template tag) elements to add new ones.
For example, I might have the following Link menu, and then want to dynamically add others from a remote query
$1
The following works for browsers that don't support the new HTML5 template tag:
$1
A nice start, but to me, there's still something not right with the addressing scheme –
which is where some of the above template engines use the @ symbol to denote that the value should be set on the named attribute.
something like this might work
$1
$1
$1
Which looks an awful lot like Weld.js' (and the inverse of Pure?) API. And, should be trivial to implement using Transparancy.
in the process of thinking it through, I wrote a simplistic version that deserves replacing when I'm thinking about something else:
$1