Update plugins for new API.
This commit is contained in:
parent
cc82da57cd
commit
97749261db
3 changed files with 17 additions and 9 deletions
|
@ -3,9 +3,6 @@
|
||||||
|
|
||||||
(in-package :coleslaw-disqus)
|
(in-package :coleslaw-disqus)
|
||||||
|
|
||||||
;; Should be added to plugins like so:
|
|
||||||
; :plugins (mathjax (disqus :shortname "mysite-disqus-shortname"))
|
|
||||||
|
|
||||||
(defvar *disqus-header*
|
(defvar *disqus-header*
|
||||||
"<div id=\"disqus_thread\"></div>
|
"<div id=\"disqus_thread\"></div>
|
||||||
<script type=\"text/javascript\">
|
<script type=\"text/javascript\">
|
||||||
|
@ -24,4 +21,5 @@
|
||||||
<a href=\"http://disqus.com\" class=\"dsq-brlink\">comments powered by <span class=\"logo-disqus\">Disqus</span></a>")
|
<a href=\"http://disqus.com\" class=\"dsq-brlink\">comments powered by <span class=\"logo-disqus\">Disqus</span></a>")
|
||||||
|
|
||||||
(defun enable (&key shortname)
|
(defun enable (&key shortname)
|
||||||
(coleslaw:add-injection (format nil *disqus-header* shortname) :head))
|
(coleslaw:add-injection (list (format nil *disqus-header* shortname)
|
||||||
|
(lambda (x) (typep x post))) :head))
|
||||||
|
|
|
@ -53,8 +53,12 @@
|
||||||
(format out "~A~%" (regex-replace-all (string #\Newline) content "<br>"))))
|
(format out "~A~%" (regex-replace-all (string #\Newline) content "<br>"))))
|
||||||
|
|
||||||
(defun import-posts (filepath &optional since)
|
(defun import-posts (filepath &optional since)
|
||||||
|
(when (probe-file filepath)
|
||||||
|
(ensure-directories-exist (repo *config*))
|
||||||
(let* ((xml (cxml:parse-file filepath (cxml-dom:make-dom-builder)))
|
(let* ((xml (cxml:parse-file filepath (cxml-dom:make-dom-builder)))
|
||||||
(posts (dom:get-elements-by-tag-name xml "item")))
|
(posts (dom:get-elements-by-tag-name xml "item")))
|
||||||
(load-config)
|
(loop for post across posts do (import-post post since))
|
||||||
(ensure-directories-exist (repo *config*))
|
(delete-file filepath))))
|
||||||
(loop for post across posts do (import-post post since))))
|
|
||||||
|
(defun enable (&key filepath)
|
||||||
|
(import-posts filepath))
|
||||||
|
|
|
@ -15,4 +15,10 @@ src=\"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLor
|
||||||
</script>")
|
</script>")
|
||||||
|
|
||||||
(defun enable ()
|
(defun enable ()
|
||||||
(coleslaw:add-injection *mathjax-header* :head))
|
(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))))))
|
||||||
|
(coleslaw:add-injection (list *mathjax-header* #'mathjax-p) :head)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue