Minor source reorg.

This commit is contained in:
Brit Butler 2012-08-22 00:16:41 -04:00
parent b3455146ae
commit 5992e6ea28
3 changed files with 3 additions and 30 deletions

View file

@ -10,8 +10,9 @@
:components ((:file "packages")
(:file "config")
(:file "git")
(:file "themes")
(:file "util")
(:file "plugins")
(:file "themes")
(:file "coleslaw")
(:file "feeds")
(:file "posts")

View file

@ -1,30 +1,5 @@
(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))))
(defun render-page (path html &optional raw)
"Populate the base template with the provided HTML and write it out to PATH.
If RAW is non-nil, write the content without wrapping it in the base template."

View file

@ -5,10 +5,7 @@
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
(concatenate 'string "plugins/"
(string-downcase (symbol-name sym)))
coleslaw-conf:*basedir*))
(app-path "plugins/~a" (string-downcase (symbol-name sym))))
plugins)))
(map nil (lambda (file)
(compile-file file)