From 117ddb975350f40dbdda17beaf87fd41a2410ce4 Mon Sep 17 00:00:00 2001 From: Matthew Butterick Date: Thu, 22 Nov 2018 10:58:24 -0800 Subject: [PATCH] more lenient return contract for `select-from-metas` (fixes #184) --- pollen/core.rkt | 2 +- pollen/private/ts.rktd | 2 +- pollen/scribblings/core.scrbl | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pollen/core.rkt b/pollen/core.rkt index b8e7f8d..9044cd6 100644 --- a/pollen/core.rkt +++ b/pollen/core.rkt @@ -62,7 +62,7 @@ (define+provide/contract (select-from-metas key metas-source [caller 'select-from-metas]) ;; output contract is a single txexpr-element ;; because metas is a hash, and a hash has only one value for a key. - ((coerce/symbol? (or/c is-meta-value? pagenode? pathish?)) (symbol?) . ->* . (or/c #f txexpr-element?)) + ((coerce/symbol? (or/c is-meta-value? pagenode? pathish?)) (symbol?) . ->* . any/c) (hash-ref (match metas-source [(? is-meta-value? ms) ms] [_ (get-metas metas-source caller)]) key #false)) diff --git a/pollen/private/ts.rktd b/pollen/private/ts.rktd index aa4910a..714af02 100644 --- a/pollen/private/ts.rktd +++ b/pollen/private/ts.rktd @@ -1 +1 @@ -1542912991 +1542913104 diff --git a/pollen/scribblings/core.scrbl b/pollen/scribblings/core.scrbl index 870060e..6ec107e 100644 --- a/pollen/scribblings/core.scrbl +++ b/pollen/scribblings/core.scrbl @@ -145,7 +145,7 @@ Note that if @racket[_doc-source] is a relative path or pagenode, it is treated (select-from-metas [key symbolish?] [meta-source (or/c hash? pagenodeish? pathish?)]) -(or/c #f xexpr?)] +any/c] Look up the value of @racket[_key] in @racket[_meta-source]. The @racket[_meta-source] argument can be either 1) a hashtable representing @racket[metas] or 2) a pagenode or source path that identifies a source file that provides @racket[metas]. If no value exists for @racket[_key], you get @racket[#f]. Note that if @racket[_meta-source] is a relative path or pagenode, it is treated as being relative to @racket[current-project-root]. If that's not what you want, you'll need to convert it explicitly to a complete-path (e.g., with @racket[path->complete-path] or @racket[->complete-path]).