aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikolay Yakimov <root@livid.pp.ru>2015-03-29 07:37:33 +0300
committerNikolay Yakimov <root@livid.pp.ru>2015-03-29 08:02:18 +0300
commit69d5085c112ccd2a136b08895e268d43f9f2067f (patch)
treecb3627d1fd6f19fce7899560ee2415b640eceee4 /src
parent27078985d54111ad5b674635dd3adc5ac5f86744 (diff)
downloadpandoc-69d5085c112ccd2a136b08895e268d43f9f2067f.tar.gz
Docx Writer: Add a style to figure images
Figures with empty captions use style "Figure" Figures with nonempty captions use style "Figure with Caption", which is based on "Figure", and additionally has keepNext set.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 81369e278..3c32434e7 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -673,7 +673,12 @@ blockToOpenXML opts (Plain lst) = withParaProp (pCustomStyle "Compact")
-- title beginning with fig: indicates that the image is a figure
blockToOpenXML opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do
setFirstPara
+ pushParaProp $ pCustomStyle $
+ if null alt
+ then "Figure"
+ else "FigureWithCaption"
paraProps <- getParaProps False
+ popParaProp
contents <- inlinesToOpenXML opts [Image alt (src,tit)]
captionNode <- withParaProp (pCustomStyle "ImageCaption")
$ blockToOpenXML opts (Para alt)