`values` instead of `identity`

pull/169/head
Matthew Butterick 7 years ago
parent 8b1f79ba07
commit e10de61aa2

@ -10,10 +10,8 @@
(define is-meta-value? hash?)
(define is-doc-value? txexpr?)
(define identity (λ (x) x))
(define not-false? identity)
(define+provide define-meta identity) ;; stub so it will be picked up for docs
(define+provide define-meta values) ;; stub so it will be picked up for docs
(define+provide current-metas (make-parameter #f))
@ -21,7 +19,7 @@
((coerce/symbol? (or/c is-meta-value? is-doc-value? pagenode? pathish?)) (symbol?) . ->* . (or/c #f txexpr-elements?))
(define metas-result (and (not (is-doc-value? value-source)) (select-from-metas key value-source caller)))
(define doc-result (and (not (is-meta-value? value-source)) (select-from-doc key value-source caller)))
(define result (filter not-false? (apply append (map ->list (list metas-result doc-result)))))
(define result (filter values (apply append (map ->list (list metas-result doc-result)))))
(and (pair? result) result))

@ -21,19 +21,18 @@
[else (list x)]))
(define decode-proc-output-contract (or/c txexpr-element? txexpr-elements?))
(define identity (λ (x) x))
;; decoder wireframe
(define+provide/contract (decode tx-in
#:txexpr-tag-proc [txexpr-tag-proc identity]
#:txexpr-attrs-proc [txexpr-attrs-proc identity]
#:txexpr-elements-proc [txexpr-elements-proc identity]
#:txexpr-proc [txexpr-proc identity]
#:block-txexpr-proc [block-txexpr-proc identity]
#:inline-txexpr-proc [inline-txexpr-proc identity]
#:string-proc [string-proc identity]
#:entity-proc [entity-proc identity]
#:cdata-proc [cdata-proc identity]
#:txexpr-tag-proc [txexpr-tag-proc values]
#:txexpr-attrs-proc [txexpr-attrs-proc values]
#:txexpr-elements-proc [txexpr-elements-proc values]
#:txexpr-proc [txexpr-proc values]
#:block-txexpr-proc [block-txexpr-proc values]
#:inline-txexpr-proc [inline-txexpr-proc values]
#:string-proc [string-proc values]
#:entity-proc [entity-proc values]
#:cdata-proc [cdata-proc values]
#:exclude-tags [excluded-tags empty]
#:exclude-attrs [excluded-attrs empty])
((xexpr/c)
@ -135,7 +134,7 @@
maybe-linebreak-proc
(λ (e1 e2) maybe-linebreak-proc)))
(define elems-vec (list->vector elems))
(filter identity
(filter values
(for/list ([(elem idx) (in-indexed elems-vec)])
(cond
[(or (= idx 0) (= idx (sub1 (vector-length elems-vec)))) elem] ; pass through first & last items

@ -1 +1 @@
1516651656
1516654917

@ -250,12 +250,11 @@
(or (markup-source? path) (markdown-source? path)))
(define identity (λ (x) x))
(define+provide/contract (get-template-for source-path [maybe-output-path #f])
((complete-path?)((or/c #f complete-path?)) . ->* . (or/c #f complete-path?))
(define (file-exists-or-has-source? p) ; p could be #f
(and p (for/first ([proc (in-list (list identity ->preproc-source-path ->null-source-path))]
(and p (for/first ([proc (in-list (list values ->preproc-source-path ->null-source-path))]
#:when (file-exists? (proc p)))
p)))

Loading…
Cancel
Save