diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index b9e793d..7c3b886 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -54,22 +54,23 @@ on files that match the given extension." (run-program "cp" `("-R" ,dir ".")))) (render-posts) (render-indices)) - (deploy staging))) + (deploy staging) + (setf (last-published) (last-commit)))) (defun update-symlink (name target) "Update the symlink NAME to point to TARGET." (run-program "ln" (list "-sfn" (namestring target) name))) -(defun deploy (dir) - "Deploy DIR, updating the .prev and .curr symlinks." - (let ((new-build (app-path "generated/~a" (get-universal-time)))) - (run-program "mv" (list dir (namestring new-build))) - (when (probe-file (app-path ".prev")) - (delete-files (read-symlink (app-path ".prev")) :recursive t)) - (when (probe-file (app-path ".curr")) - (update-symlink ".prev" (read-symlink (app-path ".curr")))) - (update-symlink ".curr" new-build)) - (setf (last-published) (last-commit))) +(defgeneric deploy (dir) + (:documentation "Deploy DIR, updating the .prev and .curr symlinks.") + (:method (dir) + (let ((new-build (app-path "generated/~a" (get-universal-time)))) + (run-program "mv" (list dir (namestring new-build))) + (when (probe-file (app-path ".prev")) + (delete-files (read-symlink (app-path ".prev")) :recursive t)) + (when (probe-file (app-path ".curr")) + (update-symlink ".prev" (read-symlink (app-path ".curr")))) + (update-symlink ".curr" new-build)))) (defun main () (load-config) diff --git a/src/indices.lisp b/src/indices.lisp index 38dea60..c83c317 100644 --- a/src/indices.lisp +++ b/src/indices.lisp @@ -27,7 +27,8 @@ (domain *config*) (post-slug post)) :title (post-title post) :date (post-date post) - :contents (post-contents post))))) + :content (render-content (post-content post) + (post-format post)))))) (render-page filename (funcall (theme-fn "INDEX") (list :taglinks (taglinks) diff --git a/src/packages.lisp b/src/packages.lisp index 72d09e7..ae580fa 100644 --- a/src/packages.lisp +++ b/src/packages.lisp @@ -5,4 +5,7 @@ #:read-symlink #:run-program) (:import-from :iolib.pathnames #:file-path-namestring) - (:export #:main)) + (:export #:main + #:add-injection + #:render-content + #:deploy)) diff --git a/src/posts.lisp b/src/posts.lisp index 4245fbe..a71ca12 100644 --- a/src/posts.lisp +++ b/src/posts.lisp @@ -20,6 +20,11 @@ (setf (gethash (post-slug post) *posts*) post)))) (maphash #'write-post *posts*)) +(defgeneric render-content (text format) + (:documentation "Compile TEXT from the given FORMAT to HTML for display.") + (:method (text (format (eql :html))) + text)) + (defun read-post (stream) "Make a POST instance based on the data from STREAM." ) @@ -31,7 +36,8 @@ (list :title (post-title post) :tags (post-tags post) :date (post-date post) - :content (post-content post) + :content (render-content (post-content post) + (post-format post)) ; TODO: Populate prev and next with links. :prev nil :next nil)))) diff --git a/src/themes.lisp b/src/themes.lisp index 040f21a..587a123 100644 --- a/src/themes.lisp +++ b/src/themes.lisp @@ -8,12 +8,6 @@ (:method ((str string) location) (pushnew str (gethash location *injections*) :test #'string=))) -(defgeneric remove-injection (str location) - (:documentation "Remove STR from the list of elements injected in LOCATION.") - (:method ((str string) location) - (setf (gethash location *injections*) - (remove str (gethash location *injections*) :test #'string=)))) - (defun theme-package (&key (name (theme *config*))) "Find the package matching the theme NAME." (find-package (string-upcase (concatenate 'string "coleslaw.theme." name)))) diff --git a/themes/hyde/index.tmpl b/themes/hyde/index.tmpl index f11048f..1e1b28c 100644 --- a/themes/hyde/index.tmpl +++ b/themes/hyde/index.tmpl @@ -5,7 +5,7 @@
{/foreach}