From d532eb14ebaca9e6255b428d40e22284a8a981d2 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 16 Nov 2018 11:29:15 -0800 Subject: HTML reader: allow tfoot before body rows. Closes #5079. --- src/Text/Pandoc/Readers/HTML.hs | 5 +++-- test/command/5079.md | 16 ++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 test/command/5079.md diff --git a/src/Text/Pandoc/Readers/HTML.hs b/src/Text/Pandoc/Readers/HTML.hs index 2ae79bebd..b668641c8 100644 --- a/src/Text/Pandoc/Readers/HTML.hs +++ b/src/Text/Pandoc/Readers/HTML.hs @@ -501,10 +501,11 @@ pTable = try $ do head' <- map snd <$> pInTag True "tbody" (if null head'' then pTh else return head'') + topfoot <- option [] $ pInTag False "tfoot" $ many pTr rowsLs <- many pTBody - rows' <- pInTag True "tfoot" $ many pTr + bottomfoot <- option [] $ pInTag False "tfoot" $ many pTr TagClose _ <- pSatisfy (matchTagClose "table") - let rows'' = concat rowsLs <> rows' + let rows'' = concat rowsLs <> topfoot <> bottomfoot let rows''' = map (map snd) rows'' -- let rows''' = map (map snd) rows'' -- fail on empty table diff --git a/test/command/5079.md b/test/command/5079.md new file mode 100644 index 000000000..aa93ae6f3 --- /dev/null +++ b/test/command/5079.md @@ -0,0 +1,16 @@ +``` +% pandoc -f html -t native + + + + + + + + +
Cell
+^D +[Table [] [AlignDefault] [0.0] + [[]] + [[[Plain [Str "Cell"]]]]] +``` -- cgit v1.2.3