Christophe Grand <[email protected]> writes:
> I'm not quite happy with this behavior: I wanted to preserve the
> brevity of setting content from a parameter without resorting to (text
> my-parameter) but it makes things too irregular. This "feature" will
> certainly go away as I'm planning a redesign.
Yeah, I'm all for brevity, but it seems that in this case it makes the
rules harder to understand. Please keep the mailing list informed as to
the progress of your redesign.
I notice you use with-test to mix your tests in together with your
implementation. This seems to be less common than storing the tests in
their own file; I'm wondering if you are happy with this approach? One
advantage of keeping things in their own file is that it's easier for
the test suite to serve as a usage example, but keeping it together may
be more convenient for other reasons. I haven't tried it myself.
> Right now there are several cases:
> 1/ If the right hand side of a rule is a list and expands to a
> template-macro, it is applied without needing to unquote it. The matched
> element is replaced by the result of the template-macro.
> 2/ If the right hand side of a rule is a list and does not expand to a
> template-macro, it's random clojure code (which can apply
> template-macros on the matched element using unquote). The matched
> element is replaced.
> 3/ Otherwise the right hand side form is implicitly surrounded by the
> 'text template-macro and go to 1/ ('text replaces the content).
Thanks for explaining.
> > Also, I keep getting null pointer exceptions when I try to use
> > deftemplate with a path to an HTML file that isn't on the
> > classpath. This seems like an odd restriction. Is there a way to use a
> > file in an arbitrary location as a template?
>
> You can pass an xml structure to deftemplate instead of the path, it's
> the only way to circumvent the classpath at the moment.
> I'll look into it.
I can see the benefit of looking on the classpath since it means you can
store your template inside a jar and distribute everything that way. But
I think it would be convenient if it could check for the existence of
the file relative to the current directory first.
> Phil, what's your usecase for inserting raw html, where does it come from?
I'm processing a number of feeds, and I want to output their
contents. But I could think of many others; perhaps people would want to
use an HTML-generating library like Markdown to turn user input into
HTML before inserting it into the template. It's definitely less common
though.
-Phil
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---