diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2012-02-29 09:47:09 +0100 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2012-02-29 09:47:09 +0100 |
commit | c36256cb55640fbe452198831cb21cdeb4c570b9 (patch) | |
tree | cdc8b966e2fa0b9df3d7927f5801616e00619d45 | |
parent | c6e3977aed02aac11d457fabb587ee3c15a16980 (diff) |
Book Marx: Support simple list syntax in descriptions.
-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 |