plugin: static-pages: allow specifying format
`format' in class `page' defaults to markdown to ensure backward compatibility.
This commit is contained in:
parent
9819c279bb
commit
1c585326ab
1 changed files with 7 additions and 4 deletions
|
@ -13,13 +13,16 @@
|
||||||
(in-package :coleslaw-static-pages)
|
(in-package :coleslaw-static-pages)
|
||||||
|
|
||||||
(defclass page (content)
|
(defclass page (content)
|
||||||
((title :initarg :title :reader coleslaw::title-of)))
|
((title :initarg :title :reader coleslaw::title-of)
|
||||||
|
(format :initarg :format :reader coleslaw::page-format))
|
||||||
|
;; default format is markdown (for backward compatibility)
|
||||||
|
(:default-initargs :format "md"))
|
||||||
|
|
||||||
(defmethod initialize-instance :after ((object page) &key)
|
(defmethod initialize-instance :after ((object page) &key)
|
||||||
;; Expect all static-pages to be written in Markdown for now.
|
(with-slots (coleslaw::url coleslaw::text format) object
|
||||||
(with-slots (coleslaw::url coleslaw::text) object
|
|
||||||
(setf coleslaw::url (make-pathname :defaults coleslaw::url)
|
(setf coleslaw::url (make-pathname :defaults coleslaw::url)
|
||||||
coleslaw::text (render-text coleslaw::text :md))))
|
format (alexandria:make-keyword (string-upcase format))
|
||||||
|
coleslaw::text (render-text coleslaw::text format))))
|
||||||
|
|
||||||
(defmethod render ((object page) &key next prev)
|
(defmethod render ((object page) &key next prev)
|
||||||
;; For the time being, we'll re-use the normal post theme.
|
;; For the time being, we'll re-use the normal post theme.
|
||||||
|
|
Loading…
Add table
Reference in a new issue