summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-09-15 00:19:37 -0500
committerCase Duckworth2023-09-15 00:19:37 -0500
commit61d3b6aae43e1ad870e7832ec964964124eacb1b (patch)
tree91c59e06e2bb735ce4ac1573fbb9ac9a7b553865
parentBump to 1.0 (diff)
downloadboudin-main.tar.gz
boudin-main.zip
Fix bugs and implement changes main
I can actually build a (one-page) site!
-rw-r--r--boudin.config.scm22
-rw-r--r--boudin.egg11
-rw-r--r--boudin.page.index.scm5
-rw-r--r--boudin.page.post.scm16
-rw-r--r--boudin.scm9
-rw-r--r--boudin.site.scm2
-rw-r--r--boudin.util.scm8
7 files changed, 60 insertions, 13 deletions
diff --git a/boudin.config.scm b/boudin.config.scm new file mode 100644 index 0000000..2cc5892 --- /dev/null +++ b/boudin.config.scm
@@ -0,0 +1,22 @@
1(module (boudin config) ()
2 (import scheme (chicken module))
3 (reexport (except (boudin site)
4 site-build-time)
5 (boudin util)
6 (only (boudin page style)
7 style-template
8 site-style
9 style-writer)
10 (only (boudin page post)
11 post-text-transformers
12 post-path-transformers
13 post-template
14 post-writer)
15 (only (boudin page write)
16 html-head) ; TODO: move to boudin.page
17 (only (boudin page index)
18 index-content
19 index-writer
20 index-template
21 feed-writer
22 feed-template)))
diff --git a/boudin.egg b/boudin.egg index b7eb4d3..daac0ac 100644 --- a/boudin.egg +++ b/boudin.egg
@@ -1,9 +1,9 @@
1;;; boudin 1;;; boudin
2 2
3((synopsis "a tiny, tasty ssg.") 3((synopsis "a spicy, tasty ssg.")
4 (author "Case Duckworth") 4 (author "Case Duckworth")
5 (license "God Willing") 5 (license "God Willing")
6 (version 1.0) 6 (version 0.9) ; almost done!
7 (build-dependencies module-declarations) 7 (build-dependencies module-declarations)
8 (dependencies atom 8 (dependencies atom
9 html-parser 9 html-parser
@@ -25,6 +25,13 @@
25 boudin.page.write 25 boudin.page.write
26 boudin.site 26 boudin.site
27 boudin.util)) 27 boudin.util))
28 (extension boudin.config
29 (component-dependencies boudin.site
30 boudin.page.style
31 boudin.page.post
32 boudin.page.index
33 boudin.page.write
34 boudin.util))
28 (extension boudin.page 35 (extension boudin.page
29 (component-dependencies boudin.site 36 (component-dependencies boudin.site
30 boudin.util)) 37 boudin.util))
diff --git a/boudin.page.index.scm b/boudin.page.index.scm index 4ff3fd9..52aebc8 100644 --- a/boudin.page.index.scm +++ b/boudin.page.index.scm
@@ -1,5 +1,6 @@
1(declare (module (boudin page index)) 1(declare (module (boudin page index))
2 (export make-index 2 (export make-index
3 index-content
3 index-template 4 index-template
4 index-writer 5 index-writer
5 make-feed 6 make-feed
@@ -33,12 +34,16 @@
33 (head ,@(html-head) 34 (head ,@(html-head)
34 (title ,(site-name))) 35 (title ,(site-name)))
35 (body (h1 ,(site-name)) 36 (body (h1 ,(site-name))
37 ,(index-content)
36 (ul ,@(map (lambda (pg) 38 (ul ,@(map (lambda (pg)
37 `(li (a (@ (href ,(page-slug pg))) 39 `(li (a (@ (href ,(page-slug pg)))
38 ,(or (page-ref pg "title") 40 ,(or (page-ref pg "title")
39 (page-slug pg))))) 41 (page-slug pg)))))
40 ((site-sort) pgs)))))))) 42 ((site-sort) pgs))))))))
41 43
44(define index-content
45 (make-parameter ""))
46
42(define (make-feed pgs) 47(define (make-feed pgs)
43 (make-page ((feed-template) pgs) 48 (make-page ((feed-template) pgs)
44 (make-pathname (site-output) "feed.xml") 49 (make-pathname (site-output) "feed.xml")
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) '())))
diff --git a/boudin.scm b/boudin.scm index b56b93b..9135a9e 100644 --- a/boudin.scm +++ b/boudin.scm
@@ -11,6 +11,8 @@
11 (chicken pathname) 11 (chicken pathname)
12 (chicken process-context)) 12 (chicken process-context))
13 13
14;; State variables
15
14(define site-posts 16(define site-posts
15 (make-parameter '())) 17 (make-parameter '()))
16 18
@@ -28,9 +30,6 @@
28 30
29(define (go!) 31(define (go!)
30 (eprint "Building " (site-name) "...") 32 (eprint "Building " (site-name) "...")
31 (when (file-exists? (site-config))
32 (with-progress (string-append "Config found, loading: " (site-config))
33 (lambda () (load (site-config)))))
34 (for-each (lambda (f) 33 (for-each (lambda (f)
35 (with-progress (string-append "Copying " f " to " (site-output)) 34 (with-progress (string-append "Copying " f " to " (site-output))
36 (lambda () (copy-static f)))) (site-files)) 35 (lambda () (copy-static f)))) (site-files))
@@ -52,7 +51,9 @@
52 (let loop ((args args)) 51 (let loop ((args args))
53 (cond 52 (cond
54 ((null? args) 53 ((null? args)
55 (for-each print (site-posts)) 54 (when (file-exists? (site-config))
55 (with-progress (string-append "Loading " (site-config))
56 (lambda () (load (site-config)))))
56 (go!)) 57 (go!))
57 ;; Configuration file: -c FILE 58 ;; Configuration file: -c FILE
58 ((equal? (car args) "-c") 59 ((equal? (car args) "-c")
diff --git a/boudin.site.scm b/boudin.site.scm index ee94b9b..a345338 100644 --- a/boudin.site.scm +++ b/boudin.site.scm
@@ -39,7 +39,7 @@
39 (make-parameter '("%Y-%m-%d" 39 (make-parameter '("%Y-%m-%d"
40 "%d/%m/%Y"))) 40 "%d/%m/%Y")))
41 41
42;; State variables 42;;; State
43 43
44(define site-build-time 44(define site-build-time
45 (make-parameter 45 (make-parameter
diff --git a/boudin.util.scm b/boudin.util.scm index b5c3efe..916dbf1 100644 --- a/boudin.util.scm +++ b/boudin.util.scm
@@ -1,12 +1,14 @@
1(declare (module (boudin util)) 1(declare (module (boudin util))
2 (export assoc-ref 2 (export assoc-ref
3 slurp 3 slurp
4 slurp-bytes
4 wrap-paragraphs 5 wrap-paragraphs
5 edisplay 6 edisplay
6 eprint)) 7 eprint))
7 8
8(import (chicken io) 9(import (chicken io)
9 (srfi 1) 10 (srfi 1)
11 (srfi 4)
10 (srfi 152)) 12 (srfi 152))
11 13
12(define (edisplay x) 14(define (edisplay x)
@@ -61,3 +63,9 @@
61 ((port) 63 ((port)
62 (read-string #f port) ; CHICKEN-ism 64 (read-string #f port) ; CHICKEN-ism
63 ))) 65 )))
66
67(define slurp-bytes
68 (case-lambda
69 (() (slurp-bytes (current-input-port)))
70 ((port)
71 (read-u8vector #f port))))