summary refs log tree commit diff stats
path: root/boudin.page.post.scm
diff options
context:
space:
mode:
Diffstat (limited to 'boudin.page.post.scm')
-rw-r--r--boudin.page.post.scm16
1 files changed, 10 insertions, 6 deletions
diff --git a/boudin.page.post.scm b/boudin.page.post.scm index 002d7bf..bd77695 100644 --- a/boudin.page.post.scm +++ b/boudin.page.post.scm
@@ -15,6 +15,7 @@
15 render-specials 15 render-specials
16 render-unprintables) 16 render-unprintables)
17 (schmaltz chicken) 17 (schmaltz chicken)
18 (srfi 1)
18 (srfi 152)) 19 (srfi 152))
19 20
20(define (make-post path) 21(define (make-post path)
@@ -30,17 +31,20 @@
30(define (*extract-metadata sxml) 31(define (*extract-metadata sxml)
31 (let loop ((tree sxml) 32 (let loop ((tree sxml)
32 (acc '())) 33 (acc '()))
34 ;;; CONSIDER: using `read' to simplify this crazy logic
33 (cond 35 (cond
34 ((not (pair? tree)) 36 ((null? tree)
35 (reverse acc)) 37 (reverse acc))
36 ((and (list? (car tree)) 38 ((and (list? (car tree))
37 (eq? (caar tree) '*COMMENT*)) 39 (eq? (caar tree) '*COMMENT*))
38 (loop (cdr tree) 40 (loop (cdr tree)
39 (map (lambda (ln) 41 (filter-map (lambda (ln)
40 (let ((kv (string-split ln ":" 'infix 1))) 42 (let ((kv (string-split ln ":" 'infix 1)))
41 (cons (string-trim-both (car kv)) 43 (and (pair? kv)
42 (string-trim (cdr kv))))) 44 (cons (string-trim-both (car kv))
43 (string-split (cadar tree) "\n")))) 45 (apply string-append
46 (map string-trim (cdr kv)))))))
47 (string-split (cadar tree) "\n"))))
44 ((list? (car tree)) 48 ((list? (car tree))
45 (loop (cdr tree) 49 (loop (cdr tree)
46 (let ((subtree (loop (car tree) '()))) 50 (let ((subtree (loop (car tree) '())))