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:
parent
c9f98e2bf5
commit
0eedbd0a3d
1 changed files with 3 additions and 11 deletions
|
@ -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 })
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue