Fork me on GitHub
#luminus
<
2017-05-15
>
thug.nasty03:05:51

I’m trying to render a CSV file, and I noticed that undecoded XML chars appear in my output. I tried to create a filter that calls the xml-decode fn in clojure.tools.html-utils. However, the unescaped character still appears

thug.nasty03:05:39

I’m trying to render a CSV file using Selmer*

thug.nasty03:05:55

@yogthos does decoded characters get encoded even after a filter is applied to it?

yogthos03:05:21

yeah I think you might be looking for the :safe option on filters:

(add-filter! :foo  (fn [x] [:safe (.toUpperCase x)]))

(render "{{x|foo}}" {:x "<div>I'm safe</div>"})
=>"<DIV>I'M SAFE</DIV>"

yogthos03:05:31

if the filter returns a vector with the keywrod :safe at the start, then output won't be escaped

thug.nasty03:05:21

ah ok. thank you 🙂

yogthos12:05:43

no prob 🙂