Markdown reader/writer: spacing adjustments in tables.

* Markdown writer now includes a blank line at the end
  of the row in a single-row multiline table, to prevent it from being
  interpreted as a simple table.  Closes #4578.
* Markdown reader does a better job computing the relative width of
  the last column in a multiline table, so we can round-trip tables
  without constantly shrinking the last column.
This commit is contained in:
John MacFarlane 2018-04-21 13:06:57 -07:00
parent 229db80ac2
commit 7fbe473b2e
25 changed files with 174 additions and 152 deletions

View file

@ -1341,11 +1341,16 @@ multilineTableHeader headless = try $ do
newline
let (lengths, lines') = unzip dashes
let indices = scanl (+) (length initSp) lines'
-- compensate for the fact that intercolumn spaces are
-- not included in the last index:
let indices' = case reverse indices of
[] -> []
(x:xs) -> reverse (x+1:xs)
rawHeadsList <- if headless
then fmap (map (:[]) . tail .
splitStringByIndices (init indices)) $ lookAhead anyLine
splitStringByIndices (init indices')) $ lookAhead anyLine
else return $ transpose $ map
(tail . splitStringByIndices (init indices))
(tail . splitStringByIndices (init indices'))
rawContent
let aligns = zipWith alignType rawHeadsList lengths
let rawHeads = if headless
@ -1353,7 +1358,7 @@ multilineTableHeader headless = try $ do
else map (unlines . map trim) rawHeadsList
heads <- fmap sequence $
mapM ((parseFromString' (mconcat <$> many plain)).trim) rawHeads
return (heads, aligns, indices)
return (heads, aligns, indices')
-- Parse a grid table: starts with row of '-' on top, then header
-- (which may be grid), then the rows,

View file

@ -732,7 +732,10 @@ pandocTable opts multiline headless aligns widths rawHeaders rawRows = do
then empty
else border <> cr <> head'
let body = if multiline
then vsep rows'
then vsep rows' $$
if length rows' < 2
then blankline -- #4578
else empty
else vcat rows'
let bottom = if headless
then underline

View file

@ -7,7 +7,7 @@
line of text
----- ------------------------------------------------
^D
[Table [] [AlignRight,AlignLeft] [8.333333333333333e-2,0.6666666666666666]
[Table [] [AlignRight,AlignLeft] [8.333333333333333e-2,0.6805555555555556]
[[]
,[]]
[[[Plain [Str "foo"]]

14
test/command/4578.md Normal file
View file

@ -0,0 +1,14 @@
```
% pandoc -t markdown
------ ------- --------------- ---------------------
One row 12.0 Example of a row that
spans multiple lines.
------ ------- --------------- ---------------------
^D
------ ------- --------------- ---------------------
One row 12.0 Example of a row that
spans multiple lines.
------ ------- --------------- ---------------------
```

View file

@ -53,7 +53,7 @@
,[Plain [Str "1"]]
,[Plain [Str "1"]]]]
,Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption:"]
,Table [Str "Here\8217s",Space,Str "the",Space,Str "caption.",Space,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1375,0.125,0.15,0.325]
,Table [Str "Here\8217s",Space,Str "the",Space,Str "caption.",Space,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1375,0.125,0.15,0.3375]
[[Plain [Str "Centered",SoftBreak,Str "Header"]]
,[Plain [Str "Left",SoftBreak,Str "Aligned"]]
,[Plain [Str "Right",SoftBreak,Str "Aligned"]]
@ -65,9 +65,9 @@
,[[Plain [Str "Second"]]
,[Plain [Str "row"]]
,[Plain [Str "5.0"]]
,[Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",SoftBreak,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",SoftBreak,Str "between",Space,Str "rows."]]]]
,[Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]]
,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption:"]
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1375,0.125,0.15,0.325]
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1375,0.125,0.15,0.3375]
[[Plain [Str "Centered",SoftBreak,Str "Header"]]
,[Plain [Str "Left",SoftBreak,Str "Aligned"]]
,[Plain [Str "Right",SoftBreak,Str "Aligned"]]
@ -79,7 +79,7 @@
,[[Plain [Str "Second"]]
,[Plain [Str "row"]]
,[Plain [Str "5.0"]]
,[Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",SoftBreak,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",SoftBreak,Str "between",Space,Str "rows."]]]]
,[Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]]
,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [7.5e-2,7.5e-2,7.5e-2,7.5e-2]
[[]
@ -99,7 +99,7 @@
,[Plain [Str "1"]]
,[Plain [Str "1"]]]]
,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1375,0.125,0.15,0.325]
,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1375,0.125,0.15,0.3375]
[[]
,[]
,[]
@ -111,4 +111,4 @@
,[[Plain [Str "Second"]]
,[Plain [Str "row"]]
,[Plain [Str "5.0"]]
,[Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",SoftBreak,Str "Note",Space,Str "the",Space,Str "blank",Space,Str "line",SoftBreak,Str "between",Space,Str "rows."]]]]]
,[Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]]]

View file

@ -33,7 +33,7 @@ Simple table indented two spaces:
Multiline table with caption:
.Heres the caption. It may span multiple lines.
[width="78%",cols="^21%,<17%,>20%,<42%",options="header",]
[width="80%",cols="^20%,<17%,>20%,<43%",options="header",]
|=======================================================================
|Centered Header |Left Aligned |Right Aligned |Default aligned
|First |row |12.0 |Example of a row that spans multiple lines.
@ -42,7 +42,7 @@ Multiline table with caption:
Multiline table without caption:
[width="78%",cols="^21%,<17%,>20%,<42%",options="header",]
[width="80%",cols="^20%,<17%,>20%,<43%",options="header",]
|=======================================================================
|Centered Header |Left Aligned |Right Aligned |Default aligned
|First |row |12.0 |Example of a row that spans multiple lines.
@ -60,7 +60,7 @@ Table without column headers:
Multiline table without column headers:
[width="78%",cols="^21%,<17%,>20%,42%",]
[width="80%",cols="^20%,<17%,>20%,43%",]
|=======================================================================
|First |row |12.0 |Example of a row that spans multiple lines.
|Second |row |5.0 |Heres another one. Note the blank line between rows.

View file

@ -118,7 +118,7 @@ Multiline table with caption:
\startxcell[align=middle,width={0.15\textwidth}] Centered Header \stopxcell
\startxcell[align=right,width={0.14\textwidth}] Left Aligned \stopxcell
\startxcell[align=left,width={0.16\textwidth}] Right Aligned \stopxcell
\startxcell[align=right,width={0.34\textwidth}] Default aligned \stopxcell
\startxcell[align=right,width={0.35\textwidth}] Default aligned \stopxcell
\stopxrow
\stopxtablehead
\startxtablebody[body]
@ -126,7 +126,7 @@ Multiline table with caption:
\startxcell[align=middle,width={0.15\textwidth}] First \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 12.0 \stopxcell
\startxcell[align=right,width={0.34\textwidth}] Example of a row that spans
\startxcell[align=right,width={0.35\textwidth}] Example of a row that spans
multiple lines. \stopxcell
\stopxrow
\stopxtablebody
@ -135,7 +135,7 @@ multiple lines. \stopxcell
\startxcell[align=middle,width={0.15\textwidth}] Second \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 5.0 \stopxcell
\startxcell[align=right,width={0.34\textwidth}] Here's another one. Note the
\startxcell[align=right,width={0.35\textwidth}] Here's another one. Note the
blank line between rows. \stopxcell
\stopxrow
\stopxtablefoot
@ -151,7 +151,7 @@ Multiline table without caption:
\startxcell[align=middle,width={0.15\textwidth}] Centered Header \stopxcell
\startxcell[align=right,width={0.14\textwidth}] Left Aligned \stopxcell
\startxcell[align=left,width={0.16\textwidth}] Right Aligned \stopxcell
\startxcell[align=right,width={0.34\textwidth}] Default aligned \stopxcell
\startxcell[align=right,width={0.35\textwidth}] Default aligned \stopxcell
\stopxrow
\stopxtablehead
\startxtablebody[body]
@ -159,7 +159,7 @@ Multiline table without caption:
\startxcell[align=middle,width={0.15\textwidth}] First \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 12.0 \stopxcell
\startxcell[align=right,width={0.34\textwidth}] Example of a row that spans
\startxcell[align=right,width={0.35\textwidth}] Example of a row that spans
multiple lines. \stopxcell
\stopxrow
\stopxtablebody
@ -168,7 +168,7 @@ multiple lines. \stopxcell
\startxcell[align=middle,width={0.15\textwidth}] Second \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 5.0 \stopxcell
\startxcell[align=right,width={0.34\textwidth}] Here's another one. Note the
\startxcell[align=right,width={0.35\textwidth}] Here's another one. Note the
blank line between rows. \stopxcell
\stopxrow
\stopxtablefoot
@ -213,7 +213,7 @@ Multiline table without column headers:
\startxcell[align=middle,width={0.15\textwidth}] First \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 12.0 \stopxcell
\startxcell[width={0.34\textwidth}] Example of a row that spans multiple
\startxcell[width={0.35\textwidth}] Example of a row that spans multiple
lines. \stopxcell
\stopxrow
\stopxtablebody
@ -222,7 +222,7 @@ lines. \stopxcell
\startxcell[align=middle,width={0.15\textwidth}] Second \stopxcell
\startxcell[align=right,width={0.14\textwidth}] row \stopxcell
\startxcell[align=left,width={0.16\textwidth}] 5.0 \stopxcell
\startxcell[width={0.34\textwidth}] Here's another one. Note the blank line
\startxcell[width={0.35\textwidth}] Here's another one. Note the blank line
between rows. \stopxcell
\stopxrow
\stopxtablefoot

View file

@ -95,7 +95,7 @@ It may span multiple lines.</caption>
<col width="15%" />
<col width="14%" />
<col width="16%" />
<col width="34%" />
<col width="35%" />
<tr class="header">
<th align="center">Centered
Header</th>
@ -127,7 +127,7 @@ the blank line between rows.</td>
<col width="15%" />
<col width="14%" />
<col width="16%" />
<col width="34%" />
<col width="35%" />
<tr class="header">
<th align="center">Centered
Header</th>
@ -182,7 +182,7 @@ the blank line between rows.</td>
<col width="15%" />
<col width="14%" />
<col width="16%" />
<col width="34%" />
<col width="35%" />
<tr class="odd">
<td align="center">First</td>
<td align="left">row</td>

View file

@ -228,7 +228,7 @@
<colspec colwidth="15*" align="center" />
<colspec colwidth="13*" align="left" />
<colspec colwidth="16*" align="right" />
<colspec colwidth="33*" align="left" />
<colspec colwidth="35*" align="left" />
<thead>
<row>
<entry>
@ -285,7 +285,7 @@
<colspec colwidth="15*" align="center" />
<colspec colwidth="13*" align="left" />
<colspec colwidth="16*" align="right" />
<colspec colwidth="33*" align="left" />
<colspec colwidth="35*" align="left" />
<thead>
<row>
<entry>
@ -397,7 +397,7 @@
<colspec colwidth="15*" align="center" />
<colspec colwidth="13*" align="left" />
<colspec colwidth="16*" align="right" />
<colspec colwidth="33*" align="left" />
<colspec colwidth="35*" align="left" />
<tbody>
<row>
<entry>

View file

@ -228,7 +228,7 @@
<colspec colwidth="15*" align="center" />
<colspec colwidth="13*" align="left" />
<colspec colwidth="16*" align="right" />
<colspec colwidth="33*" align="left" />
<colspec colwidth="35*" align="left" />
<thead>
<row>
<entry>
@ -285,7 +285,7 @@
<colspec colwidth="15*" align="center" />
<colspec colwidth="13*" align="left" />
<colspec colwidth="16*" align="right" />
<colspec colwidth="33*" align="left" />
<colspec colwidth="35*" align="left" />
<thead>
<row>
<entry>
@ -397,7 +397,7 @@
<colspec colwidth="15*" align="center" />
<colspec colwidth="13*" align="left" />
<colspec colwidth="16*" align="right" />
<colspec colwidth="33*" align="left" />
<colspec colwidth="35*" align="left" />
<tbody>
<row>
<entry>

View file

@ -40,33 +40,33 @@ Simple table indented two spaces:
Multiline table with caption:
> +----------+---------+-----------+-------------------------+
> | Centered | Left | Right | Default aligned |
> | Header | Aligned | Aligned | |
> +==========+=========+===========+=========================+
> | First | row | 12.0 | Example of a row that |
> | | | | spans multiple lines. |
> +----------+---------+-----------+-------------------------+
> | Second | row | 5.0 | Heres another one. |
> | | | | Note the blank line |
> | | | | between rows. |
> +----------+---------+-----------+-------------------------+
> +----------+---------+-----------+--------------------------+
> | Centered | Left | Right | Default aligned |
> | Header | Aligned | Aligned | |
> +==========+=========+===========+==========================+
> | First | row | 12.0 | Example of a row that |
> | | | | spans multiple lines. |
> +----------+---------+-----------+--------------------------+
> | Second | row | 5.0 | Heres another one. Note |
> | | | | the blank line between |
> | | | | rows. |
> +----------+---------+-----------+--------------------------+
>
> Heres the caption. It may span multiple lines.
Multiline table without caption:
> +----------+---------+-----------+-------------------------+
> | Centered | Left | Right | Default aligned |
> | Header | Aligned | Aligned | |
> +==========+=========+===========+=========================+
> | First | row | 12.0 | Example of a row that |
> | | | | spans multiple lines. |
> +----------+---------+-----------+-------------------------+
> | Second | row | 5.0 | Heres another one. |
> | | | | Note the blank line |
> | | | | between rows. |
> +----------+---------+-----------+-------------------------+
> +----------+---------+-----------+--------------------------+
> | Centered | Left | Right | Default aligned |
> | Header | Aligned | Aligned | |
> +==========+=========+===========+==========================+
> | First | row | 12.0 | Example of a row that |
> | | | | spans multiple lines. |
> +----------+---------+-----------+--------------------------+
> | Second | row | 5.0 | Heres another one. Note |
> | | | | the blank line between |
> | | | | rows. |
> +----------+---------+-----------+--------------------------+
Table without column headers:
@ -80,11 +80,11 @@ Table without column headers:
Multiline table without column headers:
> +----------+---------+-----------+-------------------------+
> | First | row | 12.0 | Example of a row that |
> | | | | spans multiple lines. |
> +----------+---------+-----------+-------------------------+
> | Second | row | 5.0 | Heres another one. |
> | | | | Note the blank line |
> | | | | between rows. |
> +----------+---------+-----------+-------------------------+
> +----------+---------+-----------+--------------------------+
> | First | row | 12.0 | Example of a row that |
> | | | | spans multiple lines. |
> +----------+---------+-----------+--------------------------+
> | Second | row | 5.0 | Heres another one. Note |
> | | | | the blank line between |
> | | | | rows. |
> +----------+---------+-----------+--------------------------+

View file

@ -94,13 +94,13 @@
</tbody>
</table>
<p>Multiline table with caption:</p>
<table style="width:79%;">
<table style="width:80%;">
<caption>Heres the caption. It may span multiple lines.</caption>
<colgroup>
<col width="15%" />
<col width="13%" />
<col width="16%" />
<col width="33%" />
<col width="35%" />
</colgroup>
<thead>
<tr class="header">
@ -126,12 +126,12 @@
</tbody>
</table>
<p>Multiline table without caption:</p>
<table style="width:79%;">
<table style="width:80%;">
<colgroup>
<col width="15%" />
<col width="13%" />
<col width="16%" />
<col width="33%" />
<col width="35%" />
</colgroup>
<thead>
<tr class="header">
@ -180,12 +180,12 @@
</tbody>
</table>
<p>Multiline table without column headers:</p>
<table style="width:79%;">
<table style="width:80%;">
<colgroup>
<col width="15%" />
<col width="13%" />
<col width="16%" />
<col width="33%" />
<col width="35%" />
</colgroup>
<tbody>
<tr class="odd">

View file

@ -94,13 +94,13 @@
</tbody>
</table>
<p>Multiline table with caption:</p>
<table style="width:79%;">
<table style="width:80%;">
<caption>Heres the caption. It may span multiple lines.</caption>
<colgroup>
<col style="width: 15%" />
<col style="width: 13%" />
<col style="width: 16%" />
<col style="width: 33%" />
<col style="width: 35%" />
</colgroup>
<thead>
<tr class="header">
@ -126,12 +126,12 @@
</tbody>
</table>
<p>Multiline table without caption:</p>
<table style="width:79%;">
<table style="width:80%;">
<colgroup>
<col style="width: 15%" />
<col style="width: 13%" />
<col style="width: 16%" />
<col style="width: 33%" />
<col style="width: 35%" />
</colgroup>
<thead>
<tr class="header">
@ -180,12 +180,12 @@
</tbody>
</table>
<p>Multiline table without column headers:</p>
<table style="width:79%;">
<table style="width:80%;">
<colgroup>
<col style="width: 15%" />
<col style="width: 13%" />
<col style="width: 16%" />
<col style="width: 33%" />
<col style="width: 35%" />
</colgroup>
<tbody>
<tr class="odd">

View file

@ -395,7 +395,7 @@
<Column Name="0" SingleColumnWidth="75.0" />
<Column Name="1" SingleColumnWidth="68.75" />
<Column Name="2" SingleColumnWidth="81.25" />
<Column Name="3" SingleColumnWidth="168.75" />
<Column Name="3" SingleColumnWidth="175.0" />
<Cell Name="0:0" AppliedCellStyle="CellStyle/Cell">
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; CenterAlign">
<CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
@ -497,7 +497,7 @@
<Column Name="0" SingleColumnWidth="75.0" />
<Column Name="1" SingleColumnWidth="68.75" />
<Column Name="2" SingleColumnWidth="81.25" />
<Column Name="3" SingleColumnWidth="168.75" />
<Column Name="3" SingleColumnWidth="175.0" />
<Cell Name="0:0" AppliedCellStyle="CellStyle/Cell">
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; TableHeader &gt; CenterAlign">
<CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">
@ -695,7 +695,7 @@
<Column Name="0" SingleColumnWidth="75.0" />
<Column Name="1" SingleColumnWidth="68.75" />
<Column Name="2" SingleColumnWidth="81.25" />
<Column Name="3" SingleColumnWidth="168.75" />
<Column Name="3" SingleColumnWidth="175.0" />
<Cell Name="0:0" AppliedCellStyle="CellStyle/Cell">
<ParagraphStyleRange AppliedParagraphStyle="ParagraphStyle/TablePar &gt; CenterAlign">
<CharacterStyleRange AppliedCharacterStyle="$ID/NormalCharacterStyle">

View file

@ -122,7 +122,7 @@
<col width="15*" align="center" />
<col width="13*" align="left" />
<col width="16*" align="right" />
<col width="33*" align="left" />
<col width="35*" align="left" />
<thead>
<tr>
<th>Centered Header</th>
@ -152,7 +152,7 @@
<col width="15*" align="center" />
<col width="13*" align="left" />
<col width="16*" align="right" />
<col width="33*" align="left" />
<col width="35*" align="left" />
<thead>
<tr>
<th>Centered Header</th>
@ -208,7 +208,7 @@
<col width="15*" align="center" />
<col width="13*" align="left" />
<col width="16*" align="right" />
<col width="33*" align="left" />
<col width="35*" align="left" />
<tbody>
<tr>
<td>First</td>

View file

@ -58,7 +58,7 @@ Centered Header\strut
Left Aligned\strut
\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft
Right Aligned\strut
\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright
\end{minipage} & \begin{minipage}[b]{0.31\columnwidth}\raggedright
Default aligned\strut
\end{minipage}\tabularnewline
\midrule
@ -70,7 +70,7 @@ Centered Header\strut
Left Aligned\strut
\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft
Right Aligned\strut
\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright
\end{minipage} & \begin{minipage}[b]{0.31\columnwidth}\raggedright
Default aligned\strut
\end{minipage}\tabularnewline
\midrule
@ -81,7 +81,7 @@ First\strut
row\strut
\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
12.0\strut
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
\end{minipage} & \begin{minipage}[t]{0.31\columnwidth}\raggedright
Example of a row that spans multiple lines.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\centering
@ -90,7 +90,7 @@ Second\strut
row\strut
\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
5.0\strut
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
\end{minipage} & \begin{minipage}[t]{0.31\columnwidth}\raggedright
Here's another one. Note the blank line between rows.\strut
\end{minipage}\tabularnewline
\bottomrule
@ -106,7 +106,7 @@ Centered Header\strut
Left Aligned\strut
\end{minipage} & \begin{minipage}[b]{0.14\columnwidth}\raggedleft
Right Aligned\strut
\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright
\end{minipage} & \begin{minipage}[b]{0.31\columnwidth}\raggedright
Default aligned\strut
\end{minipage}\tabularnewline
\midrule
@ -117,7 +117,7 @@ First\strut
row\strut
\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
12.0\strut
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
\end{minipage} & \begin{minipage}[t]{0.31\columnwidth}\raggedright
Example of a row that spans multiple lines.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\centering
@ -126,7 +126,7 @@ Second\strut
row\strut
\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
5.0\strut
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
\end{minipage} & \begin{minipage}[t]{0.31\columnwidth}\raggedright
Here's another one. Note the blank line between rows.\strut
\end{minipage}\tabularnewline
\bottomrule
@ -154,7 +154,7 @@ First\strut
row\strut
\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
12.0\strut
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
\end{minipage} & \begin{minipage}[t]{0.31\columnwidth}\raggedright
Example of a row that spans multiple lines.\strut
\end{minipage}\tabularnewline
\begin{minipage}[t]{0.13\columnwidth}\centering
@ -163,7 +163,7 @@ Second\strut
row\strut
\end{minipage} & \begin{minipage}[t]{0.14\columnwidth}\raggedleft
5.0\strut
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
\end{minipage} & \begin{minipage}[t]{0.31\columnwidth}\raggedright
Here's another one. Note the blank line between rows.\strut
\end{minipage}\tabularnewline
\bottomrule

View file

@ -138,7 +138,7 @@ Multiline table with caption:
Here's the caption. It may span multiple lines.
.TS
tab(@);
cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
cw(10.5n) lw(9.6n) rw(11.4n) lw(24.5n).
T{
Centered Header
T}@T{
@ -174,7 +174,7 @@ Multiline table without caption:
.PP
.TS
tab(@);
cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
cw(10.5n) lw(9.6n) rw(11.4n) lw(24.5n).
T{
Centered Header
T}@T{
@ -244,7 +244,7 @@ Multiline table without column headers:
.PP
.TS
tab(@);
cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
cw(10.5n) lw(9.6n) rw(11.4n) lw(24.5n).
T{
First
T}@T{

View file

@ -79,7 +79,7 @@ Multiline table with caption:
!align="center" width="15%"| Centered Header
!width="13%"| Left Aligned
!align="right" width="16%"| Right Aligned
!width="33%"| Default aligned
!width="35%"| Default aligned
|-
|align="center"| First
| row
@ -98,7 +98,7 @@ Multiline table without caption:
!align="center" width="15%"| Centered Header
!width="13%"| Left Aligned
!align="right" width="16%"| Right Aligned
!width="33%"| Default aligned
!width="35%"| Default aligned
|-
|align="center"| First
| row
@ -136,7 +136,7 @@ Multiline table without column headers:
|align="center" width="15%"| First
|width="13%"| row
|align="right" width="16%"| 12.0
|width="33%"| Example of a row that spans multiple lines.
|width="35%"| Example of a row that spans multiple lines.
|-
|align="center"| Second
| row

View file

@ -138,7 +138,7 @@ Multiline table with caption:
Heres the caption. It may span multiple lines.
.TS
delim(@@) tab( );
cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
cw(10.5n) lw(9.6n) rw(11.4n) lw(24.5n).
T{
Centered Header
T} T{
@ -174,7 +174,7 @@ Multiline table without caption:
.PP
.TS
delim(@@) tab( );
cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
cw(10.5n) lw(9.6n) rw(11.4n) lw(24.5n).
T{
Centered Header
T} T{
@ -244,7 +244,7 @@ Multiline table without column headers:
.PP
.TS
delim(@@) tab( );
cw(10.5n) lw(9.6n) rw(11.4n) lw(23.6n).
cw(10.5n) lw(9.6n) rw(11.4n) lw(24.5n).
T{
First
T} T{

View file

@ -53,7 +53,7 @@
,[Plain [Str "1"]]
,[Plain [Str "1"]]]]
,Para [Str "Multiline",Space,Str "table",Space,Str "with",Space,Str "caption:"]
,Table [Str "Here\8217s",Space,Str "the",Space,Str "caption.",SoftBreak,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."] [AlignCenter,AlignLeft,AlignRight,AlignLeft] [0.15,0.1375,0.1625,0.3375]
,Table [Str "Here\8217s",Space,Str "the",Space,Str "caption.",SoftBreak,Str "It",Space,Str "may",Space,Str "span",Space,Str "multiple",Space,Str "lines."] [AlignCenter,AlignLeft,AlignRight,AlignLeft] [0.15,0.1375,0.1625,0.35]
[[Plain [Str "Centered",SoftBreak,Str "Header"]]
,[Plain [Str "Left",SoftBreak,Str "Aligned"]]
,[Plain [Str "Right",SoftBreak,Str "Aligned"]]
@ -67,7 +67,7 @@
,[Plain [Str "5.0"]]
,[Plain [Str "Here\8217s",Space,Str "another",Space,Str "one.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",Space,Str "rows."]]]]
,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption:"]
,Table [] [AlignCenter,AlignLeft,AlignRight,AlignLeft] [0.15,0.1375,0.1625,0.3375]
,Table [] [AlignCenter,AlignLeft,AlignRight,AlignLeft] [0.15,0.1375,0.1625,0.35]
[[Plain [Str "Centered",SoftBreak,Str "Header"]]
,[Plain [Str "Left",SoftBreak,Str "Aligned"]]
,[Plain [Str "Right",SoftBreak,Str "Aligned"]]
@ -99,7 +99,7 @@
,[Plain [Str "1"]]
,[Plain [Str "1"]]]]
,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "column",Space,Str "headers:"]
,Table [] [AlignCenter,AlignLeft,AlignRight,AlignDefault] [0.15,0.1375,0.1625,0.3375]
,Table [] [AlignCenter,AlignLeft,AlignRight,AlignDefault] [0.15,0.1375,0.1625,0.35]
[[]
,[]
,[]

View file

@ -28,33 +28,33 @@ Simple table indented two spaces:
Multiline table with caption:
-------------------------------------------------------------
--------------------------------------------------------------
Centered Left Right Default aligned
Header Aligned Aligned
----------- ---------- ------------ -------------------------
----------- ---------- ------------ --------------------------
First row 12.0 Example of a row that
spans multiple lines.
Second row 5.0 Heres another one. Note
the blank line between
rows.
-------------------------------------------------------------
--------------------------------------------------------------
: Heres the caption. It may span multiple lines.
Multiline table without caption:
-------------------------------------------------------------
--------------------------------------------------------------
Centered Left Right Default aligned
Header Aligned Aligned
----------- ---------- ------------ -------------------------
----------- ---------- ------------ --------------------------
First row 12.0 Example of a row that
spans multiple lines.
Second row 5.0 Heres another one. Note
the blank line between
rows.
-------------------------------------------------------------
--------------------------------------------------------------
Table without column headers:
@ -66,11 +66,11 @@ Table without column headers:
Multiline table without column headers:
----------- ---------- ------------ -------------------------
----------- ---------- ------------ --------------------------
First row 12.0 Example of a row that
spans multiple lines.
Second row 5.0 Heres another one. Note
the blank line between
rows.
----------- ---------- ------------ -------------------------
----------- ---------- ------------ --------------------------

View file

@ -42,31 +42,31 @@ Multiline table with caption:
.. table:: Heres the caption. It may span multiple lines.
+----------+---------+-----------+-------------------------+
| Centered | Left | Right | Default aligned |
| Header | Aligned | Aligned | |
+==========+=========+===========+=========================+
| First | row | 12.0 | Example of a row that |
| | | | spans multiple lines. |
+----------+---------+-----------+-------------------------+
| Second | row | 5.0 | Heres another one. |
| | | | Note the blank line |
| | | | between rows. |
+----------+---------+-----------+-------------------------+
+----------+---------+-----------+--------------------------+
| Centered | Left | Right | Default aligned |
| Header | Aligned | Aligned | |
+==========+=========+===========+==========================+
| First | row | 12.0 | Example of a row that |
| | | | spans multiple lines. |
+----------+---------+-----------+--------------------------+
| Second | row | 5.0 | Heres another one. Note |
| | | | the blank line between |
| | | | rows. |
+----------+---------+-----------+--------------------------+
Multiline table without caption:
+----------+---------+-----------+-------------------------+
| Centered | Left | Right | Default aligned |
| Header | Aligned | Aligned | |
+==========+=========+===========+=========================+
| First | row | 12.0 | Example of a row that |
| | | | spans multiple lines. |
+----------+---------+-----------+-------------------------+
| Second | row | 5.0 | Heres another one. |
| | | | Note the blank line |
| | | | between rows. |
+----------+---------+-----------+-------------------------+
+----------+---------+-----------+--------------------------+
| Centered | Left | Right | Default aligned |
| Header | Aligned | Aligned | |
+==========+=========+===========+==========================+
| First | row | 12.0 | Example of a row that |
| | | | spans multiple lines. |
+----------+---------+-----------+--------------------------+
| Second | row | 5.0 | Heres another one. Note |
| | | | the blank line between |
| | | | rows. |
+----------+---------+-----------+--------------------------+
Table without column headers:
@ -80,11 +80,11 @@ Table without column headers:
Multiline table without column headers:
+----------+---------+-----------+-------------------------+
| First | row | 12.0 | Example of a row that |
| | | | spans multiple lines. |
+----------+---------+-----------+-------------------------+
| Second | row | 5.0 | Heres another one. |
| | | | Note the blank line |
| | | | between rows. |
+----------+---------+-----------+-------------------------+
+----------+---------+-----------+--------------------------+
| First | row | 12.0 | Example of a row that |
| | | | spans multiple lines. |
+----------+---------+-----------+--------------------------+
| Second | row | 5.0 | Heres another one. Note |
| | | | the blank line between |
| | | | rows. |
+----------+---------+-----------+--------------------------+

View file

@ -187,7 +187,7 @@
{\pard \ql \f0 \sa180 \li0 \fi0 Multiline table with caption:\par}
{
\trowd \trgaph120
\clbrdrb\brdrs\cellx1296\clbrdrb\brdrs\cellx2484\clbrdrb\brdrs\cellx3888\clbrdrb\brdrs\cellx6804
\clbrdrb\brdrs\cellx1296\clbrdrb\brdrs\cellx2484\clbrdrb\brdrs\cellx3888\clbrdrb\brdrs\cellx6912
\trkeep\intbl
{
{{\pard\intbl \qc \f0 \sa0 \li0 \fi0 Centered Header\par}
@ -202,7 +202,7 @@
\intbl\row}
{
\trowd \trgaph120
\cellx1296\cellx2484\cellx3888\cellx6804
\cellx1296\cellx2484\cellx3888\cellx6912
\trkeep\intbl
{
{{\pard\intbl \qc \f0 \sa0 \li0 \fi0 First\par}
@ -217,7 +217,7 @@
\intbl\row}
{
\trowd \trgaph120
\cellx1296\cellx2484\cellx3888\cellx6804
\cellx1296\cellx2484\cellx3888\cellx6912
\trkeep\intbl
{
{{\pard\intbl \qc \f0 \sa0 \li0 \fi0 Second\par}
@ -234,7 +234,7 @@
{\pard \ql \f0 \sa180 \li0 \fi0 Multiline table without caption:\par}
{
\trowd \trgaph120
\clbrdrb\brdrs\cellx1296\clbrdrb\brdrs\cellx2484\clbrdrb\brdrs\cellx3888\clbrdrb\brdrs\cellx6804
\clbrdrb\brdrs\cellx1296\clbrdrb\brdrs\cellx2484\clbrdrb\brdrs\cellx3888\clbrdrb\brdrs\cellx6912
\trkeep\intbl
{
{{\pard\intbl \qc \f0 \sa0 \li0 \fi0 Centered Header\par}
@ -249,7 +249,7 @@
\intbl\row}
{
\trowd \trgaph120
\cellx1296\cellx2484\cellx3888\cellx6804
\cellx1296\cellx2484\cellx3888\cellx6912
\trkeep\intbl
{
{{\pard\intbl \qc \f0 \sa0 \li0 \fi0 First\par}
@ -264,7 +264,7 @@
\intbl\row}
{
\trowd \trgaph120
\cellx1296\cellx2484\cellx3888\cellx6804
\cellx1296\cellx2484\cellx3888\cellx6912
\trkeep\intbl
{
{{\pard\intbl \qc \f0 \sa0 \li0 \fi0 Second\par}
@ -328,7 +328,7 @@
{\pard \ql \f0 \sa180 \li0 \fi0 Multiline table without column headers:\par}
{
\trowd \trgaph120
\cellx1296\cellx2484\cellx3888\cellx6804
\cellx1296\cellx2484\cellx3888\cellx6912
\trkeep\intbl
{
{{\pard\intbl \qc \f0 \sa0 \li0 \fi0 First\par}
@ -343,7 +343,7 @@
\intbl\row}
{
\trowd \trgaph120
\cellx1296\cellx2484\cellx3888\cellx6804
\cellx1296\cellx2484\cellx3888\cellx6912
\trkeep\intbl
{
{{\pard\intbl \qc \f0 \sa0 \li0 \fi0 Second\par}

View file

@ -83,7 +83,7 @@ Right
Multiline table with caption:
@float
@multitable @columnfractions 0.15 0.14 0.16 0.34
@multitable @columnfractions 0.15 0.14 0.16 0.35
@headitem
Centered Header
@tab Left Aligned
@ -104,7 +104,7 @@ Second
@end float
Multiline table without caption:
@multitable @columnfractions 0.15 0.14 0.16 0.34
@multitable @columnfractions 0.15 0.14 0.16 0.35
@headitem
Centered Header
@tab Left Aligned
@ -144,7 +144,7 @@ Table without column headers:
Multiline table without column headers:
@multitable @columnfractions 0.15 0.14 0.16 0.34
@multitable @columnfractions 0.15 0.14 0.16 0.35
@item
First
@tab row

View file

@ -80,7 +80,7 @@ Multiline table with caption:
<col width="15%" />
<col width="13%" />
<col width="16%" />
<col width="33%" />
<col width="35%" />
<thead>
<tr class="header">
<th align="center">Centered Header</th>
@ -111,7 +111,7 @@ Multiline table without caption:
<col width="15%" />
<col width="13%" />
<col width="16%" />
<col width="33%" />
<col width="35%" />
<thead>
<tr class="header">
<th align="center">Centered Header</th>
@ -148,7 +148,7 @@ Multiline table without column headers:
<col width="15%" />
<col width="13%" />
<col width="16%" />
<col width="33%" />
<col width="35%" />
<tbody>
<tr class="odd">
<td align="center">First</td>