HTML reader tests: disable round-trip testing for tables

Information for cell alignment in a column is not preserved during
round-trips.
This commit is contained in:
Albert Krewinkel 2020-11-24 15:42:19 +01:00
parent c9f98e2bf5
commit 0eedbd0a3d
No known key found for this signature in database
GPG key ID: 388DC0B21F631124

View file

@ -21,8 +21,7 @@ import Test.Tasty.QuickCheck
import Test.Tasty.Options (IsOption(defaultValue))
import Tests.Helpers
import Text.Pandoc
import Text.Pandoc.Writers.Shared (toLegacyTable)
import Text.Pandoc.Shared (isHeaderBlock, onlySimpleTableCells)
import Text.Pandoc.Shared (isHeaderBlock)
import Text.Pandoc.Arbitrary ()
import Text.Pandoc.Builder
import Text.Pandoc.Walk (walk)
@ -40,14 +39,7 @@ makeRoundTrip RawBlock{} = Para [Str "raw block was here"]
makeRoundTrip (Div attr bs) = Div attr $ filter (not . isHeaderBlock) bs
-- avoids round-trip failures related to makeSections
-- e.g. with [Div ("loc",[],[("a","11"),("b_2","a b c")]) [Header 3 ("",[],[]) []]]
makeRoundTrip b@(Table _attr blkCapt specs thead tbody tfoot) =
let (_capt, _aligns, widths, headers, rows') =
toLegacyTable blkCapt specs thead tbody tfoot
isSimple = onlySimpleTableCells (headers:rows')
in
if all (== 0.0) widths && not isSimple
then Para [Str "weird table omitted"]
else b
makeRoundTrip Table{} = Para [Str "table block was here"]
makeRoundTrip x = x
removeRawInlines :: Inline -> Inline
@ -61,7 +53,7 @@ roundTrip b = d'' == d'''
d' = rewrite d
d'' = rewrite d'
d''' = rewrite d''
rewrite = html . T.pack . (++ "\n") . T.unpack .
rewrite = html . (`T.snoc` '\n') .
purely (writeHtml5String def
{ writerWrapText = WrapPreserve })