git.iko.soy/typeable/pandoc
on master help sign in
Markdown reader: fix pipe table regression in 2.11.4.

Previously pipe tables with empty headers (that is, a header line with all empty cells) would be rendered as headerless tables. This broke in 2.11.4. The fix here is to produce an AST with an empty table head when a pipe table has all empty header cells. Closes #7343.

commit2e4ef14d9112f230e336a1f3767f87293bdfb73e authorJohn MacFarlane <jgm@berkeley.edu> dateTue 1 Jun 2021, 21:44 (5 years ago) parentabb59bd
2 files changed+3−11
src/Text/Pandoc/Readers/Markdown.hs+1−1 test/pipe-tables.native+2−10
src/Text/Pandoc/Readers/Markdown.hs+1−1
@@ -2254,4 +2254,4 @@ toRow :: [Blocks] -> Row
22542254toRow = Row nullAttr . map B.simpleCell
22552255
22562256toHeaderRow :: [Blocks] -> [Row]
2257−toHeaderRow l = [toRow l | not (null l)]
2257+toHeaderRow l = [toRow l | not (null l) && not (all null l)]
test/pipe-tables.native+2−10
@@ -131,13 +131,7 @@
131131 ,(AlignLeft,ColWidthDefault)
132132 ,(AlignCenter,ColWidthDefault)]
133133 (TableHead ("",[],[])
134− [Row ("",[],[])
135− [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
136− []
137− ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
138− []
139− ,Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
140− []]])
134+ [])
141135 [(TableBody ("",[],[]) (RowHeadColumns 0)
142136 []
143137 [Row ("",[],[])
@@ -213,9 +207,7 @@
213207 [])
214208 [(AlignCenter,ColWidthDefault)]
215209 (TableHead ("",[],[])
216− [Row ("",[],[])
217− [Cell ("",[],[]) AlignDefault (RowSpan 1) (ColSpan 1)
218− []]])
210+ [])
219211 [(TableBody ("",[],[]) (RowHeadColumns 0)
220212 []
221213 [Row ("",[],[])