From 69d5085c112ccd2a136b08895e268d43f9f2067f Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Sun, 29 Mar 2015 07:37:33 +0300 Subject: 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. --- data/docx/word/styles.xml | 11 +++++++++++ src/Text/Pandoc/Writers/Docx.hs | 5 +++++ 2 files changed, 16 insertions(+) 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 @@ + + + + + + + + + + + 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) -- cgit v1.2.3 From 78cf36a392abc87e5b11fe8fd06a8ade143938f3 Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Sun, 29 Mar 2015 07:38:15 +0300 Subject: Reference Docx: Add keepNext to table captions --- data/docx/word/styles.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/docx/word/styles.xml b/data/docx/word/styles.xml index 3b3b142b4..d2e35b4c3 100644 --- a/data/docx/word/styles.xml +++ b/data/docx/word/styles.xml @@ -308,6 +308,9 @@ + + + -- cgit v1.2.3 From 0d4d26294491b3f16e11231e90dc79ccd16b0b48 Mon Sep 17 00:00:00 2001 From: Nikolay Yakimov Date: Sun, 29 Mar 2015 11:48:58 +0300 Subject: Updated README with new Docx Writer style names --- README | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README b/README index 2d28155cd..16db2f294 100644 --- a/README +++ b/README @@ -625,10 +625,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* -- cgit v1.2.3