Initial pass at MathJax plugin and various small fixes.

This commit is contained in:
Brit Butler 2011-04-26 13:52:15 -04:00
parent 1a110b541b
commit 9e4c03573e
4 changed files with 22 additions and 6 deletions

View file

@ -1,4 +1,5 @@
(ql:quickload '(cxml split-sequence local-time cl-ppcre))
(eval-when (:compile-toplevel)
(ql:quickload '(cxml split-sequence local-time cl-ppcre)))
(defpackage :coleslaw-import
(:use :cl :coleslaw :cxml)
@ -52,9 +53,9 @@ object is determined by SERVICE."))
(add-post new-post (post-id new-post))
(when static-p
(ensure-directories-exist coleslaw::*input-dir*)
(write-post-file new-post))))))
(export-post new-post))))))
(defun write-post-file (post)
(defmethod export-post (post)
(let ((filepath (merge-pathnames (format nil "~5,'0d-~a.post"
(post-id post)
(coleslaw::escape (post-title post)))

View file

@ -1,2 +1,17 @@
(in-package :coleslaw)
(defpackage :coleslaw-mathjax
(:use :cl :coleslaw))
(in-package :coleslaw-mathjax)
(defvar *mathjax-header* "<script type=\"text/x-mathjax-config\">
MathJax.Hub.Config({tex2jax: {inlineMath: [['\\(','\\)']]}});
</script>
<script type=\"text/javascript\"
src=\"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML\">
</script>")
(defmethod enable ()
(coleslaw::add-injection *mathjax-header* :head))
(defmethod disable ()
(coleslaw::remove-injection *mathjax-header* :head))

View file

@ -2,7 +2,7 @@
(defun load-plugins (plugins)
"Resolve the path of each symbol in PLUGINS and call LOAD on the
resulting pathname. It is expected that the matching *.lisp files
resulting pathnames. It is expected that the matching *.lisp files
are in the plugins folder in coleslaw's source directory."
(let ((files (mapcar (lambda (sym)
(merge-pathnames

View file

@ -32,7 +32,7 @@
(loop for tag in (post-tags post) do
(remove-from-index (concatenate 'string "tag/" tag) post))
(remove-from-index (concatenate 'string "date/"
(month-year (post-date post))) post)
(year-month (post-date post))) post)
(remove-from-index "recent" post)
(setf (find-post id) nil)))