diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-05-29 12:28:25 +0200 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-05-29 12:28:25 +0200 |
commit | cd86bea65ef609c49748e6de2c4477a74b9a4c87 (patch) | |
tree | 7a0d43f14e3364173136cacccee3fb4a24dd60d5 | |
parent | b9b629380de80379107d07a5e51a6170fc2872b7 (diff) |
Implement the :VIEW action.
darcs-hash:9d67894b5470b637903527559910e6ffdf456872
-rwxr-xr-x | journal.lisp | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/journal.lisp b/journal.lisp index 89a5fd6..95cfe61 100755 --- a/journal.lisp +++ b/journal.lisp @@ -103,6 +103,10 @@ (call-next-method)) +(defun find-entry (number) + (find number *journal-entries* :key #'id-of)) + + (defun fixup-markdown-output (markup) ;; No, cl-markdown is certainly not perfect. ;; @@ -250,24 +254,36 @@ after another in any arbitrary order." (http-send-headers)) +(defun show-journal-entry (journal-entry) + (<:div :class :journal-entry + (<:h2 (<:as-html (title-of journal-entry))) + (<:div :class :journal-entry-date + (<:as-html + (format-date nil "%@day-of-week, den %day.%mon.%yr, %hr:%min." + (date-of journal-entry)))) + (<:as-is (journal-markup->html (body-of journal-entry))))) + + (defun show-web-journal () (http-add-header "Content-type" "text/html; charset=UTF-8") (http-send-headers) (<:html + (<:head + (<:title + (<:as-html + (if (member *action* '(:view :edit :preview)) + (format nil "~A -- Kompottkins Weisheiten" + (title-of (find-entry *post-number*))) + "Kompottkins Weisheiten")))) (<:body (<:h1 :id :main-title "Kompottkins Weisheiten") (<:div :id :contents - (if (or (null *action*) - (eq *action* :index)) - (dolist (journal-entry *journal-entries*) - (<:div :class :journal-entry - (<:h2 (<:as-html (title-of journal-entry))) - (<:div :class :journal-entry-date - (<:as-html - (format-date nil "%@day-of-week, den %day.%mon.%yr, %hr:%min." - (date-of journal-entry)))) - (<:as-is (journal-markup->html (body-of journal-entry))))))) + (case *action* + ((:index nil) + (mapc #'show-journal-entry *journal-entries*)) + ((:view) + (show-journal-entry (find-entry *post-number*)))))) (<:div :id :navigation) #+debug @@ -280,7 +296,7 @@ after another in any arbitrary order." (<:hr) (<:h2 (<:as-html x)) (<:p "Type " (<:em (<:as-html (type-of y))) ".") - (<:pre (<:as-html (prin1-to-string y)))))))) + (<:pre (<:as-html (prin1-to-string y))))))) (defun main () |