@@ -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"}]}]]}|]
@@ -651,7 +659,10 @@ p_figureRepresentation = forAll (arbitrary :: Gen [Inline]) (\figureCaption ->
651659 " url"
652660 " title" ==
653661 Builder. fromList
654- [Para [Image (" " , [] , [] ) figureCaption (" url" , " fig:title" ) ]]
662+ [Figure
663+ nullAttr
664+ (Caption Nothing [Plain figureCaption | not (null figureCaption)])
665+ [Plain [Image (" " , [] , [] ) [] (" url" , " fig:title" ) ]]]
655666 )
656667
657668tests :: [Test ]
@@ -727,6 +738,7 @@ tests =
727738 , testEncodeDecode " DefinitionList" t_definitionlist
728739 , testEncodeDecode " Header" t_header
729740 , testEncodeDecode " Table" t_table
741+ , testEncodeDecode " Figure" t_figure
730742 , testEncodeDecode " Div" t_div
731743 , testEncodeDecode " Null" t_null
732744 ]
0 commit comments