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 /src/Text/Pandoc/Readers/JATS.hs | |
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 'src/Text/Pandoc/Readers/JATS.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/JATS.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/JATS.hs b/src/Text/Pandoc/Readers/JATS.hs index 24d2ef4a1..f78630ec0 100644 --- a/src/Text/Pandoc/Readers/JATS.hs +++ b/src/Text/Pandoc/Readers/JATS.hs @@ -280,11 +280,13 @@ parseBlock (Elem e) = Just ws' -> let tot = sum ws' in ColWidth . (/ tot) <$> ws' Nothing -> replicate numrows ColWidthDefault - let headrows' = if null headrows - then replicate numrows mempty - else headrows - return $ table capt (zip aligns widths) - headrows' bodyrows + let toRow = Row nullAttr . map simpleCell + toHeaderRow l = if null l then [] else [toRow l] + return $ table (simpleCaption $ plain capt) + (zip aligns widths) + (TableHead nullAttr $ toHeaderRow headrows) + [TableBody nullAttr 0 [] $ map toRow bodyrows] + (TableFoot nullAttr []) isEntry x = named "entry" x || named "td" x || named "th" x parseRow = mapM (parseMixed plain . elContent) . filterChildren isEntry sect n = do isbook <- gets jatsBook |