From 023004269a5274c1132a8228b95b1ee1fbfa0200 Mon Sep 17 00:00:00 2001 From: Brit Butler Date: Wed, 22 Aug 2012 15:12:36 -0400 Subject: [PATCH] Whoops. Misc typo and thinko fixes. Bump version to 0.5. We're useful now! --- coleslaw.asd | 2 +- example.coleslawrc | 2 +- plugins/markdown.lisp | 4 ++-- plugins/mathjax.lisp | 6 +----- src/config.lisp | 3 ++- src/util.lisp | 26 ++++++++++++++++++++++++++ 6 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 src/util.lisp diff --git a/coleslaw.asd b/coleslaw.asd index d10406e..011c0e9 100644 --- a/coleslaw.asd +++ b/coleslaw.asd @@ -1,7 +1,7 @@ (defsystem #:coleslaw :name "coleslaw-core" :description "Flexible Lisp Blogware" - :version "0.4" + :version "0.5" :license "BSD" :author "Brit Butler " :pathname "src/" diff --git a/example.coleslawrc b/example.coleslawrc index 1ec0757..2a06cb8 100644 --- a/example.coleslawrc +++ b/example.coleslawrc @@ -1,7 +1,7 @@ (:author "Brit Butler" :domain "http://blog.redlinernotes.com" :license "CC-BY-SA" - :plugins nil + :plugins (markdown mathjax) :repo "/home/redline/projects/coleslaw/ignore/input/" :sitenav "" :title "Improved Means for Achieving Deteriorated Ends" diff --git a/plugins/markdown.lisp b/plugins/markdown.lisp index 519e993..f3bc8df 100644 --- a/plugins/markdown.lisp +++ b/plugins/markdown.lisp @@ -1,4 +1,4 @@ -(eval-when (:compile-toplevel) +(eval-when (:compile-toplevel :load-toplevel) (ql:quickload '(3bmd 3bmd-ext-code-blocks))) (defpackage :coleslaw-md @@ -7,6 +7,6 @@ (in-package :coleslaw-md) (defmethod render-content (text (format (eql :md))) - (let ((3mbd-code-blocks:*code-blocks* t)) + (let ((3bmd-code-blocks:*code-blocks* t)) (with-output-to-string (str) (3bmd:parse-string-and-print-to-stream text str)))) diff --git a/plugins/mathjax.lisp b/plugins/mathjax.lisp index 0981893..5533b80 100644 --- a/plugins/mathjax.lisp +++ b/plugins/mathjax.lisp @@ -10,8 +10,4 @@ src=\"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML\"> ") -(defmethod enable () - (coleslaw::add-injection *mathjax-header* :head)) - -(defmethod disable () - (coleslaw::remove-injection *mathjax-header* :head)) +(coleslaw:add-injection *mathjax-header* :head) diff --git a/src/config.lisp b/src/config.lisp index 1670627..49721f1 100644 --- a/src/config.lisp +++ b/src/config.lisp @@ -18,4 +18,5 @@ (defun load-config (&optional (dir (user-homedir-pathname))) "Load the coleslaw configuration from DIR/.coleslawrc. DIR is ~ by default." (with-open-file (in (merge-pathnames ".coleslawrc" dir)) - (setf *config* (apply #'make-instance 'blog (read in))))) + (setf *config* (apply #'make-instance 'blog (read in)))) + (load-plugins (plugins *config*))) diff --git a/src/util.lisp b/src/util.lisp new file mode 100644 index 0000000..3a46bce --- /dev/null +++ b/src/util.lisp @@ -0,0 +1,26 @@ +(in-package :coleslaw) + +(defun app-path (path &rest args) + "Take a relative PATH and return the corresponding pathname beneath coleslaw. +If ARGS is provided, use (apply 'format nil PATH ARGS) as the value of PATH." + (merge-pathnames (apply 'format nil path args) coleslaw-conf:*basedir*)) + +(defun to-pathname (file &optional (parent coleslaw-conf:*basedir*)) + "Convert an iolib file-path back to a pathname." + (merge-pathnames (file-path-namestring file) parent)) + +(defun read-symlink (path) + "A trivial wrapper over iolib.os that returns the pathname in the symlink PATH." + (to-pathname (iolib.os:read-symlink path))) + +(defmacro do-files ((var path &optional extension) &body body) + "For each file under PATH, run BODY. If EXTENSION is provided, only run BODY +on files that match the given extension." + (alexandria:with-gensyms (ext) + `(mapcar (lambda (,var) + ,@(if extension + `((let ((,ext (pathname-type ,var))) + (when (and ,ext (string= ,ext ,extension)) + ,@body))) + `,body)) + (list-directory ,path))))