git.iko.soy/typeable/pandoc
on master help sign in
HTML reader tests: disable round-trip testing for tables
0eedbd0Albert Krewinkel
test/Tests/Readers/HTML.hs+3−11
@@ -21,8 +21,7 @@ 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)
25−import Text.Pandoc.Shared (isHeaderBlock, onlySimpleTableCells)
24+import Text.Pandoc.Shared (isHeaderBlock)
26import Text.Pandoc.Arbitrary ()
25import Text.Pandoc.Arbitrary ()
27import Text.Pandoc.Builder
26import Text.Pandoc.Builder
28import Text.Pandoc.Walk (walk)
27import Text.Pandoc.Walk (walk)
@@ -40,14 +39,7 @@ makeRoundTrip RawBlock{} = Para [Str "raw block was here"]
40makeRoundTrip (Div attr bs) = Div attr $ filter (not . isHeaderBlock) bs
39makeRoundTrip (Div attr bs) = Div attr $ filter (not . isHeaderBlock) bs
41-- avoids round-trip failures related to makeSections
40-- avoids round-trip failures related to makeSections
42-- e.g. with [Div ("loc",[],[("a","11"),("b_2","a b c")]) [Header 3 ("",[],[]) []]]
41-- e.g. with [Div ("loc",[],[("a","11"),("b_2","a b c")]) [Header 3 ("",[],[]) []]]
43−makeRoundTrip b@(Table _attr blkCapt specs thead tbody tfoot) =
42+makeRoundTrip Table{} = Para [Str "table block was here"]
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
51makeRoundTrip x = x
43makeRoundTrip x = x
52
44
53removeRawInlines :: Inline -> Inline
45removeRawInlines :: Inline -> Inline
@@ -61,7 +53,7 @@ roundTrip b = d'' == d'''
61 d' = rewrite d
53 d' = rewrite d
62 d'' = rewrite d'
54 d'' = rewrite d'
63 d''' = rewrite d''
55 d''' = rewrite d''
64− rewrite = html . T.pack . (++ "\n") . T.unpack .
56+ rewrite = html . (`T.snoc` '\n') .
65 purely (writeHtml5String def
57 purely (writeHtml5String def
66 { writerWrapText = WrapPreserve })
58 { writerWrapText = WrapPreserve })
67
59