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 ()
[(_ 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)
(let ([spacer (hspace 1)]
@ -336,8 +342,7 @@
(append
(list
(list (make-flow
(list
(make-table
(make-table-if-necessary
"prototype"
(list
(list
@ -373,7 +378,7 @@
(to-flow spacer)
(to-flow 'rarr)
(to-flow spacer)
(make-flow (list (result-contract))))))))))
(make-flow (list (result-contract)))))))))
(apply append
(map (lambda (v arg-contract)
(cond
@ -381,8 +386,7 @@
(list
(list
(make-flow
(list
(make-table
(make-table-if-necessary
"argcontract"
(list
(let ([v (if (keyword? (car v))
@ -401,7 +405,7 @@
(to-flow "=")
(to-flow spacer)
(to-flow (to-element (caddr v))))
null)))))))))]
null))))))))]
[else null]))
(cdr prototype)
arg-contracts))))

View File

@ -405,7 +405,9 @@
(unless (null? content)
(finish-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))))
(define (to-element c)

View File

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

View File

@ -92,8 +92,8 @@ positions are initialized with the given @scheme[b]s.
@defproc[(subbytes [bstr bytes?] [start exact-nonnegative-integer?]
[end exact-nonnegative-integer? (bytes-length str)]) bytes?]{
Returns a new mutable byte string that is @scheme[(- @scheme[end]
@scheme[start])] bytes long, and that contains the same bytes
Returns a new mutable byte string that is @scheme[(- end start)]
bytes long, and that contains the same bytes
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[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?]
[end exact-nonnegative-integer? (string-length str)]) string?]{
Returns a new mutable string that is @scheme[(- @scheme[end]
@scheme[start])] characters long, and that contains the same characters
Returns a new mutable string that is @scheme[(- end start)]
characters long, and that contains the same characters
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[str], and @scheme[end] must be greater than or equal to @scheme[str],