From c36256cb55640fbe452198831cb21cdeb4c570b9 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Wed, 29 Feb 2012 09:47:09 +0100 Subject: Book Marx: Support simple list syntax in descriptions. --- src/mulk/benki/book_marx.clj | 13 +++++++++++-- 1 file 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 -- cgit v1.2.3