Commit 7f2eedae authored by Erik Huelsmann's avatar Erik Huelsmann

Process one page at a time

This commit is one of a series which will result
in retaining the original input filename being available
when rendering the ultimate HTML page (which it currently
parent 13f7a18b
......@@ -3,13 +3,17 @@
(defun make-site (&optional output-dir)
(let ((*output-dir* (or output-dir *output-dir*)))
(ensure-directories-exist *OUTPUT-DIR*)
(format t "Generating site in ~A.~%" *output-dir*)
(process-static *static-dir* *output-dir*)
(process-static (merge-pathnames #P"static/" *layout-dir*) *output-dir*)
(let ((pages (populate-pages)))
(preprocess-md-pages pages)
(preprocess-lisp-pages pages))
(process-pages (populate-pages))))
(dolist (page (populate-pages))
(process-page page))))
(defun make-clean (&optional (output-dir *output-dir*))
......@@ -105,18 +105,12 @@
(format out "---~%")
(write-string (getf *computed-page-content* :html-string) out))))))))
(defun process-pages (pages)
(format t "Processing pages..~%")
(let ((template-path (pathname (merge-pathnames *templates-dir* *DEFAULT-PAGE-TEMPLATE*))))
(ensure-directories-exist *OUTPUT-DIR*)
(loop for page in pages
when (string= (pathname-type (cdr (assoc :content page))) "html")
(format t "Rendering ~A~%" (cdr (assoc :content page)))
(render-page page template-path))
(format t "Done.~%")))
(defun process-page (page)
(let ((page-path (cdr (assoc :content page)))
(template-path (pathname (merge-pathnames *templates-dir* *DEFAULT-PAGE-TEMPLATE*))))
(when (string= (pathname-type page-path) "html")
(format t "Rendering ~A~%" page-path)
(render-page page template-path))))
;; Process news
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment