@@ -437,6 +437,14 @@ t_table = ( Table
437437 tCell' i = Cell (" id" , [" kls" ], [(" k1" , " v1" ), (" k2" , " v2" )]) AlignDefault 1 1 [Plain i]
438438 tRow = Row (" id" , [" kls" ], [(" k1" , " v1" ), (" k2" , " v2" )])
439439
440+ t_figure :: (Block , ByteString )
441+ t_figure = (Figure
442+ (" id" , [" kls" ], [(" k1" , " v1" ), (" k2" , " v2" )])
443+ (Caption (Just [Str " hello" ]) [Para [Str " cap content" ]])
444+ [Para [Str " fig content" ]]
445+ ,[s |{"t":"Figure","c":[["id",["kls"],[["k1","v1"],["k2","v2"]]],[[{"t":"Str","c":"hello"}],[{"t":"Para","c":[{"t":"Str","c":"cap content"}]}]],[{"t":"Para","c":[{"t":"Str","c":"fig content"}]}]]}|]
446+ )
447+
440448t_div :: (Block , ByteString )
441449t_div = ( Div (" id" , [" kls" ], [(" k1" , " v1" ), (" k2" , " v2" )]) [Para [Str " Hello" ]]
442450 , [s |{"t":"Div","c":[["id",["kls"],[["k1","v1"],["k2","v2"]]],[{"t":"Para","c":[{"t":"Str","c":"Hello"}]}]]}|]
@@ -644,15 +652,17 @@ t_tableNormExample = testCase "table normalization example" assertion
644652 generated = table emptyCaption spec (th initialHeads) [initialTB] (tf initialHeads)
645653
646654p_figureRepresentation :: Property
647- p_figureRepresentation = forAll (arbitrary :: Gen [Inline ]) ( \ figureCaption ->
655+ p_figureRepresentation = forAll (arbitrary :: Gen [Inline ]) $ \ figureCaption ->
648656 simpleFigureWith
649657 (" " , [] , [] )
650658 (Builder. fromList figureCaption)
651659 " url"
652660 " title" ==
653661 Builder. fromList
654- [Para [Image (" " , [] , [] ) figureCaption (" url" , " fig:title" ) ]]
655- )
662+ [Figure
663+ nullAttr
664+ (Caption Nothing [Plain figureCaption | not (null figureCaption)])
665+ [Plain [Image (" " , [] , [] ) [] (" url" , " title" ) ]]]
656666
657667tests :: [Test ]
658668tests =
@@ -727,6 +737,7 @@ tests =
727737 , testEncodeDecode " DefinitionList" t_definitionlist
728738 , testEncodeDecode " Header" t_header
729739 , testEncodeDecode " Table" t_table
740+ , testEncodeDecode " Figure" t_figure
730741 , testEncodeDecode " Div" t_div
731742 , testEncodeDecode " Null" t_null
732743 ]
0 commit comments