git.iko.soy/typeable/pandoc
on master help sign in
HTML reader: allow tfoot before body rows.

Closes #5079.

commitd532eb14ebaca9e6255b428d40e22284a8a981d2 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 16 Nov 2018, 11:29 (8 years ago) parente61f632
2 files changed+19−2
src/Text/Pandoc/Readers/HTML.hs+3−2 test/command/5079.md+16
src/Text/Pandoc/Readers/HTML.hs+3−2
@@ -501,10 +501,11 @@ pTable = try $ do
501501 head' <- map snd <$>
502502 pInTag True "tbody"
503503 (if null head'' then pTh else return head'')
504+ topfoot <- option [] $ pInTag False "tfoot" $ many pTr
504505 rowsLs <- many pTBody
505− rows' <- pInTag True "tfoot" $ many pTr
506+ bottomfoot <- option [] $ pInTag False "tfoot" $ many pTr
506507 TagClose _ <- pSatisfy (matchTagClose "table")
507− let rows'' = concat rowsLs <> rows'
508+ let rows'' = concat rowsLs <> topfoot <> bottomfoot
508509 let rows''' = map (map snd) rows''
509510 -- let rows''' = map (map snd) rows''
510511 -- fail on empty table
test/command/5079.mdnew file+16
@@ -0,0 +1,16 @@
1+```
2+% pandoc -f html -t native
3+<table>
4+<tfoot>
5+</tfoot>
6+<tbody>
7+<tr>
8+<td>Cell</td>
9+</tr>
10+</tbody>
11+</table>
12+^D
13+[Table [] [AlignDefault] [0.0]
14+ [[]]
15+ [[[Plain [Str "Cell"]]]]]
16+```