[#5277] [desktop] escape html tags in messages

This commit is contained in:
Roman Volosovskyi 2018-09-26 21:41:54 +03:00
parent 44fbe62773
commit f3f476fa89
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 7 additions and 1 deletions

View File

@ -92,11 +92,17 @@
(vec (map string/upper-case ts))
ts))
(defn escape-html [text]
(if (and platform/desktop? (string? text))
(clojure.string/escape text {\< "&lt;", \> "&gt;", \& "&amp;"})
text))
(defn text
([t]
[text-class t])
[text-class (escape-html t)])
([opts t & ts]
(->> (conj ts t)
(map escape-html)
(transform-to-uppercase opts)
(concat [text-class (add-font-style :style opts)])
(vec))))