From fd1bb626d68a7a7ac963d92a9f043484fe18d9f9 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 12 Mar 2009 00:59:54 +0000 Subject: [PATCH] fix grammar alignment; allow row-independent 'alignment and 'valignment associations in a table style svn: r14063 original commit: e43b393253ff65b3aeb8d2a49e4dbcbb04341e9c --- collects/scribble/html-render.ss | 2 ++ collects/scribble/latex-render.ss | 7 +++++-- collects/scribblings/scribble/struct.scrbl | 16 +++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/collects/scribble/html-render.ss b/collects/scribble/html-render.ss index bef2a263..d2d904f5 100644 --- a/collects/scribble/html-render.ss +++ b/collects/scribble/html-render.ss @@ -1052,8 +1052,10 @@ `(tr (,@(if (string? style) `([class ,style]) null)) ,@(let loop ([ds flows] [as (cdr (or (and (list? style) (assq 'alignment style)) + (t-style-get 'alignment) (cons #f (map (lambda (x) #f) flows))))] [vas (cdr (or (and (list? style) (assq 'valignment style)) + (t-style-get 'valignment) (cons #f (map (lambda (x) #f) flows))))] [sts (cdr (or (and (list? style) (assq 'style style)) (cons #f (map (lambda (x) #f) flows))))] diff --git a/collects/scribble/latex-render.ss b/collects/scribble/latex-render.ss index 8a17f772..4399ddd8 100644 --- a/collects/scribble/latex-render.ss +++ b/collects/scribble/latex-render.ss @@ -303,8 +303,11 @@ [row-style (car row-styles)]) (let loop ([flows flows] [col-v-styles (and (list? row-style) - (let ([p (assoc 'valignment row-style)]) - (and p (cdr p))))]) + (or (let ([p (assoc 'valignment row-style)]) + (and p (cdr p))) + (let ([p (and (list? (table-style t)) + (assoc 'valignment (table-style t)))]) + (and p (cdr p)))))]) (unless (null? flows) (when index? (printf "\\item ")) (unless (eq? 'cont (car flows)) diff --git a/collects/scribblings/scribble/struct.scrbl b/collects/scribblings/scribble/struct.scrbl index c220fbd3..5809ba0b 100644 --- a/collects/scribblings/scribble/struct.scrbl +++ b/collects/scribblings/scribble/struct.scrbl @@ -420,6 +420,14 @@ The @scheme[style] can be any of the following: @item{@scheme['style] to a string for a CSS class for HTML output.} + @item{@scheme['alignment] to a list of symbols and + @scheme[#f]s (one for each column); each symbol can be + @scheme['left], @scheme['right], or @scheme['center].} + + @item{@scheme['valignment] to a list of symbols and + @scheme[#f]s (one for each column); each symbol can be + @scheme['top], @scheme['baseline], or @scheme['bottom].} + @item{@scheme['row-styles] to a list of association lists, one for each row in the table. Each of these nested association lists can map @scheme['alignment] and @@ -427,11 +435,9 @@ The @scheme[style] can be any of the following: @scheme[#f]s (one for each column cell) and/or @scheme['style] to a list of strings and @scheme[#f]s (one for each column cell) for a CSS class in HTML - output. The symbols in an @scheme['alignment] list can - be @scheme['left], @scheme['right], or - @scheme['center]. The symbols in a @scheme['valignment] - list can be @scheme['top], @scheme['baseline], or - @scheme['bottom].} + output. Row-specific @scheme['valignment] and + @scheme['alignment] associations override row-independent + associations.} ]}