git.iko.soy/typeable/pandoc
on master help sign in
Better looking simple tables. Resolves Issue #180.

* Markdown reader: simple tables are now given column widths of 0. * Column width of 0 is interpreted as meaning: use default column width. * Writers now include explicit column width information only for multiline tables. (Exception: RTF writer, which requires column widths. In this case, columns are given equal widths, adding up to the text width.) * Simple tables should now look better in most output formats. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1631 788f1e2b-df1e-0410-8736-df70ead52e1b

commit98ff6b2fd06288598a7acf1f19b84418db47e6db authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> dateSat 28 Nov 2009, 03:22 (17 years ago) parent7c6467a
23 files changed+214−208
README+13−13 src/Text/Pandoc/Definition.hs+3−3 src/Text/Pandoc/Readers/Markdown.hs+4−1 src/Text/Pandoc/Writers/ConTeXt.hs+4−6 src/Text/Pandoc/Writers/LaTeX.hs+17−11 src/Text/Pandoc/Writers/Man.hs+3−1 src/Text/Pandoc/Writers/Markdown.hs+11−7 src/Text/Pandoc/Writers/OpenDocument.hs+5−3 src/Text/Pandoc/Writers/RST.hs+8−2 src/Text/Pandoc/Writers/RTF.hs+6−3 src/Text/Pandoc/Writers/Texinfo.hs+10−4 tests/tables.context+3−3 tests/tables.docbook+12−12 tests/tables.html+12−12 tests/tables.latex+3−3 tests/tables.man+3−3 tests/tables.markdown+15−15 tests/tables.mediawiki+12−12 tests/tables.native+3−3 tests/tables.opendocument+25−49 tests/tables.rst+27−27 tests/tables.rtf+12−12 tests/tables.texinfo+3−3
README+13−13
@@ -664,11 +664,11 @@ a fixed-width font, such as Courier.
664664
665665Simple tables look like this:
666666
667− Right Left Center Default
668− ------- ------ ---------- -------
669− 12 12 12 12
670− 123 123 123 123
671− 1 1 1 1
667+ Right Left Center Default
668+ ------- ------ ---------- -------
669+ 12 12 12 12
670+ 123 123 123 123
671+ 1 1 1 1
672672
673673 Table: Demonstration of simple table syntax.
674674
@@ -692,11 +692,6 @@ The table must end with a blank line. Optionally, a caption may be
692692provided (as illustrated in the example above). A caption is a paragraph
693693beginning with the string `Table:`, which will be stripped off.
694694
695−The table parser pays attention to the widths of the columns, and
696−the writers try to reproduce these relative widths in the output.
697−So, if you find that one of the columns is too narrow in the output,
698−try widening it in the markdown source.
699−
700695Multiline tables allow headers and table rows to span multiple lines
701696of text. Here is an example:
702697
@@ -706,12 +701,12 @@ of text. Here is an example:
706701 ----------- ------- --------------- -------------------------
707702 First row 12.0 Example of a row that
708703 spans multiple lines.
709−
704+
710705 Second row 5.0 Here's another one. Note
711706 the blank line between
712707 rows.
713708 -------------------------------------------------------------
714−
709+
715710 Table: Here's the caption. It, too, may span
716711 multiple lines.
717712
@@ -719,7 +714,12 @@ These work like simple tables, but with the following differences:
719714
720715 - They must begin with a row of dashes, before the header text.
721716 - They must end with a row of dashes, then a blank line.
722− - The rows must be separated by blank lines.
717+ - The rows must be separated by blank lines.
718+
719+In multiline tables, the table parser pays attention to the widths of
720+the columns, and the writers try to reproduce these relative widths in
721+the output. So, if you find that one of the columns is too narrow in the
722+output, try widening it in the markdown source.
723723
724724Delimited Code blocks
725725---------------------
src/Text/Pandoc/Definition.hs+3−3
@@ -86,9 +86,9 @@ data Block
8686 | HorizontalRule -- ^ Horizontal rule
8787 | Table [Inline] [Alignment] [Double] [[Block]] [[[Block]]] -- ^ Table,
8888 -- with caption, column alignments,
89− -- relative column widths, column headers
90− -- (each a list of blocks), and rows
91− -- (each a list of lists of blocks)
89+ -- relative column widths (0 = default),
90+ -- column headers (each a list of blocks), and
91+ -- rows (each a list of lists of blocks)
9292 | Null -- ^ Nothing
9393 deriving (Eq, Read, Show, Typeable, Data)
9494
src/Text/Pandoc/Readers/Markdown.hs+4−1
@@ -761,7 +761,10 @@ tableWith headerParser lineParser footerParser = try $ do
761761
762762-- Parse a simple table with '---' header and one line per row.
763763simpleTable :: GenParser Char ParserState Block
764−simpleTable = tableWith simpleTableHeader tableLine blanklines
764+simpleTable = do
765+ Table c a _w h l <- tableWith simpleTableHeader tableLine blanklines
766+ -- Simple tables get 0s for relative column widths (i.e., use default)
767+ return $ Table c a (replicate (length a) 0) h l
765768
766769-- Parse a multiline table: starts with row of '-' on top, then header
767770-- (which may be multiline), then the rows,
src/Text/Pandoc/Writers/ConTeXt.hs+4−6
@@ -192,15 +192,16 @@ blockToConTeXt (Header level lst) = do
192192 text base <> char '{' <> contents <> char '}'
193193 else contents
194194blockToConTeXt (Table caption aligns widths heads rows) = do
195− let colWidths = map printDecimal widths
196195 let colDescriptor colWidth alignment = (case alignment of
197196 AlignLeft -> 'l'
198197 AlignRight -> 'r'
199198 AlignCenter -> 'c'
200199 AlignDefault -> 'l'):
201− "p(" ++ colWidth ++ "\\textwidth)|"
200+ if colWidth == 0
201+ then "|"
202+ else ("p(" ++ printf "%.2f" colWidth ++ "\\textwidth)|")
202203 let colDescriptors = "|" ++ (concat $
203− zipWith colDescriptor colWidths aligns)
204+ zipWith colDescriptor widths aligns)
204205 headers <- tableRowToConTeXt heads
205206 captionText <- inlineListToConTeXt caption
206207 let captionText' = if null caption then text "none" else captionText
@@ -210,9 +211,6 @@ blockToConTeXt (Table caption aligns widths heads rows) = do
210211 text "\\HL" $$ headers $$ text "\\HL" $$
211212 vcat rows' $$ text "\\HL\n\\stoptable"
212213
213−printDecimal :: Double -> String
214−printDecimal = printf "%.2f"
215−
216214tableRowToConTeXt :: [[Block]] -> State WriterState Doc
217215tableRowToConTeXt cols = do
218216 cols' <- mapM blockListToConTeXt cols
src/Text/Pandoc/Writers/LaTeX.hs+17−11
@@ -197,17 +197,7 @@ blockToLaTeX (Table caption aligns widths heads rows) = do
197197 headers <- tableRowToLaTeX heads
198198 captionText <- inlineListToLaTeX caption
199199 rows' <- mapM tableRowToLaTeX rows
200− let colWidths = map (printf "%.2f") widths
201− let colDescriptors = concat $ zipWith
202− (\width align -> ">{\\PBS" ++
203− (case align of
204− AlignLeft -> "\\raggedright"
205− AlignRight -> "\\raggedleft"
206− AlignCenter -> "\\centering"
207− AlignDefault -> "\\raggedright") ++
208− "\\hspace{0pt}}p{" ++ width ++
209− "\\columnwidth}")
210− colWidths aligns
200+ let colDescriptors = concat $ zipWith toColDescriptor widths aligns
211201 let tableBody = text ("\\begin{tabular}{" ++ colDescriptors ++ "}") $$
212202 headers $$ text "\\hline" $$ vcat rows' $$
213203 text "\\end{tabular}"
@@ -221,6 +211,22 @@ blockToLaTeX (Table caption aligns widths heads rows) = do
221211 else text "\\begin{table}[h]" $$ centered tableBody $$
222212 inCmd "caption" captionText $$ text "\\end{table}\n"
223213
214+toColDescriptor :: Double -> Alignment -> String
215+toColDescriptor 0 align =
216+ case align of
217+ AlignLeft -> "l"
218+ AlignRight -> "r"
219+ AlignCenter -> "c"
220+ AlignDefault -> "l"
221+toColDescriptor width align = ">{\\PBS" ++
222+ (case align of
223+ AlignLeft -> "\\raggedright"
224+ AlignRight -> "\\raggedleft"
225+ AlignCenter -> "\\centering"
226+ AlignDefault -> "\\raggedright") ++
227+ "\\hspace{0pt}}p{" ++ printf "%.2f" width ++
228+ "\\columnwidth}"
229+
224230blockListToLaTeX :: [Block] -> State WriterState Doc
225231blockListToLaTeX lst = mapM blockToLaTeX lst >>= return . vcat
226232
src/Text/Pandoc/Writers/Man.hs+3−1
@@ -171,7 +171,9 @@ blockToMan opts (Table caption alignments widths headers rows) =
171171 in do
172172 caption' <- inlineListToMan opts caption
173173 modify (\(notes, preprocessors) -> (notes, "t":preprocessors))
174− let iwidths = map (printf "w(%0.2fn)" . (70 *)) widths
174+ let iwidths = if all (== 0) widths
175+ then repeat ""
176+ else map (printf "w(%0.2fn)" . (70 *)) widths
175177 -- 78n default width - 8n indent = 70n
176178 let coldescriptions = text $ intercalate " "
177179 (zipWith (\align width -> aligncode align ++ width)
src/Text/Pandoc/Writers/Markdown.hs+11−7
@@ -34,7 +34,7 @@ import Text.Pandoc.Definition
3434import Text.Pandoc.Shared
3535import Text.Pandoc.Blocks
3636import Text.ParserCombinators.Parsec ( parse, GenParser )
37−import Data.List ( group, isPrefixOf, drop, find, intersperse, intercalate )
37+import Data.List ( group, isPrefixOf, drop, find, intersperse, intercalate, transpose )
3838import Text.PrettyPrint.HughesPJ hiding ( Str )
3939import Control.Monad.State
4040
@@ -218,25 +218,29 @@ blockToMarkdown opts (Table caption aligns widths headers rows) = do
218218 then empty
219219 else text "" $+$ (text "Table: " <> caption')
220220 headers' <- mapM (blockListToMarkdown opts) headers
221− let widthsInChars = map (floor . (78 *)) widths
222221 let alignHeader alignment = case alignment of
223222 AlignLeft -> leftAlignBlock
224223 AlignCenter -> centerAlignBlock
225224 AlignRight -> rightAlignBlock
226225 AlignDefault -> leftAlignBlock
226+ rawRows <- mapM (mapM (blockListToMarkdown opts)) rows
227+ let isSimple = all (==0) widths
228+ let numChars = maximum . map (length . render)
229+ let widthsInChars =
230+ if isSimple
231+ then map ((+2) . numChars) $ transpose (headers' : rawRows)
232+ else map (floor . (78 *)) widths
227233 let makeRow = hsepBlocks . (zipWith alignHeader aligns) .
228234 (zipWith docToBlock widthsInChars)
229235 let head' = makeRow headers'
230− rows' <- mapM (\row -> do cols <- mapM (blockListToMarkdown opts) row
231− return $ makeRow cols) rows
236+ let rows' = map makeRow rawRows
232237 let maxRowHeight = maximum $ map heightOfBlock (head':rows')
233− let isMultilineTable = maxRowHeight > 1
234238 let underline = hsep $
235239 map (\width -> text $ replicate width '-') widthsInChars
236− let border = if isMultilineTable
240+ let border = if maxRowHeight > 1
237241 then text $ replicate (sum widthsInChars + (length widthsInChars - 1)) '-'
238242 else empty
239− let spacer = if isMultilineTable
243+ let spacer = if maxRowHeight > 1
240244 then text ""
241245 else empty
242246 let body = vcat $ intersperse spacer $ map blockToDoc rows'
src/Text/Pandoc/Writers/OpenDocument.hs+5−3
@@ -467,13 +467,15 @@ tableStyle num wcs =
467467 table = inTags True "style:style"
468468 [("style:name", tableId)] $
469469 selfClosingTag "style:table-properties"
470− [ ("style:rel-width", "100%" )
471− , ("table:align" , "center")]
470+ [("table:align" , "center")]
471+ colStyle (c,0) = selfClosingTag "style:style"
472+ [ ("style:name" , tableId ++ "." ++ [c])
473+ , ("style:family", "table-column" )]
472474 colStyle (c,w) = inTags True "style:style"
473475 [ ("style:name" , tableId ++ "." ++ [c])
474476 , ("style:family", "table-column" )] $
475477 selfClosingTag "style:table-column-properties"
476− [("style:column-width", printf "%.2f" (7 * w) ++ "in")]
478+ [("style:rel-column-width", printf "%d*" $ (floor $ w * 65535 :: Integer))]
477479 cellStyle = inTags True "style:style"
478480 [ ("style:name" , tableId ++ ".A1")
479481 , ("style:family", "table-cell" )] $
src/Text/Pandoc/Writers/RST.hs+8−2
@@ -33,7 +33,7 @@ module Text.Pandoc.Writers.RST ( writeRST) where
3333import Text.Pandoc.Definition
3434import Text.Pandoc.Shared
3535import Text.Pandoc.Blocks
36−import Data.List ( isPrefixOf, isSuffixOf, drop, intersperse )
36+import Data.List ( isPrefixOf, isSuffixOf, drop, intersperse, transpose )
3737import Text.PrettyPrint.HughesPJ hiding ( Str )
3838import Control.Monad.State
3939import Control.Applicative ( (<$>) )
@@ -198,7 +198,13 @@ blockToRST (Table caption _ widths headers rows) = do
198198 then empty
199199 else text "" $+$ (text "Table: " <> caption')
200200 headers' <- mapM blockListToRST headers
201− let widthsInChars = map (floor . (78 *)) widths
201+ rawRows <- mapM (mapM blockListToRST) rows
202+ let isSimple = all (==0) widths && all (all (\bs -> length bs == 1)) rows
203+ let numChars = maximum . map (length . render)
204+ let widthsInChars =
205+ if isSimple
206+ then map ((+2) . numChars) $ transpose (headers' : rawRows)
207+ else map (floor . (78 *)) widths
202208 let hpipeBlocks blocks = hcatBlocks [beg, middle, end]
203209 where height = maximum (map heightOfBlock blocks)
204210 sep' = TextBlock 3 height (replicate height " | ")
src/Text/Pandoc/Writers/RTF.hs+6−3
@@ -191,9 +191,12 @@ blockToRTF indent alignment (Table caption aligns sizes headers rows) =
191191 rtfPar indent 0 alignment (inlineListToRTF caption)
192192
193193tableRowToRTF :: Bool -> Int -> [Alignment] -> [Double] -> [[Block]] -> String
194−tableRowToRTF header indent aligns sizes cols =
195− let columns = concat $ zipWith (tableItemToRTF indent) aligns cols
196− totalTwips = 6 * 1440 -- 6 inches
194+tableRowToRTF header indent aligns sizes' cols =
195+ let totalTwips = 6 * 1440 -- 6 inches
196+ sizes = if all (== 0) sizes'
197+ then take (length cols) $ repeat (1.0 / fromIntegral (length cols))
198+ else sizes'
199+ columns = concat $ zipWith (tableItemToRTF indent) aligns cols
197200 rightEdges = tail $ scanl (\sofar new -> sofar + floor (new * totalTwips))
198201 (0 :: Integer) sizes
199202 cellDefs = map (\edge -> (if header
src/Text/Pandoc/Writers/Texinfo.hs+10−4
@@ -32,7 +32,8 @@ import Text.Pandoc.Definition
3232import Text.Pandoc.Shared
3333import Text.Pandoc.Readers.TeXMath
3434import Text.Printf ( printf )
35−import Data.List ( isSuffixOf )
35+import Data.List ( isSuffixOf, transpose, maximumBy )
36+import Data.Ord ( comparing )
3637import Data.Char ( chr, ord )
3738import qualified Data.Set as S
3839import Control.Monad.State
@@ -225,9 +226,14 @@ blockToTexinfo (Table caption aligns widths heads rows) = do
225226 headers <- tableHeadToTexinfo aligns heads
226227 captionText <- inlineListToTexinfo caption
227228 rowsText <- mapM (tableRowToTexinfo aligns) rows
228− let colWidths = map (printf "%.2f ") widths
229− let colDescriptors = concat colWidths
230− let tableBody = text ("@multitable @columnfractions " ++ colDescriptors) $$
229+ colDescriptors <-
230+ if all (== 0) widths
231+ then do -- use longest entry instead of column widths
232+ cols <- mapM (mapM (liftM (render . hcat) . mapM blockToTexinfo)) $
233+ transpose $ heads : rows
234+ return $ concatMap ((\x -> "{"++x++"} ") . maximumBy (comparing length)) cols
235+ else return $ "@columnfractions " ++ concatMap (printf "%.2f ") widths
236+ let tableBody = text ("@multitable " ++ colDescriptors) $$
231237 headers $$
232238 vcat rowsText $$
233239 text "@end multitable"
tests/tables.context+3−3
@@ -1,7 +1,7 @@
11Simple table with caption:
22
33\placetable[here]{Demonstration of simple table syntax.}
4−\starttable[|rp(0.15\textwidth)|lp(0.09\textwidth)|cp(0.16\textwidth)|lp(0.13\textwidth)|]
4+\starttable[|r|l|c|l|]
55\HL
66\NC Right
77\NC Left
@@ -30,7 +30,7 @@ Simple table with caption:
3030Simple table without caption:
3131
3232\placetable[here]{none}
33−\starttable[|rp(0.15\textwidth)|lp(0.09\textwidth)|cp(0.16\textwidth)|lp(0.13\textwidth)|]
33+\starttable[|r|l|c|l|]
3434\HL
3535\NC Right
3636\NC Left
@@ -59,7 +59,7 @@ Simple table without caption:
5959Simple table indented two spaces:
6060
6161\placetable[here]{Demonstration of simple table syntax.}
62−\starttable[|rp(0.15\textwidth)|lp(0.09\textwidth)|cp(0.16\textwidth)|lp(0.13\textwidth)|]
62+\starttable[|r|l|c|l|]
6363\HL
6464\NC Right
6565\NC Left
tests/tables.docbook+12−12
@@ -6,16 +6,16 @@
66 Demonstration of simple table syntax.
77 </caption>
88 <tr>
9− <th align="right" style="{width: 15%;}">
9+ <th align="right">
1010 Right
1111 </th>
12− <th align="left" style="{width: 8%;}">
12+ <th align="left">
1313 Left
1414 </th>
15− <th align="center" style="{width: 16%;}">
15+ <th align="center">
1616 Center
1717 </th>
18− <th align="left" style="{width: 12%;}">
18+ <th align="left">
1919 Default
2020 </th>
2121 </tr>
@@ -67,16 +67,16 @@
6767</para>
6868<informaltable>
6969 <tr>
70− <th align="right" style="{width: 15%;}">
70+ <th align="right">
7171 Right
7272 </th>
73− <th align="left" style="{width: 8%;}">
73+ <th align="left">
7474 Left
7575 </th>
76− <th align="center" style="{width: 16%;}">
76+ <th align="center">
7777 Center
7878 </th>
79− <th align="left" style="{width: 12%;}">
79+ <th align="left">
8080 Default
8181 </th>
8282 </tr>
@@ -131,16 +131,16 @@
131131 Demonstration of simple table syntax.
132132 </caption>
133133 <tr>
134− <th align="right" style="{width: 15%;}">
134+ <th align="right">
135135 Right
136136 </th>
137− <th align="left" style="{width: 8%;}">
137+ <th align="left">
138138 Left
139139 </th>
140− <th align="center" style="{width: 16%;}">
140+ <th align="center">
141141 Center
142142 </th>
143− <th align="left" style="{width: 12%;}">
143+ <th align="left">
144144 Default
145145 </th>
146146 </tr>
tests/tables.html+12−12
@@ -4,13 +4,13 @@
44><caption
55 >Demonstration of simple table syntax.</caption
66 ><tr class="header"
7− ><th align="right" style="width: 15%;"
7+ ><th align="right"
88 >Right</th
9− ><th align="left" style="width: 8%;"
9+ ><th align="left"
1010 >Left</th
11− ><th align="center" style="width: 16%;"
11+ ><th align="center"
1212 >Center</th
13− ><th align="left" style="width: 12%;"
13+ ><th align="left"
1414 >Default</th
1515 ></tr
1616 ><tr class="odd"
@@ -48,13 +48,13 @@
4848>Simple table without caption:</p
4949><table
5050><tr class="header"
51− ><th align="right" style="width: 15%;"
51+ ><th align="right"
5252 >Right</th
53− ><th align="left" style="width: 8%;"
53+ ><th align="left"
5454 >Left</th
55− ><th align="center" style="width: 16%;"
55+ ><th align="center"
5656 >Center</th
57− ><th align="left" style="width: 12%;"
57+ ><th align="left"
5858 >Default</th
5959 ></tr
6060 ><tr class="odd"
@@ -94,13 +94,13 @@
9494><caption
9595 >Demonstration of simple table syntax.</caption
9696 ><tr class="header"
97− ><th align="right" style="width: 15%;"
97+ ><th align="right"
9898 >Right</th
99− ><th align="left" style="width: 8%;"
99+ ><th align="left"
100100 >Left</th
101− ><th align="center" style="width: 16%;"
101+ ><th align="center"
102102 >Center</th
103− ><th align="left" style="width: 12%;"
103+ ><th align="left"
104104 >Default</th
105105 ></tr
106106 ><tr class="odd"
tests/tables.latex+3−3
@@ -2,7 +2,7 @@ Simple table with caption:
22
33\begin{table}[h]
44\begin{center}
5−\begin{tabular}{>{\PBS\raggedleft\hspace{0pt}}p{0.15\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.09\columnwidth}>{\PBS\centering\hspace{0pt}}p{0.16\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.13\columnwidth}}
5+\begin{tabular}{rlcl}
66Right
77 & Left
88 & Center
@@ -32,7 +32,7 @@ Right
3232Simple table without caption:
3333
3434\begin{center}
35−\begin{tabular}{>{\PBS\raggedleft\hspace{0pt}}p{0.15\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.09\columnwidth}>{\PBS\centering\hspace{0pt}}p{0.16\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.13\columnwidth}}
35+\begin{tabular}{rlcl}
3636Right
3737 & Left
3838 & Center
@@ -61,7 +61,7 @@ Simple table indented two spaces:
6161
6262\begin{table}[h]
6363\begin{center}
64−\begin{tabular}{>{\PBS\raggedleft\hspace{0pt}}p{0.15\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.09\columnwidth}>{\PBS\centering\hspace{0pt}}p{0.16\columnwidth}>{\PBS\raggedright\hspace{0pt}}p{0.13\columnwidth}}
64+\begin{tabular}{rlcl}
6565Right
6666 & Left
6767 & Center
tests/tables.man+3−3
@@ -4,7 +4,7 @@ Simple table with caption:
44Demonstration of simple table syntax.
55.TS
66tab(@);
7−rw(10.50n) lw(6.13n) cw(11.38n) lw(8.75n).
7+r l c l.
88T{
99Right
1010T}@T{
@@ -48,7 +48,7 @@ Simple table without caption:
4848.PP
4949.TS
5050tab(@);
51−rw(10.50n) lw(6.13n) cw(11.38n) lw(8.75n).
51+r l c l.
5252T{
5353Right
5454T}@T{
@@ -93,7 +93,7 @@ Simple table indented two spaces:
9393Demonstration of simple table syntax.
9494.TS
9595tab(@);
96−rw(10.50n) lw(6.13n) cw(11.38n) lw(8.75n).
96+r l c l.
9797T{
9898Right
9999T}@T{
tests/tables.markdown+15−15
@@ -1,28 +1,28 @@
11Simple table with caption:
22
3− Right Left Center Default
4− ----------- ------ ------------ ---------
5− 12 12 12 12
6− 123 123 123 123
7− 1 1 1 1
3+ Right Left Center Default
4+ ------- ------ -------- ---------
5+ 12 12 12 12
6+ 123 123 123 123
7+ 1 1 1 1
88
99 Table: Demonstration of simple table syntax.
1010
1111Simple table without caption:
1212
13− Right Left Center Default
14− ----------- ------ ------------ ---------
15− 12 12 12 12
16− 123 123 123 123
17− 1 1 1 1
13+ Right Left Center Default
14+ ------- ------ -------- ---------
15+ 12 12 12 12
16+ 123 123 123 123
17+ 1 1 1 1
1818
1919Simple table indented two spaces:
2020
21− Right Left Center Default
22− ----------- ------ ------------ ---------
23− 12 12 12 12
24− 123 123 123 123
25− 1 1 1 1
21+ Right Left Center Default
22+ ------- ------ -------- ---------
23+ 12 12 12 12
24+ 123 123 123 123
25+ 1 1 1 1
2626
2727 Table: Demonstration of simple table syntax.
2828
tests/tables.mediawiki+12−12
@@ -2,10 +2,10 @@ Simple table with caption:
22
33<table>
44<caption>Demonstration of simple table syntax.</caption><tr>
5−<th align="right" style="width: 15%;">Right</th>
6−<th align="left" style="width: 8%;">Left</th>
7−<th align="center" style="width: 16%;">Center</th>
8−<th align="left" style="width: 12%;">Default</th>
5+<th align="right">Right</th>
6+<th align="left">Left</th>
7+<th align="center">Center</th>
8+<th align="left">Default</th>
99</tr><tr>
1010<td align="right">12</td>
1111<td align="left">12</td>
@@ -29,10 +29,10 @@ Simple table without caption:
2929
3030<table>
3131<tr>
32−<th align="right" style="width: 15%;">Right</th>
33−<th align="left" style="width: 8%;">Left</th>
34−<th align="center" style="width: 16%;">Center</th>
35−<th align="left" style="width: 12%;">Default</th>
32+<th align="right">Right</th>
33+<th align="left">Left</th>
34+<th align="center">Center</th>
35+<th align="left">Default</th>
3636</tr><tr>
3737<td align="right">12</td>
3838<td align="left">12</td>
@@ -56,10 +56,10 @@ Simple table indented two spaces:
5656
5757<table>
5858<caption>Demonstration of simple table syntax.</caption><tr>
59−<th align="right" style="width: 15%;">Right</th>
60−<th align="left" style="width: 8%;">Left</th>
61−<th align="center" style="width: 16%;">Center</th>
62−<th align="left" style="width: 12%;">Default</th>
59+<th align="right">Right</th>
60+<th align="left">Left</th>
61+<th align="center">Center</th>
62+<th align="left">Default</th>
6363</tr><tr>
6464<td align="right">12</td>
6565<td align="left">12</td>
tests/tables.native+3−3
@@ -1,6 +1,6 @@
11Pandoc (Meta [] [] "")
22[ Para [Str "Simple",Space,Str "table",Space,Str "with",Space,Str "caption:"]
3−, Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.15,8.75e-2,0.1625,0.125]
3+, Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
44 [ [ Plain [Str "Right"] ]
55 , [ Plain [Str "Left"] ]
66 , [ Plain [Str "Center"] ]
@@ -18,7 +18,7 @@ Pandoc (Meta [] [] "")
1818 , [ Plain [Str "1"] ]
1919 , [ Plain [Str "1"] ] ] ]
2020, Para [Str "Simple",Space,Str "table",Space,Str "without",Space,Str "caption:"]
21−, Table [] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.15,8.75e-2,0.1625,0.125]
21+, Table [] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
2222 [ [ Plain [Str "Right"] ]
2323 , [ Plain [Str "Left"] ]
2424 , [ Plain [Str "Center"] ]
@@ -36,7 +36,7 @@ Pandoc (Meta [] [] "")
3636 , [ Plain [Str "1"] ]
3737 , [ Plain [Str "1"] ] ] ]
3838, Para [Str "Simple",Space,Str "table",Space,Str "indented",Space,Str "two",Space,Str "spaces:"]
39−, Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.15,8.75e-2,0.1625,0.125]
39+, Table [Str "Demonstration",Space,Str "of",Space,Str "simple",Space,Str "table",Space,Str "syntax",Str "."] [AlignRight,AlignLeft,AlignCenter,AlignDefault] [0.0,0.0,0.0,0.0]
4040 [ [ Plain [Str "Right"] ]
4141 , [ Plain [Str "Left"] ]
4242 , [ Plain [Str "Center"] ]
tests/tables.opendocument+25−49
@@ -67,91 +67,67 @@
6767 <style:paragraph-properties fo:text-align="end" style:justify-single-word="false" />
6868 </style:style>
6969 <style:style style:name="Table1">
70− <style:table-properties style:rel-width="100%" table:align="center" />
71− </style:style>
72− <style:style style:name="Table1.A" style:family="table-column">
73− <style:table-column-properties style:column-width="1.05in" />
74− </style:style>
75− <style:style style:name="Table1.B" style:family="table-column">
76− <style:table-column-properties style:column-width="0.61in" />
77− </style:style>
78− <style:style style:name="Table1.C" style:family="table-column">
79− <style:table-column-properties style:column-width="1.14in" />
80− </style:style>
81− <style:style style:name="Table1.D" style:family="table-column">
82− <style:table-column-properties style:column-width="0.88in" />
70+ <style:table-properties table:align="center" />
8371 </style:style>
72+ <style:style style:name="Table1.A" style:family="table-column" />
73+ <style:style style:name="Table1.B" style:family="table-column" />
74+ <style:style style:name="Table1.C" style:family="table-column" />
75+ <style:style style:name="Table1.D" style:family="table-column" />
8476 <style:style style:name="Table1.A1" style:family="table-cell">
8577 <style:table-cell-properties fo:border="none" />
8678 </style:style>
8779 <style:style style:name="Table2">
88− <style:table-properties style:rel-width="100%" table:align="center" />
89− </style:style>
90− <style:style style:name="Table2.A" style:family="table-column">
91− <style:table-column-properties style:column-width="1.05in" />
92− </style:style>
93− <style:style style:name="Table2.B" style:family="table-column">
94− <style:table-column-properties style:column-width="0.61in" />
95− </style:style>
96− <style:style style:name="Table2.C" style:family="table-column">
97− <style:table-column-properties style:column-width="1.14in" />
98− </style:style>
99− <style:style style:name="Table2.D" style:family="table-column">
100− <style:table-column-properties style:column-width="0.88in" />
80+ <style:table-properties table:align="center" />
10181 </style:style>
82+ <style:style style:name="Table2.A" style:family="table-column" />
83+ <style:style style:name="Table2.B" style:family="table-column" />
84+ <style:style style:name="Table2.C" style:family="table-column" />
85+ <style:style style:name="Table2.D" style:family="table-column" />
10286 <style:style style:name="Table2.A1" style:family="table-cell">
10387 <style:table-cell-properties fo:border="none" />
10488 </style:style>
10589 <style:style style:name="Table3">
106− <style:table-properties style:rel-width="100%" table:align="center" />
107− </style:style>
108− <style:style style:name="Table3.A" style:family="table-column">
109− <style:table-column-properties style:column-width="1.05in" />
110− </style:style>
111− <style:style style:name="Table3.B" style:family="table-column">
112− <style:table-column-properties style:column-width="0.61in" />
113− </style:style>
114− <style:style style:name="Table3.C" style:family="table-column">
115− <style:table-column-properties style:column-width="1.14in" />
116− </style:style>
117− <style:style style:name="Table3.D" style:family="table-column">
118− <style:table-column-properties style:column-width="0.88in" />
90+ <style:table-properties table:align="center" />
11991 </style:style>
92+ <style:style style:name="Table3.A" style:family="table-column" />
93+ <style:style style:name="Table3.B" style:family="table-column" />
94+ <style:style style:name="Table3.C" style:family="table-column" />
95+ <style:style style:name="Table3.D" style:family="table-column" />
12096 <style:style style:name="Table3.A1" style:family="table-cell">
12197 <style:table-cell-properties fo:border="none" />
12298 </style:style>
12399 <style:style style:name="Table4">
124− <style:table-properties style:rel-width="100%" table:align="center" />
100+ <style:table-properties table:align="center" />
125101 </style:style>
126102 <style:style style:name="Table4.A" style:family="table-column">
127− <style:table-column-properties style:column-width="1.05in" />
103+ <style:table-column-properties style:rel-column-width="9830*" />
128104 </style:style>
129105 <style:style style:name="Table4.B" style:family="table-column">
130− <style:table-column-properties style:column-width="0.96in" />
106+ <style:table-column-properties style:rel-column-width="9011*" />
131107 </style:style>
132108 <style:style style:name="Table4.C" style:family="table-column">
133− <style:table-column-properties style:column-width="1.14in" />
109+ <style:table-column-properties style:rel-column-width="10649*" />
134110 </style:style>
135111 <style:style style:name="Table4.D" style:family="table-column">
136− <style:table-column-properties style:column-width="2.36in" />
112+ <style:table-column-properties style:rel-column-width="22118*" />
137113 </style:style>
138114 <style:style style:name="Table4.A1" style:family="table-cell">
139115 <style:table-cell-properties fo:border="none" />
140116 </style:style>
141117 <style:style style:name="Table5">
142− <style:table-properties style:rel-width="100%" table:align="center" />
118+ <style:table-properties table:align="center" />
143119 </style:style>
144120 <style:style style:name="Table5.A" style:family="table-column">
145− <style:table-column-properties style:column-width="1.05in" />
121+ <style:table-column-properties style:rel-column-width="9830*" />
146122 </style:style>
147123 <style:style style:name="Table5.B" style:family="table-column">
148− <style:table-column-properties style:column-width="0.96in" />
124+ <style:table-column-properties style:rel-column-width="9011*" />
149125 </style:style>
150126 <style:style style:name="Table5.C" style:family="table-column">
151− <style:table-column-properties style:column-width="1.14in" />
127+ <style:table-column-properties style:rel-column-width="10649*" />
152128 </style:style>
153129 <style:style style:name="Table5.D" style:family="table-column">
154− <style:table-column-properties style:column-width="2.36in" />
130+ <style:table-column-properties style:rel-column-width="22118*" />
155131 </style:style>
156132 <style:style style:name="Table5.A1" style:family="table-cell">
157133 <style:table-cell-properties fo:border="none" />
tests/tables.rst+27−27
@@ -1,40 +1,40 @@
11Simple table with caption:
22
3−+-------------+--------+--------------+-----------+
4−| Right | Left | Center | Default |
5−+=============+========+==============+===========+
6−| 12 | 12 | 12 | 12 |
7−+-------------+--------+--------------+-----------+
8−| 123 | 123 | 123 | 123 |
9−+-------------+--------+--------------+-----------+
10−| 1 | 1 | 1 | 1 |
11−+-------------+--------+--------------+-----------+
3++---------+--------+----------+-----------+
4+| Right | Left | Center | Default |
5++=========+========+==========+===========+
6+| 12 | 12 | 12 | 12 |
7++---------+--------+----------+-----------+
8+| 123 | 123 | 123 | 123 |
9++---------+--------+----------+-----------+
10+| 1 | 1 | 1 | 1 |
11++---------+--------+----------+-----------+
1212
1313Table: Demonstration of simple table syntax.
1414
1515Simple table without caption:
1616
17−+-------------+--------+--------------+-----------+
18−| Right | Left | Center | Default |
19−+=============+========+==============+===========+
20−| 12 | 12 | 12 | 12 |
21−+-------------+--------+--------------+-----------+
22−| 123 | 123 | 123 | 123 |
23−+-------------+--------+--------------+-----------+
24−| 1 | 1 | 1 | 1 |
25−+-------------+--------+--------------+-----------+
17++---------+--------+----------+-----------+
18+| Right | Left | Center | Default |
19++=========+========+==========+===========+
20+| 12 | 12 | 12 | 12 |
21++---------+--------+----------+-----------+
22+| 123 | 123 | 123 | 123 |
23++---------+--------+----------+-----------+
24+| 1 | 1 | 1 | 1 |
25++---------+--------+----------+-----------+
2626
2727Simple table indented two spaces:
2828
29−+-------------+--------+--------------+-----------+
30−| Right | Left | Center | Default |
31−+=============+========+==============+===========+
32−| 12 | 12 | 12 | 12 |
33−+-------------+--------+--------------+-----------+
34−| 123 | 123 | 123 | 123 |
35−+-------------+--------+--------------+-----------+
36−| 1 | 1 | 1 | 1 |
37−+-------------+--------+--------------+-----------+
29++---------+--------+----------+-----------+
30+| Right | Left | Center | Default |
31++=========+========+==========+===========+
32+| 12 | 12 | 12 | 12 |
33++---------+--------+----------+-----------+
34+| 123 | 123 | 123 | 123 |
35++---------+--------+----------+-----------+
36+| 1 | 1 | 1 | 1 |
37++---------+--------+----------+-----------+
3838
3939Table: Demonstration of simple table syntax.
4040
tests/tables.rtf+12−12
@@ -1,7 +1,7 @@
11{\pard \ql \f0 \sa180 \li0 \fi0 Simple table with caption:\par}
22{
33\trowd \trgaph120
4−\clbrdrb\brdrs\cellx1296\clbrdrb\brdrs\cellx2052\clbrdrb\brdrs\cellx3456\clbrdrb\brdrs\cellx4536
4+\clbrdrb\brdrs\cellx2160\clbrdrb\brdrs\cellx4320\clbrdrb\brdrs\cellx6480\clbrdrb\brdrs\cellx8640
55\trkeep\intbl
66{
77{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 Right\par}
@@ -16,7 +16,7 @@
1616\intbl\row}
1717{
1818\trowd \trgaph120
19−\cellx1296\cellx2052\cellx3456\cellx4536
19+\cellx2160\cellx4320\cellx6480\cellx8640
2020\trkeep\intbl
2121{
2222{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12\par}
@@ -31,7 +31,7 @@
3131\intbl\row}
3232{
3333\trowd \trgaph120
34−\cellx1296\cellx2052\cellx3456\cellx4536
34+\cellx2160\cellx4320\cellx6480\cellx8640
3535\trkeep\intbl
3636{
3737{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 123\par}
@@ -46,7 +46,7 @@
4646\intbl\row}
4747{
4848\trowd \trgaph120
49−\cellx1296\cellx2052\cellx3456\cellx4536
49+\cellx2160\cellx4320\cellx6480\cellx8640
5050\trkeep\intbl
5151{
5252{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 1\par}
@@ -63,7 +63,7 @@
6363{\pard \ql \f0 \sa180 \li0 \fi0 Simple table without caption:\par}
6464{
6565\trowd \trgaph120
66−\clbrdrb\brdrs\cellx1296\clbrdrb\brdrs\cellx2052\clbrdrb\brdrs\cellx3456\clbrdrb\brdrs\cellx4536
66+\clbrdrb\brdrs\cellx2160\clbrdrb\brdrs\cellx4320\clbrdrb\brdrs\cellx6480\clbrdrb\brdrs\cellx8640
6767\trkeep\intbl
6868{
6969{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 Right\par}
@@ -78,7 +78,7 @@
7878\intbl\row}
7979{
8080\trowd \trgaph120
81−\cellx1296\cellx2052\cellx3456\cellx4536
81+\cellx2160\cellx4320\cellx6480\cellx8640
8282\trkeep\intbl
8383{
8484{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12\par}
@@ -93,7 +93,7 @@
9393\intbl\row}
9494{
9595\trowd \trgaph120
96−\cellx1296\cellx2052\cellx3456\cellx4536
96+\cellx2160\cellx4320\cellx6480\cellx8640
9797\trkeep\intbl
9898{
9999{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 123\par}
@@ -108,7 +108,7 @@
108108\intbl\row}
109109{
110110\trowd \trgaph120
111−\cellx1296\cellx2052\cellx3456\cellx4536
111+\cellx2160\cellx4320\cellx6480\cellx8640
112112\trkeep\intbl
113113{
114114{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 1\par}
@@ -125,7 +125,7 @@
125125{\pard \ql \f0 \sa180 \li0 \fi0 Simple table indented two spaces:\par}
126126{
127127\trowd \trgaph120
128−\clbrdrb\brdrs\cellx1296\clbrdrb\brdrs\cellx2052\clbrdrb\brdrs\cellx3456\clbrdrb\brdrs\cellx4536
128+\clbrdrb\brdrs\cellx2160\clbrdrb\brdrs\cellx4320\clbrdrb\brdrs\cellx6480\clbrdrb\brdrs\cellx8640
129129\trkeep\intbl
130130{
131131{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 Right\par}
@@ -140,7 +140,7 @@
140140\intbl\row}
141141{
142142\trowd \trgaph120
143−\cellx1296\cellx2052\cellx3456\cellx4536
143+\cellx2160\cellx4320\cellx6480\cellx8640
144144\trkeep\intbl
145145{
146146{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 12\par}
@@ -155,7 +155,7 @@
155155\intbl\row}
156156{
157157\trowd \trgaph120
158−\cellx1296\cellx2052\cellx3456\cellx4536
158+\cellx2160\cellx4320\cellx6480\cellx8640
159159\trkeep\intbl
160160{
161161{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 123\par}
@@ -170,7 +170,7 @@
170170\intbl\row}
171171{
172172\trowd \trgaph120
173−\cellx1296\cellx2052\cellx3456\cellx4536
173+\cellx2160\cellx4320\cellx6480\cellx8640
174174\trkeep\intbl
175175{
176176{\intbl {\pard \qr \f0 \sa0 \li0 \fi0 1\par}
tests/tables.texinfo+3−3
@@ -4,7 +4,7 @@
44Simple table with caption:
55
66@float
7−@multitable @columnfractions 0.15 0.09 0.16 0.13
7+@multitable {Right} {Left} {Center} {Default}
88@headitem
99Right
1010 @tab Left
@@ -30,7 +30,7 @@ Right
3030@end float
3131Simple table without caption:
3232
33−@multitable @columnfractions 0.15 0.09 0.16 0.13
33+@multitable {Right} {Left} {Center} {Default}
3434@headitem
3535Right
3636 @tab Left
@@ -56,7 +56,7 @@ Right
5656Simple table indented two spaces:
5757
5858@float
59−@multitable @columnfractions 0.15 0.09 0.16 0.13
59+@multitable {Right} {Left} {Center} {Default}
6060@headitem
6161Right
6262 @tab Left