21
22
23
24
25
26
27
28
29
30
|
21
22
23
24
25
26
27
28
29
30
31
|
+
|
;; Provides common helper functions used throughout the project
(provide maybe-meta ; Select from (current-metas) or default value ("") if not available
maybe-attr ; Return an attribute’s value or a default ("") if not available
set-meta!
here-output-path
here-source-path
here-id
listing-context
current-series-noun ; Retrieve noun-singular from current 'series meta, or #f
|
62
63
64
65
66
67
68
69
70
71
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
+
+
+
+
+
|
(define (maybe-meta m [missing ""])
(cond [(current-metas) (or (select-from-metas m (current-metas)) missing)]
[else missing]))
(define (set-meta! key v)
(define cur-metas (current-metas))
(and cur-metas
(current-metas (hash-set! cur-metas key v))))
;; Return the current source path, relative to (current-project-root)
(define (here-source-path)
(match (current-metas)
[(? hash? m)
(define-values (_ rel-path-parts)
|