scribble/manual: add `current-display-width' parameter

This commit is contained in:
Matthew Flatt 2011-08-08 17:07:43 -06:00
parent c908e08dd6
commit f34c0329bf
4 changed files with 15 additions and 4 deletions

View File

@ -11,11 +11,13 @@
"private/manual-class.rkt"
"private/manual-unit.rkt"
"private/manual-vars.rkt"
"private/manual-bind.rkt")
"private/manual-bind.rkt"
"private/manual-utils.rkt")
(provide unsyntax
make-binding-redirect-elements
defidentifier
current-display-width
(all-from-out "base.rkt"
"private/manual-style.rkt"
"private/manual-scheme.rkt"

View File

@ -140,6 +140,7 @@
(define (*defproc mode within-id
stx-ids prototypes arg-contractss arg-valss result-contracts
content-thunk)
(define max-proto-width (current-display-width))
(define ((arg->elem show-opt-start?) arg)
(let* ([e (cond [(not (arg-special? arg))
(if (arg-kw arg)
@ -561,6 +562,7 @@
(define (*defstruct stx-id name alt-cname-id extra-cname?
fields field-contracts immutable? transparent? prefab?
content-thunk)
(define max-proto-width (current-display-width))
(define (field-name f) ((if (pair? (car f)) caar car) f))
(define (field-view f)
(if (pair? (car f)) (make-shaped-parens (car f) #\[) (car f)))

View File

@ -14,7 +14,7 @@
[flow-spacer flow?]
[flow-empty-line flow?]
[make-table-if-necessary (content? list? . -> . (list/c (or/c omitable-paragraph? table?)))]
[max-proto-width exact-nonnegative-integer?])
[current-display-width (parameter/c exact-nonnegative-integer?)])
(define spacer (hspace 1))
@ -31,4 +31,4 @@
(list (make-table style content))))
(list (make-table style content))))
(define max-proto-width 65)
(define current-display-width (make-parameter 65))

View File

@ -620,7 +620,9 @@ description, references to @svar[arg-id]s using @racket[racket],
The typesetting of all information before the @racket[pre-flow]s
ignores the source layout, except that the local formatting is
preserved for contracts and default-values expressions.}
preserved for contracts and default-values expressions. The information
is formatted to fit (if possible) in the number of characters specified
by the @racket[current-display-width] parameter.}
@defform[(defproc* ([prototype
@ -881,6 +883,11 @@ the mouse hovers over the identifier).}
Compatibility aliases for @racket[racketgrammar] and @racket[racketgrammar*].}
@defparam[current-display-width w exact-nonnegative-integer?]{
Specifies the target maximum width in characters for the output of
@racket[defproc] and @racket[defstruct].}
@; ------------------------------------------------------------------------
@section[#:tag "doc-classes"]{Documenting Classes and Interfaces}