diff --git a/README b/README index 412235c09..9090f1794 100644 --- a/README +++ b/README @@ -633,10 +633,11 @@ Options affecting specific writers `--data-dir`). If this is not found either, sensible defaults will be used. The following styles are used by pandoc: [paragraph] Normal, Compact, Title, Subtitle, Authors, Date, Abstract, Heading 1, - Heading 2, Heading 3, Heading 4, Heading 5, Block Quote, Definition Term, - Definition, Bibliography, Body Text, Table Caption, Image Caption; + Heading 2, Heading 3, Heading 4, Heading 5, Block Text, Definition Term, + Definition, Bibliography, Body Text, Table Caption, Image Caption, + Figure, FigureWithCaption; [character] Default Paragraph Font, Body Text Char, Verbatim Char, - Footnote Ref, Link. + Footnote Reference, Hyperlink. `--epub-stylesheet=`*FILE* diff --git a/data/docx/word/styles.xml b/data/docx/word/styles.xml index 01190ef5a..347e7ff07 100644 --- a/data/docx/word/styles.xml +++ b/data/docx/word/styles.xml @@ -308,11 +308,25 @@ + + + + + + + + + + + + + + diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index 8bb1d0ced..4e81def60 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -741,7 +741,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)