summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/docx/word/styles.xml11
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs5
2 files changed, 16 insertions, 0 deletions
diff --git a/data/docx/word/styles.xml b/data/docx/word/styles.xml
index 0de21bd4c..3b3b142b4 100644
--- a/data/docx/word/styles.xml
+++ b/data/docx/word/styles.xml
@@ -313,6 +313,17 @@
<w:name w:val="Image Caption" />
<w:basedOn w:val="Caption" />
</w:style>
+ <w:style w:type="paragraph" w:customStyle="1" w:styleId="Figure">
+ <w:name w:val="Figure" />
+ <w:basedOn w:val="Normal" />
+ </w:style>
+ <w:style w:type="paragraph" w:customStyle="1" w:styleId="FigureWithCaption">
+ <w:name w:val="Figure with Caption" />
+ <w:basedOn w:val="Figure" />
+ <w:pPr>
+ <w:keepNext />
+ </w:pPr>
+ </w:style>
<w:style w:type="character" w:customStyle="1" w:styleId="BodyTextChar">
<w:name w:val="Body Text Char" />
<w:basedOn w:val="DefaultParagraphFont" />
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)