diff options
author | John MacFarlane <jgm@berkeley.edu> | 2020-04-17 10:04:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-17 10:04:39 -0700 |
commit | 906305de789c83f9fdcc2c7d30044acf97e89582 (patch) | |
tree | f359e991e60e7324f11e73a40259ed9dc3e4b91b /src/Text/Pandoc/Shared.hs | |
parent | f0f3cc14beeea51f703f7cfc8b40ebf3de2d0a05 (diff) | |
parent | d1521af8fb0d3e8ee4104224e4d5e0b6e6bfad8c (diff) | |
download | pandoc-906305de789c83f9fdcc2c7d30044acf97e89582.tar.gz |
Merge pull request #6224 from despresc/better-tables
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 8bd10e564..1593106de 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -667,7 +667,7 @@ stripEmptyParagraphs = walk go -- | Detect if table rows contain only cells consisting of a single -- paragraph that has no @LineBreak@. -onlySimpleTableCells :: [[TableCell]] -> Bool +onlySimpleTableCells :: [[[Block]]] -> Bool onlySimpleTableCells = all isSimpleCell . concat where isSimpleCell [Plain ils] = not (hasLineBreak ils) @@ -992,9 +992,14 @@ blockToInlines (DefinitionList pairslst) = mconcat (map blocksToInlines' blkslst) blockToInlines (Header _ _ ils) = B.fromList ils blockToInlines HorizontalRule = mempty -blockToInlines (Table _ _ _ headers rows) = +blockToInlines (Table _ _ _ (TableHead _ hbd) bodies (TableFoot _ fbd)) = mconcat $ intersperse B.linebreak $ - map (mconcat . map blocksToInlines') (headers:rows) + map (mconcat . map blocksToInlines') (plainRowBody <$> hbd <> unTableBodies bodies <> fbd) + where + plainRowBody (Row _ body) = cellBody <$> body + cellBody (Cell _ _ _ _ body) = body + unTableBody (TableBody _ _ hd bd) = hd <> bd + unTableBodies = concatMap unTableBody blockToInlines (Div _ blks) = blocksToInlines' blks blockToInlines Null = mempty @@ -1016,7 +1021,6 @@ defaultBlocksSeparator = -- there should be updated if this is changed. B.space <> B.str "ΒΆ" <> B.space - -- -- Safe read -- |