Selaa lähdekoodia

Whoops. Misc typo and thinko fixes. Bump version to 0.5. We're useful now!

Brit Butler 13 vuotta sitten
vanhempi
commit
023004269a
6 muutettua tiedostoa jossa 33 lisäystä ja 10 poistoa
  1. 1 1
      coleslaw.asd
  2. 1 1
      example.coleslawrc
  3. 2 2
      plugins/markdown.lisp
  4. 1 5
      plugins/mathjax.lisp
  5. 2 1
      src/config.lisp
  6. 26 0
      src/util.lisp

+ 1 - 1
coleslaw.asd

@@ -1,7 +1,7 @@
1 1
 (defsystem #:coleslaw
2 2
   :name "coleslaw-core"
3 3
   :description "Flexible Lisp Blogware"
4
-  :version "0.4"
4
+  :version "0.5"
5 5
   :license "BSD"
6 6
   :author "Brit Butler <redline6561@gmail.com>"
7 7
   :pathname "src/"

+ 1 - 1
example.coleslawrc

@@ -1,7 +1,7 @@
1 1
 (:author "Brit Butler"
2 2
  :domain "http://blog.redlinernotes.com"
3 3
  :license "CC-BY-SA"
4
- :plugins nil
4
+ :plugins (markdown mathjax)
5 5
  :repo "/home/redline/projects/coleslaw/ignore/input/"
6 6
  :sitenav ""
7 7
  :title "Improved Means for Achieving Deteriorated Ends"

+ 2 - 2
plugins/markdown.lisp

@@ -1,4 +1,4 @@
1
-(eval-when (:compile-toplevel)
1
+(eval-when (:compile-toplevel :load-toplevel)
2 2
   (ql:quickload '(3bmd 3bmd-ext-code-blocks)))
3 3
 
4 4
 (defpackage :coleslaw-md
@@ -7,6 +7,6 @@
7 7
 (in-package :coleslaw-md)
8 8
 
9 9
 (defmethod render-content (text (format (eql :md)))
10
-  (let ((3mbd-code-blocks:*code-blocks* t))
10
+  (let ((3bmd-code-blocks:*code-blocks* t))
11 11
     (with-output-to-string (str)
12 12
       (3bmd:parse-string-and-print-to-stream text str))))

+ 1 - 5
plugins/mathjax.lisp

@@ -10,8 +10,4 @@
10 10
 src=\"http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML\">
11 11
 </script>")
12 12
 
13
-(defmethod enable ()
14
-  (coleslaw::add-injection *mathjax-header* :head))
15
-
16
-(defmethod disable ()
17
-  (coleslaw::remove-injection *mathjax-header* :head))
13
+(coleslaw:add-injection *mathjax-header* :head)

+ 2 - 1
src/config.lisp

@@ -18,4 +18,5 @@
18 18
 (defun load-config (&optional (dir (user-homedir-pathname)))
19 19
   "Load the coleslaw configuration from DIR/.coleslawrc. DIR is ~ by default."
20 20
   (with-open-file (in (merge-pathnames ".coleslawrc" dir))
21
-    (setf *config* (apply #'make-instance 'blog (read in)))))
21
+    (setf *config* (apply #'make-instance 'blog (read in))))
22
+  (load-plugins (plugins *config*)))

+ 26 - 0
src/util.lisp

@@ -0,0 +1,26 @@
1
+(in-package :coleslaw)
2
+
3
+(defun app-path (path &rest args)
4
+  "Take a relative PATH and return the corresponding pathname beneath coleslaw.
5
+If ARGS is provided, use (apply 'format nil PATH ARGS) as the value of PATH."
6
+  (merge-pathnames (apply 'format nil path args) coleslaw-conf:*basedir*))
7
+
8
+(defun to-pathname (file &optional (parent coleslaw-conf:*basedir*))
9
+  "Convert an iolib file-path back to a pathname."
10
+  (merge-pathnames (file-path-namestring file) parent))
11
+
12
+(defun read-symlink (path)
13
+  "A trivial wrapper over iolib.os that returns the pathname in the symlink PATH."
14
+  (to-pathname (iolib.os:read-symlink path)))
15
+
16
+(defmacro do-files ((var path &optional extension) &body body)
17
+  "For each file under PATH, run BODY. If EXTENSION is provided, only run BODY
18
+on files that match the given extension."
19
+  (alexandria:with-gensyms (ext)
20
+    `(mapcar (lambda (,var)
21
+               ,@(if extension
22
+                     `((let ((,ext (pathname-type ,var)))
23
+                         (when (and ,ext (string= ,ext ,extension))
24
+                           ,@body)))
25
+                     `,body))
26
+             (list-directory ,path))))