Fixed issues with angled brackets, made them HTML entities.

This commit is contained in:
Nicolas Buduroi 2011-03-14 07:21:18 +08:00 committed by Fogus
parent e98709fb87
commit 8c8b9648fd
2 changed files with 17 additions and 3 deletions

View file

@ -80,6 +80,12 @@
(str/replace #"->" "→")
(str/replace #""" "\"")))
(defn replace-html-entities
[s]
(-> s
(str/replace "<" "&lt;")
(str/replace ">" "&gt;")))
;; As a result of docifying then grouping, you'll end up with a seq like this one:
;; <pre><code>[...
;; {:docs [{:docs-text "Some doc text"}]
@ -117,10 +123,12 @@
str
prep-docs-text
replace-special-chars
replace-html-entities
(md)))
(defn codes-to-html [code-block]
(html [:pre {:class "brush: clojure"} code-block]))
(html [:pre {:class "brush: clojure"}
(replace-html-entities code-block)]))
(defn section-to-html [section]
(html [:tr

View file

@ -81,6 +81,14 @@
<object-start> \{
<object-end> \}))
;; Issue #26: Angle-bracket in Function Name Breaks Layout
(defn <test [] nil)
(defn test-html-entities-in-doc
"<is this working?"
[]
nil)
(defmulti kompile identity)
(defmethod kompile [::standard AutoIncClause]
@ -108,7 +116,6 @@
nl
"})"))
'(defn special-forms []
{'def handle-def
'fn handle-fn
@ -146,4 +153,3 @@
(greater 2 1) => truthy)
'(file->tickets commits)