Hi, My 2 cents: this solution may be subject to escaping issues. When one needs to pass parameters to Javascript, I often recommend to inject one <script> tag whose content is the result of (str "window.params = " (write-json your-data)) or to encode them in html if their is only a handful of params (eg in meta tags).
Christophe On Tue, May 10, 2011 at 2:36 PM, Thorsten Wilms <[email protected]> wrote: > On 05/09/2011 10:15 PM, Thorsten Wilms wrote: > > I tried to turn that into a transformation: >> >> (defn substitute-token >> [& values] >> #(map (fn [m] (update-in m [:content] >> (fn [c] (apply (partial replace-str >> "token" %) c)))) >> values)) >> > > Apparently I had my brain knotted, but raek and fliebel on IRC helped with > untying some misconceptions :) > > So the solution for applying a function, (partial replace-str "token" to) > in this case, on the content in html nodes as Enlive transformation is: > ---- > (defn substitute-token > "Replace text 'token' with to." > [to] > #(update-in % [:content] > (fn [c] (apply (partial replace-str "token" to) c)))) > ---- > > > > -- > Thorsten Wilms > > thorwil's design for free software: > http://thorwil.wordpress.com/ > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with > your first post. > 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 > -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.cgrand.net/ (en) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. 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
