Fix Mathjax plugin.

This commit is contained in:
Brit Butler 2013-01-02 13:04:20 -05:00
parent bc79620b3a
commit a1c894c49d
3 changed files with 10 additions and 8 deletions

1
TODO
View file

@ -8,6 +8,7 @@ TODO:
; Add SHOUT content type. Add shout indices by month. Twitter\Disqus integration with shouts?
;; needs: shout template or just render function, publish analog for indices of a given ctype?
;; Indices fundamentally don't know about content-types. Is that a problem?
;; Rename index.posts to something else?
0.next
; improve date check/error reporting. -> 0.9
; doc themes and plugins, s3+hunchentoot. -> 0.9

View file

@ -2,9 +2,9 @@
(:use :cl)
(:export #:enable)
(:import-from :coleslaw #:add-injection
#:post
#:content
#:index
#:post-tags
#:content-tags
#:index-posts))
(in-package :coleslaw-mathjax)
@ -21,10 +21,10 @@ src=\"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLor
</script>")
(defun enable ()
(labels ((math-post-p (post)
(member "math" (post-tags post) :test #'string=))
(mathjax-p (content)
(etypecase content
(post (math-post-p content))
(index (some #'math-post-p (index-posts content))))))
(labels ((math-post-p (obj)
(member "math" (content-tags obj) :test #'string=))
(mathjax-p (obj)
(etypecase obj
(content (math-post-p obj))
(index (some #'math-post-p (index-posts obj))))))
(add-injection (list *mathjax-header* #'mathjax-p) :head)))

View file

@ -7,6 +7,7 @@
(:import-from :closure-template #:compile-template)
(:export #:main
#:blog
#:content
#:post
#:index
#:add-injection