diff --git a/decode.rkt b/decode.rkt index 7dd7054..2a188e0 100644 --- a/decode.rkt +++ b/decode.rkt @@ -20,7 +20,7 @@ [(or (list? x) (hash? x) (vector? x)) (format "~v" x)] ; ok to convert datatypes [else (error)])))) ; but things like procedures should throw an error -(define decode-proc-output-contract (or/c xexpr/c (non-empty-listof xexpr/c))) +(define decode-proc-output-contract (or/c xexpr/c (listof xexpr/c))) (define (->list/tx x) @@ -54,7 +54,7 @@ #:entity-proc ((or/c symbol? valid-char?) . -> . decode-proc-output-contract) #:cdata-proc (cdata? . -> . decode-proc-output-contract) #:exclude-tags (listof txexpr-tag?) - #:exclude-attrs txexpr-attrs?) . ->* . (or/c xexpr/c (non-empty-listof xexpr/c))) + #:exclude-attrs txexpr-attrs?) . ->* . (or/c xexpr/c (listof xexpr/c))) (let loop ([x tx-in]) (cond [(txexpr? x) (let-values([(tag attrs elements) (txexpr->values x)]) @@ -120,7 +120,7 @@ #:entity-proc ((or/c symbol? valid-char?) . -> . decode-proc-output-contract) #:cdata-proc (cdata? . -> . decode-proc-output-contract) #:exclude-tags (listof txexpr-tag?) - #:exclude-attrs txexpr-attrs?) . ->* . (or/c xexpr/c (non-empty-listof xexpr/c))) + #:exclude-attrs txexpr-attrs?) . ->* . (or/c xexpr/c (listof xexpr/c))) (define temp-tag (gensym "temp-tag")) (define decode-result (decode `(temp-tag ,@elements) diff --git a/scribblings/decode.scrbl b/scribblings/decode.scrbl index cd27e1d..141f84e 100644 --- a/scribblings/decode.scrbl +++ b/scribblings/decode.scrbl @@ -28,15 +28,15 @@ Another example is conversion of output into a particular data format. Most Poll [#:txexpr-tag-proc txexpr-tag-proc (txexpr-tag? . -> . txexpr-tag?) (λ(tag) tag)] [#:txexpr-attrs-proc txexpr-attrs-proc (txexpr-attrs? . -> . txexpr-attrs?) (λ(attrs) attrs)] [#:txexpr-elements-proc txexpr-elements-proc (txexpr-elements? . -> . txexpr-elements?) (λ(elements) elements)] -[#:block-txexpr-proc block-txexpr-proc (block-txexpr? . -> . (or/c xexpr? (non-empty-listof xexpr?))) (λ(tx) tx)] -[#:inline-txexpr-proc inline-txexpr-proc (txexpr? . -> . (or/c xexpr? (non-empty-listof xexpr?))) (λ(tx) tx)] -[#:string-proc string-proc (string? . -> . (or/c xexpr? (non-empty-listof xexpr?))) (λ(str) str)] -[#:entity-proc entity-proc ((or/c symbol? valid-char?) . -> . (or/c xexpr? (non-empty-listof xexpr?))) (λ(ent) ent)] -[#:cdata-proc cdata-proc (cdata? . -> . (or/c xexpr? (non-empty-listof xexpr?))) (λ(cdata) cdata)] +[#:block-txexpr-proc block-txexpr-proc (block-txexpr? . -> . (or/c xexpr? (listof xexpr?))) (λ(tx) tx)] +[#:inline-txexpr-proc inline-txexpr-proc (txexpr? . -> . (or/c xexpr? (listof xexpr?))) (λ(tx) tx)] +[#:string-proc string-proc (string? . -> . (or/c xexpr? (listof xexpr?))) (λ(str) str)] +[#:entity-proc entity-proc ((or/c symbol? valid-char?) . -> . (or/c xexpr? (listof xexpr?))) (λ(ent) ent)] +[#:cdata-proc cdata-proc (cdata? . -> . (or/c xexpr? (listof xexpr?))) (λ(cdata) cdata)] [#:exclude-tags tags-to-exclude (listof txexpr-tag?) null] [#:exclude-attrs attrs-to-exclude txexpr-attrs? null] ) -(or/c xexpr/c (non-empty-listof xexpr/c))] +(or/c xexpr/c (listof xexpr/c))] Recursively process a @racket[_tagged-xexpr], usually the one exported from a Pollen source file as @racket[doc]. This function doesn't do much on its own. Rather, it provides the hooks upon which harder-working functions can be hung. @@ -223,15 +223,15 @@ Finally, the @racket[_attrs-to-exclude] argument works the same way as @racket[_ [#:txexpr-tag-proc txexpr-tag-proc (txexpr-tag? . -> . txexpr-tag?) (λ(tag) tag)] [#:txexpr-attrs-proc txexpr-attrs-proc (txexpr-attrs? . -> . txexpr-attrs?) (λ(attrs) attrs)] [#:txexpr-elements-proc txexpr-elements-proc (txexpr-elements? . -> . txexpr-elements?) (λ(elements) elements)] -[#:block-txexpr-proc block-txexpr-proc (block-txexpr? . -> . (or/c xexpr? (non-empty-listof xexpr?))) (λ(tx) tx)] -[#:inline-txexpr-proc inline-txexpr-proc (txexpr? . -> . (or/c xexpr? (non-empty-listof xexpr?))) (λ(tx) tx)] -[#:string-proc string-proc (string? . -> . (or/c xexpr? (non-empty-listof xexpr?))) (λ(str) str)] -[#:entity-proc entity-proc ((or/c symbol? valid-char?) . -> . (or/c xexpr? (non-empty-listof xexpr?))) (λ(ent) ent)] -[#:cdata-proc cdata-proc (cdata? . -> . (or/c xexpr? (non-empty-listof xexpr?))) (λ(cdata) cdata)] +[#:block-txexpr-proc block-txexpr-proc (block-txexpr? . -> . (or/c xexpr? (listof xexpr?))) (λ(tx) tx)] +[#:inline-txexpr-proc inline-txexpr-proc (txexpr? . -> . (or/c xexpr? (listof xexpr?))) (λ(tx) tx)] +[#:string-proc string-proc (string? . -> . (or/c xexpr? (listof xexpr?))) (λ(str) str)] +[#:entity-proc entity-proc ((or/c symbol? valid-char?) . -> . (or/c xexpr? (listof xexpr?))) (λ(ent) ent)] +[#:cdata-proc cdata-proc (cdata? . -> . (or/c xexpr? (listof xexpr?))) (λ(cdata) cdata)] [#:exclude-tags tags-to-exclude (listof txexpr-tag?) null] [#:exclude-attrs attrs-to-exclude txexpr-attrs? null] ) -(or/c xexpr/c (non-empty-listof xexpr/c))] +(or/c xexpr/c (listof xexpr/c))] Identical to @racket[decode], but takes @racket[txexpr-elements?] as input rather than a whole tagged X-expression, and likewise returns @racket[txexpr-elements?] rather than a tagged X-expression. A convenience variant for use inside tag functions. @section{Block}