Suppose I've got an html document:
<html>test<html>
And I want to display that code in a browser. Then I'd create something like:
<html><body>
<pre><html>test<html></pre>
</body></html>
To make the gubbins in the middle I have a function:
(defn html-escape [string]
(str "<pre>" (clojure.string/escape string {\< "<", \> ">"}) "</pre>"))
which does the above transformation for me:
user> (html-escape "<html>test<html>")
"<pre><html>test<html></pre>"
My question is: is that good enough, or am I going to come across html that will make that transformation break?
And a secondary question might be: does clojure have this built in? I can't find it.