0

I have defined a template in this way:

(deftemplate layout-string "path/to/html/container.html"
  [content-strings]
  [:#container :> :div.pad]  (content (html-snippet (apply str content-strings)))
)

Here content-strings contain a HTML (for example: "<tr><td><a href="mylink">my link</a></td></tr>) Unfortunately this doesn't work. Instead it's removing the <tr> and the <td> leaving only the <a> tag. I've tried with different approach (with different unsuccessful results). Any help would be very welcome!

Nico Balestra
  • 256
  • 3
  • 12

1 Answers1

1

html-content is the function you need. However it's bad performance-wise. Where does this html string come from?

EDIT: example

=> (sniptest "<div>"
     [:div] (html-content "<tr><td><a href=\"mylink\">my link</a></td></tr>"))
"<div><tr><td><a href=\"mylink\">my link</a></td></tr></div>"
cgrand
  • 7,939
  • 28
  • 32
  • Unfortunately html-content doesn't work and it looks like it might be a bug of that function since it's producing something like (a href=...">link1Link2). I basically produce my HTML using Hiccup, I then stringify it using the hiccup/html function and give it to html-content. It should work very easily (performance aside) but it doesn't :( – Nico Balestra Oct 02 '12 at 09:05
  • Could you provide a small reproducible test case like the above? – cgrand Oct 02 '12 at 09:31
  • Thank you very much for your help! After running your example code (sniptest) I had the brilliant idea to actually check the source HTML generated (I was using the Chrome inspector which displays a modified HTML). I then realized that my HTML was missing the node. Believe it or not I've spent almost 3 days on this :(
    – Nico Balestra Oct 02 '12 at 21:23