diff options
author | Mauro Bieg <mb21@users.noreply.github.com> | 2019-05-27 19:53:19 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-05-27 13:53:19 -0400 |
commit | d07ed83d705df491bba7b295bd5e80629d971685 (patch) | |
tree | 3964c08ea82627577df4b3c843f19e6a0d7ca977 /src/Text/Pandoc/Readers | |
parent | f807f5b3833e841d9e6b831acbe50f3be8e42881 (diff) | |
download | pandoc-d07ed83d705df491bba7b295bd5e80629d971685.tar.gz |
consolidate simple-table detection (#5524)
add `onlySimpleTableCells` to `Text.Pandoc.Shared`
[API change]
This fixes an inconsistency in the HTML reader, which did not treat tables with `<p>` inside cells as simple.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/HTML.hs | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index c1478ebc4..474bda3de 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -61,7 +61,7 @@ import Text.Pandoc.Options ( extensionEnabled) import Text.Pandoc.Parsing hiding ((<|>)) import Text.Pandoc.Shared (addMetaField, blocksToInlines', crFilter, escapeURI, - extractSpaces, safeRead, underlineSpan) + extractSpaces, onlySimpleTableCells, safeRead, underlineSpan) import Text.Pandoc.Walk import Text.Parsec.Error import Text.TeXMath (readMathML, writeTeX) @@ -488,14 +488,9 @@ pTable = try $ do TagClose _ <- pSatisfy (matchTagClose "table") let rows'' = concat rowsLs <> topfoot <> bottomfoot let rows''' = map (map snd) rows'' - -- let rows''' = map (map snd) rows'' -- fail on empty table guard $ not $ null head' && null rows''' - let isSinglePlain x = case B.toList x of - [] -> True - [Plain _] -> True - _ -> False - let isSimple = all isSinglePlain $ concat (head':rows''') + let isSimple = onlySimpleTableCells $ fmap B.toList <$> head':rows''' let cols = if null head' then maximum (map length rows''') else length head' |