-
Notifications
You must be signed in to change notification settings - Fork 151
What's next?
cgrand edited this page Sep 13, 2010
·
6 revisions
The goal is to have data-driven templates. I’m concerned about data injection risks.
I was thinking of something like (deftemplate a-smart-tmpl [data] (inject data keys-whitelist key-to-selectorfn))
(last two args being optional).
But David Nolen also has an interesting idea (and prototype) of html-driven smart templates.
TODO: Write some examples.
Several ideas:
- make common selector-steps (tag=, id=, has-class) fail faster
- switch to table-driven automata
- preselection for static selectors
See this conversation
(deftemplate name src [coll] {[:h2] [:p]} (clone-for [{:keys [heading content]}] [:h2] (content title) [:p] (content text)))
is the enlivened version of:
{% for x in coll %} <h2>{{ x.heading }}</h2> <p>{{ x.content }}</p> {% endfor %]