From 1136a083e9ccb70ab5eb68f16365050afea26ac7 Mon Sep 17 00:00:00 2001 From: Lucian Mogosanu Date: Mon, 18 Feb 2019 22:17:19 +0200 Subject: [PATCH] blog: Make a drafts page --- blog.lisp | 14 ++++++++++++-- templates/drafts.lisp | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 templates/drafts.lisp diff --git a/blog.lisp b/blog.lisp index 71b9f98..cd64966 100644 --- a/blog.lisp +++ b/blog.lisp @@ -39,6 +39,7 @@ (load (concatenate 'string *lbs-base* "templates/post.lisp")) (load (concatenate 'string *lbs-base* "templates/index.lisp")) (load (concatenate 'string *lbs-base* "templates/archive.lisp")) +(load (concatenate 'string *lbs-base* "templates/drafts.lisp")) (load (concatenate 'string *lbs-base* "templates/rss.lisp")) ;; TLBS functions @@ -109,7 +110,7 @@ (in-path (gethash "in-path" blist)) (out-path (gethash "out-path" blist))) ;; process tags - (tlbs-make-tagids blist) + (when (not draft) (tlbs-make-tagids blist)) (when (file-modified in-path out-path) (format t "[proc] ~s~%" x) ;; markdown -> html @@ -163,6 +164,12 @@ (make-pathname :name "archive" :type "html")) (tlbs-make-archive))) +(defun tlbs-process-drafts-page () + (tlbs-process-page (merge-pathnames + (pathname *lbs-site*) + (make-pathname :name "drafts" :type "html")) + (tlbs-make-drafts-page))) + (defun tlbs-process-index () (tlbs-process-page (merge-pathnames (pathname *lbs-site*) @@ -259,6 +266,8 @@ (tlbs-process-markdown-page page)) ; archive (tlbs-process-archive) + ; drafts page + (tlbs-process-drafts-page) ; index (tlbs-process-index)) @@ -281,7 +290,8 @@ (tlbs-process-index)) (defun tlbs-deploy-site () - (uiop:run-program (format nil "rsync -avz --exclude 'drafts/' -e '~a' ~a/* ~a" + (uiop:run-program (format nil "rsync -avz ~a -e '~a' ~a/* ~a" + "--exclude 'drafts/' --exclude drafts.html" "ssh -p 2200" *lbs-site* "mogosanu.ro:/virtual/sites/thetarpit.org") diff --git a/templates/drafts.lisp b/templates/drafts.lisp new file mode 100644 index 0000000..d173d70 --- /dev/null +++ b/templates/drafts.lisp @@ -0,0 +1,20 @@ +;; Tarpit Lisp Blog Scaffolding -- drafts template +;; +;; TODO: Make a macro to obtain general forms such as the ones below + +;; This uses some of the generic functionality from archive.lisp + +(defun tlbs-out-drafts (output-stream) + (cl-who:with-html-output (output-stream nil :indent nil) + (:h2 "Drafts from The Tar Pit") + (make-post-list *drafts*)) + nil) + +(defun tlbs-make-drafts-page () + (let ((str-out (make-string-output-stream)) + (blist (make-hash-table :test 'equal))) + (tlbs-out-drafts str-out) + (setf (gethash "title" blist) "Drafts") + (setf (gethash "body" blist) (get-output-stream-string str-out)) + (setf (gethash "uri" blist) #p"/drafts.html") + blist)) -- 1.7.10.4