-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.scm
More file actions
41 lines (35 loc) · 1.02 KB
/
Copy pathpage.scm
File metadata and controls
41 lines (35 loc) · 1.02 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
(library
(melt page)
(export create-page
compose
writer
page-list-query)
(import (scheme)
(melt parser sxml)
(melt utils)
(melt lib sxml)
(melt lib file)
(melt cell)
(melt structure))
(import type-page)
(define (create-page meta cont comt)
(make-page meta cont comt))
(define (compose page renderer-list)
(let ((generate-sxml (page-cont page)))
(generate-sxml page renderer-list)))
(define (page-list-query key page-list)
(if (null? page-list)
#f
(if (eq? key (page-meta (car page-list)))
(car page-list)
(page-list-query key (cdr page-list)))))
;; convert the sxml to html and write it to a file
(define writer
(make-cell (void)
(lambda (value)
(lambda (sxml)
(let ((port (open-output-file value 'replace)))
(sxml->html sxml port)
(close-output-port port)))))
)
)