From 61d3b6aae43e1ad870e7832ec964964124eacb1b Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 15 Sep 2023 00:19:37 -0500 Subject: Fix bugs and implement changes I can actually build a (one-page) site! --- boudin.page.post.scm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'boudin.page.post.scm') 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 @@ render-specials render-unprintables) (schmaltz chicken) + (srfi 1) (srfi 152)) (define (make-post path) @@ -30,17 +31,20 @@ (define (*extract-metadata sxml) (let loop ((tree sxml) (acc '())) + ;;; CONSIDER: using `read' to simplify this crazy logic (cond - ((not (pair? tree)) + ((null? tree) (reverse acc)) ((and (list? (car tree)) (eq? (caar tree) '*COMMENT*)) (loop (cdr tree) - (map (lambda (ln) - (let ((kv (string-split ln ":" 'infix 1))) - (cons (string-trim-both (car kv)) - (string-trim (cdr kv))))) - (string-split (cadar tree) "\n")))) + (filter-map (lambda (ln) + (let ((kv (string-split ln ":" 'infix 1))) + (and (pair? kv) + (cons (string-trim-both (car kv)) + (apply string-append + (map string-trim (cdr kv))))))) + (string-split (cadar tree) "\n")))) ((list? (car tree)) (loop (cdr tree) (let ((subtree (loop (car tree) '()))) -- cgit 1.4.1-21-gabe81