Commit 7eb5cde0 authored by Mariano Montone's avatar Mariano Montone
Browse files

Merge branch 'master' into 'master'

Fix newsbox rendering in home page

See merge request clo/cl-site!50
parents 2a84e2ed df2ff8ba
......@@ -33,6 +33,14 @@
;; process-pages : Copies/renders pages - called last
(defun render-template (template &optional context output-stream)
(let ((mustache:*load-path* (cons *PAGES-DIR* mustache:*load-path*))
(mustache:*default-pathname-type* "html"))
(mustache:render template context output-stream)))
(defun render-template* (template &optional context)
(with-output-to-string (output-stream)
(render-template template context output-stream)))
(defun render-page (page template-path)
(let ((page-path (make-path *PAGES-DIR* page t))
......@@ -44,14 +52,15 @@
(content-text (format nil "~{~A~%~}" content))
(parsed-header (yaml:parse header-text))
(page-context
(when parsed-header
(loop for k being each hash-key of parsed-header
using (hash-value v)
collect (cons k v)))))
(when parsed-header
(loop for k being each hash-key of parsed-header
using (hash-value v)
collect (cons k v)))))
(with-open-file (output-stream output-path
:direction :output
:if-exists :supersede)
(mustache:render template-path (append (acons :page-content content-text page-context) *GLOBAL-CONTEXT*)
:direction :output
:if-exists :supersede)
(render-template template-path
(append (acons :page-content (render-template* content-text) page-context) *GLOBAL-CONTEXT*)
output-stream))))))
(defun process-pages (pages)
......
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