clostache
clostache copied to clipboard
Support non-clostache partials
I'll happily write this and send a pull request. At the moment, my plan is to
- allow you to specify a string as a partial, in which case it is interpreted as a clostache template
- allow you to specify a function, in which case it is invoked and assumed to return HTML.
My principal reason for wanting to do this is to handle small nasty pieces of code where hiccup is a better fit, but you could use it to mix and match template engines as well.
Looking at the code, this is hard. Doesn't mean it isn't worth doing, but it's hard to achieve directly.
I don't fully understand this, partials are already passed as strings. Could you give an example of what you mean?
Actually, part 1 is "support existing functionality", part 2 is new. So you could send in a partials like this.
{ :x "Standard Clostache Partial"
:y partial-thats-actually-a-function }
Applying this to the current code base is hard, though. But if I ever do decide to try to code compilable templates, I think it would be worth trying to separate out expression evaluation and partial evaluation.
Yeah, that'd make sense.
Then again, wouldn't a lambda do?