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!

1 Answer 1

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>"
Sign up to request clarification or add additional context in comments.

3 Comments

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=...">link1</a><a href="...">Link2</a>). 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 :(
Could you provide a small reproducible test case like the above?
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 <table> node. Believe it or not I've spent almost 3 days on this :(

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.