diff --git a/NEWS.md b/NEWS.md index f8c2d85..38fce4a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +## Changes for 0.9.1 (2013-04-xx): + +* Make ATOM and RSS templates a separate "generic" theme. (thanks @woudshoo!) + ## Changes for 0.9 (2013-02-20): * INCOMPATIBLE CHANGE: All :plugins in .coleslawrc must be lists. (i.e. (mathjax) not mathjax) diff --git a/src/coleslaw.lisp b/src/coleslaw.lisp index be7bee4..491bd34 100644 --- a/src/coleslaw.lisp +++ b/src/coleslaw.lisp @@ -24,7 +24,7 @@ (defun render-page (content &optional theme-fn &rest render-args) "Render the given CONTENT to disk using THEME-FN if supplied. Additional args to render CONTENT can be passed via RENDER-ARGS." - (funcall (theme-fn (or theme-fn 'base)) + (funcall (or theme-fn (theme-fn 'base)) (list :config *config* :content content :raw (apply 'render content render-args) diff --git a/src/feeds.lisp b/src/feeds.lisp index f65c183..768d243 100644 --- a/src/feeds.lisp +++ b/src/feeds.lisp @@ -11,11 +11,13 @@ (let* ((by-date (by-date (find-all 'post))) (posts (first-10 by-date)) (rss (make-instance 'index :id "rss.xml" :posts posts)) - (atom (make-instance 'index :id "feed.atom" :posts posts))) - (write-page (page-path rss) (render-page rss :rss-feed)) - (write-page (page-path atom) (render-page atom :atom-feed)) + (atom (make-instance 'index :id "feed.atom" :posts posts)) + (rss-template (theme-fn :rss-feed "feeds")) + (atom-template (theme-fn :atom-feed "feeds"))) + (write-page (page-path rss) (render-page rss rss-template)) + (write-page (page-path atom) (render-page atom atom-template)) (dolist (feed feeds) (let ((index (index-by-tag feed by-date))) (setf (index-id index) (format nil "~a-rss.xml" feed) (index-posts index) (first-10 (index-posts index))) - (write-page (page-path index) (render-page index :rss-feed))))))) + (write-page (page-path index) (render-page index rss-template))))))) diff --git a/src/themes.lisp b/src/themes.lisp index 140a53a..c2c7895 100644 --- a/src/themes.lisp +++ b/src/themes.lisp @@ -22,13 +22,13 @@ any return value other than nil indicates the injection should be added." (list :head (injections-for :head) :body (injections-for :body)))) -(defun theme-package (&key (name (theme *config*))) +(defun theme-package (name) "Find the package matching the theme NAME." (find-package (string-upcase (concatenate 'string "coleslaw.theme." name)))) -(defun theme-fn (name) - "Find the symbol NAME inside the current theme's package." - (find-symbol (princ-to-string name) (theme-package))) +(defun theme-fn (name &optional (package (theme *config*))) + "Find the symbol NAME inside PACKAGE which defaults to the theme package." + (find-symbol (princ-to-string name) (theme-package package))) (defun compile-theme (theme) "Locate and compile the templates for the given THEME." diff --git a/themes/atom.tmpl b/themes/atom.tmpl index c11d019..2b5ff5c 100644 --- a/themes/atom.tmpl +++ b/themes/atom.tmpl @@ -1,4 +1,4 @@ -{namespace coleslaw.theme.hyde} +{namespace coleslaw.theme.feeds} {template atom-feed} {\n} diff --git a/themes/rss.tmpl b/themes/rss.tmpl index 809a756..29f8cf7 100644 --- a/themes/rss.tmpl +++ b/themes/rss.tmpl @@ -1,4 +1,4 @@ -{namespace coleslaw.theme.hyde} +{namespace coleslaw.theme.feeds} {template rss-feed} {\n}