summary refs log tree commit diff stats
path: root/boudin.page.write.scm
blob: 39e916c7bc26ddfd68280bebecf9fa2b2ece1aae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(declare (module (boudin page write))
         (export html-head
                 write-page))

(import (boudin page)
        (chicken file)
        (chicken pathname))

(define (write-page pg)
  (let ((outfile (page-output pg)))
    (create-directory (pathname-directory outfile)
                      'parents)
    (with-output-to-file outfile
      (lambda ()
        ((o (page-writer pg)
            (page-template pg))
         pg)))))

(define html-head
  (make-parameter
   `((meta (@ (charset "utf-8")))
     (meta (@ (name "viewport")
              (content "initial-scale=1.0")))
     (link (@ (href "/style.css")
              (rel "stylesheet"))))))