@@ -21,10 +21,11 @@ ;; 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,10 +63,15 @@ (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)