tabular: add #:sep-properties
Also, correct the documentation about the interaction of `#:sep` and property lists, and make the previous column's properties used consistently for a separator column.
This commit is contained in:
parent
9c5a45985b
commit
00739632cf
|
@ -261,7 +261,8 @@ Returns @racket[#t] if @racket[v] is an item produced by
|
||||||
[#:sep sep (or/c block? content? #f) #f]
|
[#:sep sep (or/c block? content? #f) #f]
|
||||||
[#:column-properties column-properties (listof any/c) '()]
|
[#:column-properties column-properties (listof any/c) '()]
|
||||||
[#:row-properties row-properties (listof any/c) '()]
|
[#:row-properties row-properties (listof any/c) '()]
|
||||||
[#:cell-properties cell-properties (listof (listof any/c)) '()])
|
[#:cell-properties cell-properties (listof (listof any/c)) '()]
|
||||||
|
[#:sep-properties sep-properties (or/c list? #f) #f])
|
||||||
table?]{
|
table?]{
|
||||||
|
|
||||||
Creates a @tech{table} with the given @racket[cells] content, which is
|
Creates a @tech{table} with the given @racket[cells] content, which is
|
||||||
|
@ -276,11 +277,11 @@ cell in a row.
|
||||||
The @racket[style] argument is handled the same as @racket[para].
|
The @racket[style] argument is handled the same as @racket[para].
|
||||||
See @racket[table] for a list of recognized @tech{style names} and @tech{style properties}.
|
See @racket[table] for a list of recognized @tech{style names} and @tech{style properties}.
|
||||||
|
|
||||||
If @racket[sep] is not @racket[#f], it is inserted as a new column
|
The default style places no space between table columns. If
|
||||||
between every column in the table; note that any
|
@racket[sep] is not @racket[#f], it is inserted as a new column
|
||||||
@racket[table-columns] or @racket[table-cells] property in
|
between every column in the table; the new column's properties are the
|
||||||
@racket[style] must take the added columns into account. Otherwise,
|
same as the preceding column's, unless @racket[sep-properties]
|
||||||
the default style places no space between table columns. When @racket[sep]
|
provides a list of @tech{style properties} to use. When @racket[sep]
|
||||||
would be placed before a @racket['cont], a @racket['cont] is inserted,
|
would be placed before a @racket['cont], a @racket['cont] is inserted,
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
|
@ -343,7 +344,10 @@ properties will be used from the merger into @racket[table-cells].}
|
||||||
@racket[#:row-properties],
|
@racket[#:row-properties],
|
||||||
and @racket[#:cell-properties] arguments.}
|
and @racket[#:cell-properties] arguments.}
|
||||||
#:changed "1.12" @elem{Changed @racket[sep] insertion before a
|
#:changed "1.12" @elem{Changed @racket[sep] insertion before a
|
||||||
@racket['cont].}]
|
@racket['cont].}
|
||||||
|
#:changed "1.28" @elem{Added @racket[sep-properties] and made
|
||||||
|
the preceding column's properties used
|
||||||
|
consistently if not specified.}]
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
@codeblock[#:keep-lang-line? #f]|{
|
@codeblock[#:keep-lang-line? #f]|{
|
||||||
|
|
|
@ -23,4 +23,4 @@
|
||||||
|
|
||||||
(define pkg-authors '(mflatt eli))
|
(define pkg-authors '(mflatt eli))
|
||||||
|
|
||||||
(define version "1.27")
|
(define version "1.28")
|
||||||
|
|
|
@ -329,7 +329,8 @@
|
||||||
#:sep (or/c content? block? #f)
|
#:sep (or/c content? block? #f)
|
||||||
#:column-properties (listof any/c)
|
#:column-properties (listof any/c)
|
||||||
#:row-properties (listof any/c)
|
#:row-properties (listof any/c)
|
||||||
#:cell-properties (listof (listof any/c)))
|
#:cell-properties (listof (listof any/c))
|
||||||
|
#:sep-properties (or/c list? #f))
|
||||||
table?)])
|
table?)])
|
||||||
|
|
||||||
(define (convert-block-style style)
|
(define (convert-block-style style)
|
||||||
|
@ -352,6 +353,7 @@
|
||||||
|
|
||||||
(define (tabular #:style [style #f]
|
(define (tabular #:style [style #f]
|
||||||
#:sep [sep #f]
|
#:sep [sep #f]
|
||||||
|
#:sep-properties [sep-props #f]
|
||||||
#:column-properties [column-properties null]
|
#:column-properties [column-properties null]
|
||||||
#:row-properties [row-properties null]
|
#:row-properties [row-properties null]
|
||||||
#:cell-properties [cell-properties null]
|
#:cell-properties [cell-properties null]
|
||||||
|
@ -426,7 +428,7 @@
|
||||||
[(null? column-properties)
|
[(null? column-properties)
|
||||||
(if (or (zero? n) (not sep))
|
(if (or (zero? n) (not sep))
|
||||||
(cons prev (loop null (add1 n) prev))
|
(cons prev (loop null (add1 n) prev))
|
||||||
(list* prev prev (loop null (+ n 2) prev)))]
|
(list* (or sep-props prev) prev (loop null (+ n 2) prev)))]
|
||||||
[else
|
[else
|
||||||
(define (to-list v) (if (list? v) v (list v)))
|
(define (to-list v) (if (list? v) v (list v)))
|
||||||
(define props (to-list (car column-properties)))
|
(define props (to-list (car column-properties)))
|
||||||
|
@ -437,7 +439,7 @@
|
||||||
props))
|
props))
|
||||||
(if (or (zero? n) (not sep))
|
(if (or (zero? n) (not sep))
|
||||||
(cons props rest)
|
(cons props rest)
|
||||||
(list* null props rest))])))
|
(list* (or sep-props prev) props rest))])))
|
||||||
(define full-column-properties
|
(define full-column-properties
|
||||||
(make-full-column-properties column-properties))
|
(make-full-column-properties column-properties))
|
||||||
(define (make-full-cell-properties cell-properties)
|
(define (make-full-cell-properties cell-properties)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user