diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-21 14:16:46 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-21 14:16:46 +0100 |
commit | daf8d1db18efcfbac31afd6a2323411b93ce1b62 (patch) | |
tree | 6f366dc489640c92cd2f1b50fb02d55f578cf3cc /test | |
parent | d3798a044db281d2217c2d64ab1c5380d1df7a70 (diff) | |
download | pandoc-daf8d1db18efcfbac31afd6a2323411b93ce1b62.tar.gz |
RST writer: improve grid table output, fix bug with empty rows.
Uses the new gridTable in Writers.Shared, which is here
improved to better handle 0-width cells.
Closes #3516.
Diffstat (limited to 'test')
-rw-r--r-- | test/command/3516.md | 15 | ||||
-rw-r--r-- | test/tables-rstsubset.native | 12 | ||||
-rw-r--r-- | test/tables.rst | 60 |
3 files changed, 51 insertions, 36 deletions
diff --git a/test/command/3516.md b/test/command/3516.md new file mode 100644 index 000000000..d547ddbb1 --- /dev/null +++ b/test/command/3516.md @@ -0,0 +1,15 @@ +Correctly handle empty row: +``` +% pandoc -f markdown -t rst ++---+---+ +| 1 | 2 | ++---+---+ +| | | ++---+---+ +^D ++---+---+ +| 1 | 2 | ++---+---+ +| | | ++---+---+ +``` diff --git a/test/tables-rstsubset.native b/test/tables-rstsubset.native index 65ced24af..4f095c798 100644 --- a/test/tables-rstsubset.native +++ b/test/tables-rstsubset.native @@ -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.175,0.1625,0.1875,0.3625] +,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] [[Plain [Str "Centered",Space,Str "Header"]] ,[Plain [Str "Left",Space,Str "Aligned"]] ,[Plain [Str "Right",Space,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.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]] + ,[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."]]]] ,Para [Str "Multiline",Space,Str "table",Space,Str "without",Space,Str "caption:"] -,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.175,0.1625,0.1875,0.3625] +,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1375,0.125,0.15,0.325] [[Plain [Str "Centered",Space,Str "Header"]] ,[Plain [Str "Left",Space,Str "Aligned"]] ,[Plain [Str "Right",Space,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.",Space,Str "Note",SoftBreak,Str "the",Space,Str "blank",Space,Str "line",Space,Str "between",SoftBreak,Str "rows."]]]] + ,[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."]]]] ,Para [Str "Table",Space,Str "without",Space,Str "column",Space,Str "headers:"] ,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1,0.1,0.1,0.1] [[] @@ -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.175,0.1625,0.1875,0.3625] +,Table [] [AlignDefault,AlignDefault,AlignDefault,AlignDefault] [0.1375,0.125,0.15,0.325] [[] ,[] ,[] @@ -111,4 +111,4 @@ ,[[Plain [Str "Second"]] ,[Plain [Str "row"]] ,[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",SoftBreak,Str "rows."]]]]] + ,[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."]]]]] diff --git a/test/tables.rst b/test/tables.rst index 184d9894a..eaef50d28 100644 --- a/test/tables.rst +++ b/test/tables.rst @@ -42,31 +42,31 @@ Multiline table with caption: .. table:: Here’s 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 | Here’s 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 | Here’s 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 | Here’s 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 | Here’s 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 | Here’s another one. Note | -| | | | the blank line between | -| | | | rows. | -+-------------+------------+--------------+----------------------------+ ++----------+---------+-----------+-------------------------+ +| First | row | 12.0 | Example of a row that | +| | | | spans multiple lines. | ++----------+---------+-----------+-------------------------+ +| Second | row | 5.0 | Here’s another one. | +| | | | Note the blank line | +| | | | between rows. | ++----------+---------+-----------+-------------------------+ |