initial
This commit is contained in:
26
compile.zp
Normal file
26
compile.zp
Normal file
@@ -0,0 +1,26 @@
|
||||
(load "mustache/mustache")
|
||||
(load "pandoc/pandoc")
|
||||
|
||||
(import-all "mustache")
|
||||
(import-all "pandoc")
|
||||
|
||||
(define tpl (read-contents "layout.html"))
|
||||
(define poem-dir "poems/")
|
||||
|
||||
(define (all-poems)
|
||||
(let* ((ls (os:ls poem-dir))
|
||||
(ls (filter ($ (not (in? ["." ".."] %))) ls)))
|
||||
(map (curry ++ poem-dir) ls)))
|
||||
|
||||
(define (from-path file)
|
||||
(regex:sub r/.md$/ "" (list:last (string:split file "/"))))
|
||||
|
||||
(define (render targets)
|
||||
(let* ((strs (map read-contents targets))
|
||||
(args (make-hash
|
||||
"poems" (map (curry pandoc:convert "markdown" "html") strs))))
|
||||
(with-output-file "index.html"
|
||||
(curry write (mustache:template tpl args)))))
|
||||
|
||||
(let ((targets (all-poems)))
|
||||
(render targets))
|
Reference in New Issue
Block a user