This is great.  I had thought that supporting some kind of partial template
thing would be interesting, but that's actually just my poor logic at work
;)
It seems like with the new version of Enlive I could do something like this:

(deftemplate pageA-template path
  []
  [[:div (attr? :tiptree:replace)]] (fn [xml-node]
(find-the-widget-html-file-that-corresponds-to-a-certain-attr-and-return-as-result)))

(deftemplate pageB-template path
  []
  [[:div (attr? :tiptree:replace)]] (fn [xml-node]
(find-the-widget-html-file-that-corresponds-to-a-certain-attr-and-return-as-result)))

(def pageAPartial (pageA-template))
(def pageBPartial (pageB-template))

;; the following would work only if templates allowed passing html as
strings and not just as files

(deftemplate widgetsPageA pageAPartial
  [map]
  [[:div (attr? :tiptree:widget)]] (fn [xml]
(use-xml-attr-and-map-to-apply-and-return-a-snippet))

(deftemplate widgetsPageB pageBPartial
  [map]
  [[:div (attr? :tiptree:widget)]] (fn [xml]
(use-xml-attr-and-map-to-apply-and-return-a-snippet))

(def pageA (widgetsPageA someMap))
(def pageB (widgetsPageA someMap))

Considering the above, I'm left wondering if it's possible to further
eliminate these redundancies and make templates more reusable. I'm not sure
if this is what you had in mind for Enlive, but allowing templates to be
created without references to files would make it possible to build very,
very composable interfaces.

Of course it's quite possible that you can already do this with Enlive and
I'm just unclear about how to accomplish it.

David

On Wed, Apr 8, 2009 at 8:06 PM, Christophe Grand <christo...@cgrand.net>wrote:

>
> Hi Tom,
>
> I'm sorry for this misfeature and, rejoice, it's gone from the ongoing
> redesign, there's now an explicit 'content function.
> The tildes are gone too!
>
> Christophe
>
>
> Tom Hickey a écrit :
> > Hi Christophe,
> >
> > I keep running into the same problem with elements getting replaced.
> > I'm trying to set the content of an element with raw html (from a
> > snippet) and  unable to avoid both 1) the html getting escaped and 2)
> > the element getting replaced. I can avoid one or the other, via
> > escaped or text, just not both.
> >
> > I'm looking forward to see what you've got planned for the redesign,
> > as I'd really like to see this "feature" go away.
> >
> > Cheers,
> > Tom
> >
> > On Mar 20, 3:59 am, Christophe Grand <christo...@cgrand.net> wrote:
> >
> >> Phil Hagelberg a écrit :
> >>
> >>
> >>> But I did notice you have the use test-is line commented out in the
> >>> implementation; it seems a bit unfortunate to have to uncomment that to
> >>> run the tests and hope you remember to re-comment it before you commit.
> >>>
> >> The last commit was during the transition to lazy-seq and test-is was
> >> broken.
> >> I'll fix that.
> >>
> >> --
> >> Professional:http://cgrand.net/(fr)
> >> On Clojure:http://clj-me.blogspot.com/(en)
> >>
> > >
> >
> >
>
>
> --
> Professional: http://cgrand.net/ (fr)
> On Clojure: http://clj-me.blogspot.com/ (en)
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to