summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mulkcms.lisp14
1 files changed, 13 insertions, 1 deletions
diff --git a/mulkcms.lisp b/mulkcms.lisp
index 12b9b7e..13aea8d 100644
--- a/mulkcms.lisp
+++ b/mulkcms.lisp
@@ -57,13 +57,25 @@
:comments-link ""
:comments-heading "Comments")))
+(defun format-comment-content (text)
+ ;; Taken from Mulkblog.
+ (with-html-output-to-string (out)
+ (loop for last-position = 0 then (cadr matches)
+ for matches = (ppcre:all-matches "(\\n|\\r|\\r\\n)(\\n|\\r|\\r\\n)+"
+ text)
+ then (cddr matches)
+ while (not (endp matches))
+ do (htm (:p (esc (subseq text last-position (car matches)))))
+ finally
+ (htm (:p (esc (subseq text last-position)))))))
+
(defun paramify-comment (comment-revision-data)
(destructuring-bind (crid comment date content author format status
article-revision &rest args)
comment-revision-data
(declare (ignore args crid article-revision status format comment))
(list :publishing-date date
- :body content
+ :body (format-comment-content content)
:author author
;;FIXME
:link ""