Minor source reorg.
This commit is contained in:
parent
b3455146ae
commit
5992e6ea28
3 changed files with 3 additions and 30 deletions
|
@ -10,8 +10,9 @@
|
||||||
:components ((:file "packages")
|
:components ((:file "packages")
|
||||||
(:file "config")
|
(:file "config")
|
||||||
(:file "git")
|
(:file "git")
|
||||||
(:file "themes")
|
(:file "util")
|
||||||
(:file "plugins")
|
(:file "plugins")
|
||||||
|
(:file "themes")
|
||||||
(:file "coleslaw")
|
(:file "coleslaw")
|
||||||
(:file "feeds")
|
(:file "feeds")
|
||||||
(:file "posts")
|
(:file "posts")
|
||||||
|
|
|
@ -1,30 +1,5 @@
|
||||||
(in-package :coleslaw)
|
(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)
|
(defun render-page (path html &optional raw)
|
||||||
"Populate the base template with the provided HTML and write it out to PATH.
|
"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."
|
If RAW is non-nil, write the content without wrapping it in the base template."
|
||||||
|
|
|
@ -5,10 +5,7 @@
|
||||||
resulting pathnames. 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."
|
are in the plugins folder in coleslaw's source directory."
|
||||||
(let ((files (mapcar (lambda (sym)
|
(let ((files (mapcar (lambda (sym)
|
||||||
(merge-pathnames
|
(app-path "plugins/~a" (string-downcase (symbol-name sym))))
|
||||||
(concatenate 'string "plugins/"
|
|
||||||
(string-downcase (symbol-name sym)))
|
|
||||||
coleslaw-conf:*basedir*))
|
|
||||||
plugins)))
|
plugins)))
|
||||||
(map nil (lambda (file)
|
(map nil (lambda (file)
|
||||||
(compile-file file)
|
(compile-file file)
|
||||||
|
|
Loading…
Add table
Reference in a new issue