diff options
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/OpenDocument.hs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/OpenDocument.hs b/src/Text/Pandoc/Writers/OpenDocument.hs index cb29e390a..cd907bbea 100644 --- a/src/Text/Pandoc/Writers/OpenDocument.hs +++ b/src/Text/Pandoc/Writers/OpenDocument.hs @@ -411,10 +411,22 @@ blockToOpenDocument o bs figure attr caption source title | null caption = withParagraphStyle o "Figure" [Para [Image attr caption (source,title)]] | otherwise = do + id' <- gets stImageId imageDoc <- withParagraphStyle o "FigureWithCaption" [Para [Image attr caption (source,title)]] - captionDoc <- withParagraphStyle o "FigureCaption" [Para caption] + captionDoc <- numberedFigureCaption id' <$> inlinesToOpenDocument o caption return $ imageDoc $$ captionDoc +numberedFigureCaption :: Int -> Doc -> Doc +numberedFigureCaption num caption = + let t = text "Figure " + r = num - 1 + s = inTags False "text:sequence" [ ("text:ref-name", "refIllustration" ++ show r), + ("text:name", "Illustration"), + ("text:formula", "ooow:Illustration+1"), + ("style:num-format", "1") ] $ text $ show num + c = text ": " + in inParagraphTagsWithStyle "FigureCaption" $ hcat [ t, s, c, caption ] + colHeadsToOpenDocument :: PandocMonad m => WriterOptions -> [String] -> [[Block]] -> OD m Doc |