Permalink
Browse files

export blog-realm, add markdown* to deal with the fact that cl-markdo…

…wn doesn't handle CR/LF properly, use markdown* for new posts.
  • Loading branch information...
1 parent c0c1e46 commit 8a88e53258931bd327cbcb640a02325c6d727a3a sly committed Feb 17, 2011
Showing with 15 additions and 12 deletions.
  1. +2 −2 defpackage.lisp
  2. +13 −10 handlers.lisp
View
4 defpackage.lisp
@@ -40,5 +40,5 @@
#:footer
#:define-blog-handlers
- #:blog-entries))
-
+ #:blog-entries
+ #:blog-realm))
View
23 handlers.lisp
@@ -30,6 +30,17 @@
(in-package :nuclblog)
+(defun markdown* (source)
+ (with-output-to-string (str)
+ (cl-markdown:markdown
+ (reduce (lambda (x y) (concatenate 'string x y))
+ (with-input-from-string (in source)
+ (loop for line = (read-line in nil :eof)
+ while (not (eq line :eof))
+ collect line)))
+ :format :html
+ :stream str)))
+
(defun entry-html (blog entry)
"Outputs html for a blog entry."
(with-html
@@ -58,15 +69,7 @@
blog (blog-entry-category entry))
(str (blog-entry-category entry)))))))))
(:div :class "nuclblog-entry-contents"
- (str (with-output-to-string (str)
- (cl-markdown:markdown
- (reduce (lambda (x y) (concatenate 'string x y))
- (with-input-from-string (in (blog-entry-contents entry))
- (loop for line = (read-line in nil :eof)
- while (not (eq line :eof))
- collect line)))
- :format :html
- :stream str))))
+ (str (markdown* (blog-entry-contents entry))))
(:div :class "nuclblog-entry-nav"
(when (hunchentoot-auth:session-realm-user-authenticated-p (blog-realm blog))
(htm (:a :href (make-edit-entry-url blog entry) "edit")
@@ -265,7 +268,7 @@
(:p (str (format nil "updated new blog entry by ~A in ~A:"
user category)))
(:h2 (str title))
- (:p (str content))))
+ (:p (str (markdown* content)))))
(edit-error
(with-html
(:p "Entry editing error!")))

0 comments on commit 8a88e53

Please sign in to comment.