add column-attributes' support and use it to fix
struct' rendering
original commit: ad7fddf878f0cb288adcb72a3fadc7e2644ce54f
This commit is contained in:
parent
db4d7c9add
commit
6f4f63d692
|
@ -14,4 +14,5 @@
|
|||
|
||||
[url-anchor ([name string?])]
|
||||
[alt-tag ([name (and/c string? #rx"^[a-zA-Z0-9]+$")])]
|
||||
[attributes ([assoc (listof (cons/c symbol? string?))])])
|
||||
[attributes ([assoc (listof (cons/c symbol? string?))])]
|
||||
[column-attributes ([assoc (listof (cons/c symbol? string?))])])
|
||||
|
|
|
@ -1264,6 +1264,21 @@
|
|||
[(centered) '([align "center"])]
|
||||
[else '()])
|
||||
,@(style->attribs (table-style t)))
|
||||
,@(let ([columns (ormap (lambda (p)
|
||||
(and (table-columns? p)
|
||||
(map (lambda (s)
|
||||
(ormap (lambda (a)
|
||||
(and (column-attributes? a)
|
||||
a))
|
||||
(style-properties s)))
|
||||
(table-columns-styles p))))
|
||||
(style-properties (table-style t)))])
|
||||
(if (and columns (ormap values columns))
|
||||
`((colgroup ,@(for/list ([col (in-list columns)])
|
||||
`(col ,(if col
|
||||
(map (lambda (v) (list (car v) (cdr v))) (column-attributes-assoc col))
|
||||
null)))))
|
||||
null))
|
||||
,@(if (null? (table-blockss t))
|
||||
`((tr (td)))
|
||||
(map make-row
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
"../search.rkt"
|
||||
"../basic.rkt"
|
||||
"../manual-struct.rkt"
|
||||
(only-in "../core.rkt"
|
||||
make-style make-table-columns)
|
||||
"../html-properties.rkt"
|
||||
"qsloc.rkt"
|
||||
"manual-utils.rkt"
|
||||
"manual-vars.rkt"
|
||||
|
@ -655,7 +658,15 @@
|
|||
(list flow-spacer flow-spacer c)
|
||||
(list flow-spacer flow-spacer c 'cont 'cont)))])
|
||||
(make-table
|
||||
#f
|
||||
(if one-right-column?
|
||||
#f
|
||||
;; Shift all extra width to last column:
|
||||
(make-style #f (list
|
||||
(make-table-columns
|
||||
(for/list ([i 5])
|
||||
(if (i . < . 4)
|
||||
(make-style #f (list (column-attributes '((width . "0*")))))
|
||||
(make-style #f null)))))))
|
||||
(append
|
||||
(list
|
||||
(append
|
||||
|
@ -676,10 +687,10 @@
|
|||
(not cname-id))
|
||||
(list (racketparenfont ")"))
|
||||
null)))))
|
||||
(list (to-flow the-name)
|
||||
(list (to-flow (make-element 'no-break the-name))
|
||||
(to-flow (make-element
|
||||
#f (list spacer (racketparenfont "("))))
|
||||
(to-flow (to-element (field-view (car fields))))))))
|
||||
(to-flow (make-element 'no-break (to-element (field-view (car fields)))))))))
|
||||
(if (short-width . < . max-proto-width)
|
||||
null
|
||||
(let loop ([fields (if (null? fields)
|
||||
|
|
|
@ -483,8 +483,9 @@ The following @tech{style properties} are currently recognized:
|
|||
@itemize[
|
||||
|
||||
@item{@racket[table-columns] structure --- Provides column-specific
|
||||
styles, but only if a @racket[table-cells] structure is not
|
||||
included as a @tech{style property}.}
|
||||
styles, but only @racket[column-attributes] properties (if any)
|
||||
are used if a @racket[table-cells] structure is included as a
|
||||
@tech{style property}.}
|
||||
|
||||
@item{@racket[table-cells] structure --- Provides cell-specific
|
||||
styles.}
|
||||
|
@ -1009,9 +1010,18 @@ In addition, for HTML output, @racket[attributes] structures as
|
|||
|
||||
@defstruct[table-columns ([styles (listof style?)])]{
|
||||
|
||||
Like @racket[table-cells], but the @racket[styles] list is duplicated
|
||||
for each row in the table. This @tech{style property} is used only when a
|
||||
@racket[table-cells] is not present in a style's list of properties.}
|
||||
Like @racket[table-cells], but with support for a
|
||||
@racket[column-attributes] property in each style, and the
|
||||
@racket[styles] list is otherwise duplicated for each row in the
|
||||
table. The non-@racket[column-attributes] parts of a
|
||||
@racket[table-columns] are used only when a @racket[table-cells] property is
|
||||
not present along with the @racket[table-columns] property.
|
||||
|
||||
For HTML table rendering, for each column that has a
|
||||
@racket[column-attributes] property in the corresponding element of
|
||||
@racket[styles], the attributes are put into an HTML @tt{col} tag
|
||||
within the table.}
|
||||
|
||||
|
||||
@deftogether[(
|
||||
@defstruct[box-mode ([top-name string?]
|
||||
|
@ -1302,6 +1312,7 @@ Defined as
|
|||
Used as a @tech{style property} to add arbitrary attributes to an HTML
|
||||
tag.}
|
||||
|
||||
|
||||
@defstruct[alt-tag ([name (and/c string? #rx"^[a-zA-Z0-9]+$")])]{
|
||||
|
||||
Use as a @tech{style property} for an @racket[element],
|
||||
|
@ -1310,6 +1321,12 @@ alternate HTML tag (instead of @tt{<span>}, @tt{<p>}, @tt{div},
|
|||
@|etc|).}
|
||||
|
||||
|
||||
@defstruct[column-attributes ([assoc (listof (cons/c symbol? string?))])]{
|
||||
|
||||
Used as a @tech{style property} on a style with @racket[table-columns]
|
||||
to add arbitrary attributes to an HTML @tt{col} tag within the table.}
|
||||
|
||||
|
||||
@defstruct[url-anchor ([name string?])]{
|
||||
|
||||
Used as a @tech{style property} with @racket[element] to insert an
|
||||
|
|
Loading…
Reference in New Issue
Block a user