diff options
author | despresc <christian.j.j.despres@gmail.com> | 2020-04-09 20:08:49 -0400 |
---|---|---|
committer | despresc <christian.j.j.despres@gmail.com> | 2020-04-15 23:03:22 -0400 |
commit | c7814f31e155da212bd3323294db08fe1f4d8ab9 (patch) | |
tree | 9b933ba5d6071bf7e8ca6a17af71cc2780174e7f /test/Tests/Writers | |
parent | d368536a4ebfc542a58bd9bec6718590711c6efb (diff) | |
download | pandoc-c7814f31e155da212bd3323294db08fe1f4d8ab9.tar.gz |
Use the new builders, modify readers to preserve empty headers
The Builder.simpleTable now only adds a row to the TableHead when the
given header row is not null. This uncovered an inconsistency in the
readers: some would unconditionally emit a header filled with empty
cells, even if the header was not present. Now every reader has the
conditional behaviour. Only the XWiki writer depended on the header
row being always present; it now pads its head as necessary.
Diffstat (limited to 'test/Tests/Writers')
-rw-r--r-- | test/Tests/Writers/ConTeXt.hs | 7 | ||||
-rw-r--r-- | test/Tests/Writers/Muse.hs | 24 |
2 files changed, 22 insertions, 9 deletions
diff --git a/test/Tests/Writers/ConTeXt.hs b/test/Tests/Writers/ConTeXt.hs index cc90b95a9..c747e5d2f 100644 --- a/test/Tests/Writers/ConTeXt.hs +++ b/test/Tests/Writers/ConTeXt.hs @@ -116,7 +116,12 @@ tests = [ testGroup "inline code" plain $ text "3.2", plain $ text "3.3", plain $ text "3.4"]] - in table capt aligns headers rows + toRow = Row nullAttr . map simpleCell + in table (simpleCaption $ plain capt) + aligns + (TableHead nullAttr [toRow headers]) + [TableBody nullAttr 0 [] $ map toRow rows] + (TableFoot nullAttr []) =?> unlines [ "\\startplacetable[title={Table 1}]" , "\\startTABLE" , "\\startTABLEhead" diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs index 42748ad85..d0df0799f 100644 --- a/test/Tests/Writers/Muse.hs +++ b/test/Tests/Writers/Muse.hs @@ -372,8 +372,12 @@ tests = [ testGroup "block elements" [ "table without header" =: let rows = [[para "Para 1.1", para "Para 1.2"] ,[para "Para 2.1", para "Para 2.2"]] - in table mempty [(AlignDefault,ColWidthDefault),(AlignDefault,ColWidthDefault)] - [mempty, mempty] rows + toRow = Row nullAttr . map simpleCell + in table emptyCaption + [(AlignDefault,ColWidthDefault),(AlignDefault,ColWidthDefault)] + (TableHead nullAttr [toRow [mempty, mempty]]) + [TableBody nullAttr 0 [] $ map toRow rows] + (TableFoot nullAttr []) =?> unlines [ " Para 1.1 | Para 1.2" , " Para 2.1 | Para 2.2" @@ -389,12 +393,16 @@ tests = [ testGroup "block elements" , " Para 2.1 | Para 2.2" ] , "table with header and caption" =: - let capt = "Table 1" - headers = [plain "header 1", plain "header 2"] - rows = [[para "Para 1.1", para "Para 1.2"] - ,[para "Para 2.1", para "Para 2.2"]] - in table capt [(AlignDefault,ColWidthDefault),(AlignDefault,ColWidthDefault)] - headers rows + let capt = simpleCaption $ plain "Table 1" + toRow = Row nullAttr . map simpleCell + headers = [toRow [plain "header 1", plain "header 2"]] + rows = map toRow [[para "Para 1.1", para "Para 1.2"] + ,[para "Para 2.1", para "Para 2.2"]] + in table capt + [(AlignDefault,ColWidthDefault),(AlignDefault,ColWidthDefault)] + (TableHead nullAttr headers) + [TableBody nullAttr 0 [] rows] + (TableFoot nullAttr []) =?> unlines [ " header 1 || header 2" , " Para 1.1 | Para 1.2" , " Para 2.1 | Para 2.2" |