update contract

pull/84/head
Matthew Butterick 9 years ago
parent ee1c08260c
commit 9a6176ae58

@ -20,7 +20,7 @@
[(or (list? x) (hash? x) (vector? x)) (format "~v" x)] ; ok to convert datatypes [(or (list? x) (hash? x) (vector? x)) (format "~v" x)] ; ok to convert datatypes
[else (error)])))) ; but things like procedures should throw an error [else (error)])))) ; but things like procedures should throw an error
(define decode-proc-output-contract (or/c xexpr? (non-empty-listof xexpr?))) (define decode-proc-output-contract (or/c xexpr/c (non-empty-listof xexpr/c)))
(define (->list/tx x) (define (->list/tx x)
@ -54,7 +54,7 @@
#:entity-proc ((or/c symbol? valid-char?) . -> . decode-proc-output-contract) #:entity-proc ((or/c symbol? valid-char?) . -> . decode-proc-output-contract)
#:cdata-proc (cdata? . -> . decode-proc-output-contract) #:cdata-proc (cdata? . -> . decode-proc-output-contract)
#:exclude-tags (listof txexpr-tag?) #:exclude-tags (listof txexpr-tag?)
#:exclude-attrs txexpr-attrs?) . ->* . txexpr?) #:exclude-attrs txexpr-attrs?) . ->* . (or/c xexpr/c (non-empty-listof xexpr/c)))
(let loop ([x tx-in]) (let loop ([x tx-in])
(cond (cond
[(txexpr? x) (let-values([(tag attrs elements) (txexpr->values x)]) [(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) #:entity-proc ((or/c symbol? valid-char?) . -> . decode-proc-output-contract)
#:cdata-proc (cdata? . -> . decode-proc-output-contract) #:cdata-proc (cdata? . -> . decode-proc-output-contract)
#:exclude-tags (listof txexpr-tag?) #:exclude-tags (listof txexpr-tag?)
#:exclude-attrs txexpr-attrs?) . ->* . txexpr?) #:exclude-attrs txexpr-attrs?) . ->* . (or/c xexpr/c (non-empty-listof xexpr/c)))
(define temp-tag (gensym "temp-tag")) (define temp-tag (gensym "temp-tag"))
(define decode-result (decode `(temp-tag ,@elements) (define decode-result (decode `(temp-tag ,@elements)

@ -36,7 +36,7 @@ Another example is conversion of output into a particular data format. Most Poll
[#:exclude-tags tags-to-exclude (listof txexpr-tag?) null] [#:exclude-tags tags-to-exclude (listof txexpr-tag?) null]
[#:exclude-attrs attrs-to-exclude txexpr-attrs? null] [#:exclude-attrs attrs-to-exclude txexpr-attrs? null]
) )
txexpr?] (or/c xexpr/c (non-empty-listof xexpr/c))]
Recursively process a @racket[_tagged-xexpr], usually the one exported from a Pollen source file as @racket[doc]. 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. This function doesn't do much on its own. Rather, it provides the hooks upon which harder-working functions can be hung.
@ -231,7 +231,7 @@ Finally, the @racket[_attrs-to-exclude] argument works the same way as @racket[_
[#:exclude-tags tags-to-exclude (listof txexpr-tag?) null] [#:exclude-tags tags-to-exclude (listof txexpr-tag?) null]
[#:exclude-attrs attrs-to-exclude txexpr-attrs? null] [#:exclude-attrs attrs-to-exclude txexpr-attrs? null]
) )
txexpr-elements?] (or/c xexpr/c (non-empty-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. 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} @section{Block}

Loading…
Cancel
Save