@@ -21,7 +21,8 @@ import Test.Tasty.QuickCheck
2121import Test.Tasty.Options (IsOption(defaultValue))
2222import Tests.Helpers
2323import Text.Pandoc
24−import Text.Pandoc.Shared (isHeaderBlock)
24+import Text.Pandoc.Writers.Shared (toLegacyTable)
25+import Text.Pandoc.Shared (isHeaderBlock, onlySimpleTableCells)
2526import Text.Pandoc.Arbitrary ()
2627import Text.Pandoc.Builder
2728import Text.Pandoc.Walk (walk)
@@ -36,16 +37,19 @@ makeRoundTrip :: Block -> Block
3637makeRoundTrip CodeBlock{} = Para [Str "code block was here"]
3738makeRoundTrip LineBlock{} = Para [Str "line block was here"]
3839makeRoundTrip RawBlock{} = Para [Str "raw block was here"]
39−makeRoundTrip b@Table{} = walk rmLineBreaks b
4040makeRoundTrip (Div attr bs) = Div attr $ filter (not . isHeaderBlock) bs
4141-- avoids round-trip failures related to makeSections
4242-- e.g. with [Div ("loc",[],[("a","11"),("b_2","a b c")]) [Header 3 ("",[],[]) []]]
43+makeRoundTrip b@(Table _attr blkCapt specs thead tbody tfoot) =
44+ let (_capt, _aligns, widths, headers, rows') =
45+ toLegacyTable blkCapt specs thead tbody tfoot
46+ isSimple = onlySimpleTableCells (headers:rows')
47+ in
48+ if all (== 0.0) widths && not isSimple
49+ then Para [Str "weird table omitted"]
50+ else b
4351makeRoundTrip x = x
4452
45−rmLineBreaks :: Inline -> Inline
46−rmLineBreaks LineBreak = SoftBreak
47−rmLineBreaks x = x
48−
4953removeRawInlines :: Inline -> Inline
5054removeRawInlines RawInline{} = Str "raw inline was here"
5155removeRawInlines x = x