diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-10-02 10:43:38 +0200 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2007-10-02 10:43:38 +0200 |
commit | 6f902003195726be98e6961111bcf0e9251a9023 (patch) | |
tree | 900cf611fe7976bb8f15a106b50faa4be95676ba | |
parent | 3c31d317fa77b4f0f55b89fb07a63c65b3843cdf (diff) |
Cache JOURNAL-MARKUP->HTML results.
darcs-hash:20405a72f26b378da02c00680fb61382e3e64ab9
-rw-r--r-- | journal-content.lisp | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/journal-content.lisp b/journal-content.lisp index 43947d6..6529b57 100644 --- a/journal-content.lisp +++ b/journal-content.lisp @@ -192,26 +192,28 @@ (defun journal-markup->html (markup) - (if (string= "" markup) - markup - (handler-bind - ((error ;; method-call-type-error or not - ;; Work around a weird bug in cl-markdown or CLISP. (I - ;; don't know which.) - #'(lambda (c) - (declare (ignore c)) - #+nil (<:as-html - (with-output-to-string (s) - (system::pretty-print-condition c s))) - (invoke-restart 'return nil)))) - (fixup-markdown-output - (with-output-to-string (s) - ;; Normally, we shouldn't need to create our own stream to - ;; write into, but this is, of course, yet another - ;; CLISP/Markdown hack, because Markdown's default - ;; *OUTPUT-STREAM* seems to spontaneously close itself, making - ;; everything break when Markdown tries to render more stuff. - (markdown markup :stream s)))))) + (with-result-cache ((format nil "markup-~A" (sxhash markup)) + :younger-than (compute-script-last-modified-date)) + (if (string= "" markup) + markup + (handler-bind + ((error ;; method-call-type-error or not + ;; Work around a weird bug in cl-markdown or CLISP. (I + ;; don't know which.) + #'(lambda (c) + (declare (ignore c)) + #+nil (<:as-html + (with-output-to-string (s) + (system::pretty-print-condition c s))) + (invoke-restart 'return nil)))) + (fixup-markdown-output + (with-output-to-string (s) + ;; Normally, we shouldn't need to create our own stream to + ;; write into, but this is, of course, yet another + ;; CLISP/Markdown hack, because Markdown's default + ;; *OUTPUT-STREAM* seems to spontaneously close itself, making + ;; everything break when Markdown tries to render more stuff. + (markdown markup :stream s))))))) (defun compute-journal-last-modified-date () |