41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
-
-
+
+
-
-
+
+
|
series-pagenode
make-tag-predicate
tx-strs
ymd->english
ymd->dateformat
default-authorname
default-title
articles-path
series-path
articles-folder
series-folder
articles-pagetree
series-pagetree
first-words
build-note-id
notes->last-disposition-values
disposition-values
)
(define default-authorname "Joel Dueck")
(define series-path "series")
(define articles-path "articles")
(define series-folder "series")
(define articles-folder "articles")
(define (default-title body-txprs)
(format "“~a…”" (first-words body-txprs 5)))
(define (maybe-meta m [missing ""])
(or (select-from-metas m (current-metas)) missing))
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
-
+
|
;; Checks current-metas for a 'series meta and returns the pagenode of that series,
;; or '|| if no series is specified.
(define (series-pagenode)
(define maybe-series (or (select-from-metas 'series (current-metas)) ""))
(cond
[(non-empty-string? maybe-series)
(->pagenode (format "~a/~a.html" series-path maybe-series))]
(->pagenode (format "~a/~a.html" series-folder maybe-series))]
[else '||]))
(define (series-noun)
(define series-pnode (series-pagenode))
(case series-pnode
['|| ""] ; no series specified
[else (or (select-from-metas 'noun-singular series-pnode) "")]))
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
-
+
-
+
|
(define (file->output-pagenode f)
(string->symbol (format "~a/~a" folder (string-replace f extension ".html"))))
(define folder-path (build-path (current-project-root) folder))
(define file-strs (map path->string (directory-list folder-path)))
(map file->output-pagenode (filter matching-file? file-strs)))
(define (articles-pagetree)
`(root ,@(include-in-pagetree articles-path ".poly.pm")))
`(root ,@(include-in-pagetree articles-folder ".poly.pm")))
(define (series-pagetree)
`(root ,@(include-in-pagetree series-path ".poly.pm")))
`(root ,@(include-in-pagetree series-folder ".poly.pm")))
;; ~~~ Convenience functions for tagged x-expressions ~~~
(define (maybe-attr name attrs [missing ""])
(define result (assoc name attrs))
(cond
[(pair? result) (cadr result)]
|