diff options
-rw-r--r-- | src/mulk/benki/book_marx.clj | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mulk/benki/book_marx.clj b/src/mulk/benki/book_marx.clj index 4dd328e..e5e8701 100644 --- a/src/mulk/benki/book_marx.clj +++ b/src/mulk/benki/book_marx.clj @@ -63,8 +63,17 @@ (defn htmlize-description [text] - (let [input (escape-html text)] - (map (fn [x] [:p {} x]) (string/split text #"\n\s*?\n")))) + (letfn [(listify [par] + (when (re-matches #"^(?msu)\s*\*\s+.*" par) + [:ul {} + (map (fn [item] [:li {} item]) + (filter #(not (= "" (string/trim %))) + (string/split par #"(?su)(\n|^)\s*\*\s+")))]))] + (let [input (escape-html text)] + (map (fn [par] + (or (listify par) + [:p {} par])) + (string/split text #"\n\s*?\n"))))) (defn bookmarks-visible-by [user] (-> bookmarks |