@@ -21,7 +21,8 @@ import Test.Tasty.QuickCheck
21import Test.Tasty.Options (IsOption(defaultValue))
21import Test.Tasty.Options (IsOption(defaultValue))
22import Tests.Helpers
22import Tests.Helpers
23import Text.Pandoc
23import Text.Pandoc
24+import Text.Pandoc.Writers.Shared (toLegacyTable)
24−import Text.Pandoc.Shared (isHeaderBlock)
25+import Text.Pandoc.Shared (isHeaderBlock, onlySimpleTableCells)
25import Text.Pandoc.Arbitrary ()
26import Text.Pandoc.Arbitrary ()
26import Text.Pandoc.Builder
27import Text.Pandoc.Builder
27import Text.Pandoc.Walk (walk)
28import Text.Pandoc.Walk (walk)
@@ -36,16 +37,19 @@ makeRoundTrip :: Block -> Block
36makeRoundTrip CodeBlock{} = Para [Str "code block was here"]
37makeRoundTrip CodeBlock{} = Para [Str "code block was here"]
37makeRoundTrip LineBlock{} = Para [Str "line block was here"]
38makeRoundTrip LineBlock{} = Para [Str "line block was here"]
38makeRoundTrip RawBlock{} = Para [Str "raw block was here"]
39makeRoundTrip RawBlock{} = Para [Str "raw block was here"]
39−makeRoundTrip b@Table{} = walk rmLineBreaks b
40makeRoundTrip (Div attr bs) = Div attr $ filter (not . isHeaderBlock) bs
40makeRoundTrip (Div attr bs) = Div attr $ filter (not . isHeaderBlock) bs
41-- avoids round-trip failures related to makeSections
41-- avoids round-trip failures related to makeSections
42-- e.g. with [Div ("loc",[],[("a","11"),("b_2","a b c")]) [Header 3 ("",[],[]) []]]
42-- 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')
48+ if all (== 0.0) widths && not isSimple
49+ then Para [Str "weird table omitted"]
43makeRoundTrip x = x
51makeRoundTrip x = x
45−rmLineBreaks :: Inline -> Inline
46−rmLineBreaks LineBreak = SoftBreak
49removeRawInlines :: Inline -> Inline
53removeRawInlines :: Inline -> Inline
50removeRawInlines RawInline{} = Str "raw inline was here"
54removeRawInlines RawInline{} = Str "raw inline was here"
51removeRawInlines x = x
55removeRawInlines x = x