post: Add post-ref-all procedure.

* haunt/post.scm (post-ref-all): New procedure.
This commit is contained in:
David Thompson 2018-11-18 20:46:36 -05:00
parent ea14e56f0c
commit 51e2f10645
1 changed files with 8 additions and 0 deletions

View File

@ -36,6 +36,7 @@
post-sxml post-sxml
post-metadata post-metadata
post-ref post-ref
post-ref-all
post-slug post-slug
%default-date %default-date
post-date post-date
@ -57,6 +58,13 @@
"Return the metadata corresponding to KEY within POST." "Return the metadata corresponding to KEY within POST."
(assq-ref (post-metadata post) key)) (assq-ref (post-metadata post) key))
(define (post-ref-all post key)
"Return a list of all metadata values for KEY within POST."
(filter-map (match-lambda
((k . v)
(and (eq? key k) v)))
(post-metadata post)))
(define char-set:slug (define char-set:slug
(char-set-union char-set:letter+digit (char-set #\-))) (char-set-union char-set:letter+digit (char-set #\-)))