improve layout of proc defns by using tables less

svn: r6624
This commit is contained in:
Matthew Flatt 2007-06-13 03:35:47 +00:00
parent 7ffec913dd
commit 6b5c0ed0d9
5 changed files with 77 additions and 66 deletions

View File

@ -294,7 +294,13 @@
(syntax-rules () (syntax-rules ()
[(_ id) (*var 'id)])) [(_ id) (*var 'id)]))
(define (make-table-if-necessary style content)
(if (= 1 (length content))
(let ([paras (apply append (map flow-paragraphs (car content)))])
(if (andmap paragraph? paras)
(list (make-paragraph (apply append (map paragraph-content paras))))
(list (make-table style content))))
(list (make-table style content))))
(define (*defproc prototypes arg-contractss result-contracts content-thunk) (define (*defproc prototypes arg-contractss result-contracts content-thunk)
(let ([spacer (hspace 1)] (let ([spacer (hspace 1)]
@ -336,8 +342,7 @@
(append (append
(list (list
(list (make-flow (list (make-flow
(list (make-table-if-necessary
(make-table
"prototype" "prototype"
(list (list
(list (list
@ -373,7 +378,7 @@
(to-flow spacer) (to-flow spacer)
(to-flow 'rarr) (to-flow 'rarr)
(to-flow spacer) (to-flow spacer)
(make-flow (list (result-contract)))))))))) (make-flow (list (result-contract)))))))))
(apply append (apply append
(map (lambda (v arg-contract) (map (lambda (v arg-contract)
(cond (cond
@ -381,8 +386,7 @@
(list (list
(list (list
(make-flow (make-flow
(list (make-table-if-necessary
(make-table
"argcontract" "argcontract"
(list (list
(let ([v (if (keyword? (car v)) (let ([v (if (keyword? (car v))
@ -401,7 +405,7 @@
(to-flow "=") (to-flow "=")
(to-flow spacer) (to-flow spacer)
(to-flow (to-element (caddr v)))) (to-flow (to-element (caddr v))))
null)))))))))] null))))))))]
[else null])) [else null]))
(cdr prototype) (cdr prototype)
arg-contracts)))) arg-contracts))))

View File

@ -405,7 +405,9 @@
(unless (null? content) (unless (null? content)
(finish-line!)) (finish-line!))
(if multi-line? (if multi-line?
(make-table "schemeblock" (map list (reverse docs))) (if (= 1 (length docs))
(car (flow-paragraphs (car docs)))
(make-table "schemeblock" (map list (reverse docs))))
(make-sized-element #f (reverse content) dest-col)))) (make-sized-element #f (reverse content) dest-col))))
(define (to-element c) (define (to-element c)

View File

@ -9,6 +9,11 @@
margin-right: auto; margin-right: auto;
} }
table td {
padding-left: 0;
padding-right: 0;
}
.main { .main {
width: 35em; width: 35em;
text-align: left; text-align: left;
@ -147,7 +152,7 @@
} }
.prototype td { .prototype td {
vertical-align: baseline; vertical-align: top;
} }
.schemeblock td { .schemeblock td {
@ -155,7 +160,7 @@
} }
.argcontract td { .argcontract td {
vertical-align: baseline; vertical-align: top;
} }
.centered { .centered {

View File

@ -92,8 +92,8 @@ positions are initialized with the given @scheme[b]s.
@defproc[(subbytes [bstr bytes?] [start exact-nonnegative-integer?] @defproc[(subbytes [bstr bytes?] [start exact-nonnegative-integer?]
[end exact-nonnegative-integer? (bytes-length str)]) bytes?]{ [end exact-nonnegative-integer? (bytes-length str)]) bytes?]{
Returns a new mutable byte string that is @scheme[(- @scheme[end] Returns a new mutable byte string that is @scheme[(- end start)]
@scheme[start])] bytes long, and that contains the same bytes bytes long, and that contains the same bytes
as @scheme[bstr] from @scheme[start] inclusive to @scheme[end] exclusive. The as @scheme[bstr] from @scheme[start] inclusive to @scheme[end] exclusive. The
@scheme[start] and @scheme[end] arguments must be less than the length of @scheme[start] and @scheme[end] arguments must be less than the length of
@scheme[bstr], and @scheme[end] must be greater than or equal to @scheme[bstr], @scheme[bstr], and @scheme[end] must be greater than or equal to @scheme[bstr],

View File

@ -85,8 +85,8 @@ Returns an immutable string with the same content as
@defproc[(substring [str string?] [start exact-nonnegative-integer?] @defproc[(substring [str string?] [start exact-nonnegative-integer?]
[end exact-nonnegative-integer? (string-length str)]) string?]{ [end exact-nonnegative-integer? (string-length str)]) string?]{
Returns a new mutable string that is @scheme[(- @scheme[end] Returns a new mutable string that is @scheme[(- end start)]
@scheme[start])] characters long, and that contains the same characters characters long, and that contains the same characters
as @scheme[str] from @scheme[start] inclusive to @scheme[end] exclusive. The as @scheme[str] from @scheme[start] inclusive to @scheme[end] exclusive. The
@scheme[start] and @scheme[end] arguments must be less than the length of @scheme[start] and @scheme[end] arguments must be less than the length of
@scheme[str], and @scheme[end] must be greater than or equal to @scheme[str], @scheme[str], and @scheme[end] must be greater than or equal to @scheme[str],