git.iko.soy/typeable/pandoc
on master help sign in
Merge pull request #2035 from lierdakil/issue2031
2b2f7feJohn MacFarlane
README+4−3
@@ -633,10 +633,11 @@ Options affecting specific writers
633 `--data-dir`). If this is not found either, sensible defaults will be
633 `--data-dir`). If this is not found either, sensible defaults will be
634 used. The following styles are used by pandoc: [paragraph]
634 used. The following styles are used by pandoc: [paragraph]
635 Normal, Compact, Title, Subtitle, Authors, Date, Abstract, Heading 1,
635 Normal, Compact, Title, Subtitle, Authors, Date, Abstract, Heading 1,
636− Heading 2, Heading 3, Heading 4, Heading 5, Block Quote, Definition Term,
636+ Heading 2, Heading 3, Heading 4, Heading 5, Block Text, Definition Term,
637− Definition, Bibliography, Body Text, Table Caption, Image Caption;
637+ Definition, Bibliography, Body Text, Table Caption, Image Caption,
638+ Figure, FigureWithCaption;
638 [character] Default Paragraph Font, Body Text Char, Verbatim Char,
639 [character] Default Paragraph Font, Body Text Char, Verbatim Char,
639− Footnote Ref, Link.
640+ Footnote Reference, Hyperlink.
640
641
641`--epub-stylesheet=`*FILE*
642`--epub-stylesheet=`*FILE*
642
643
data/docx/word/styles.xml+14
@@ -308,11 +308,25 @@
308 <w:style w:type="paragraph" w:customStyle="1" w:styleId="TableCaption">
308 <w:style w:type="paragraph" w:customStyle="1" w:styleId="TableCaption">
309 <w:name w:val="Table Caption" />
309 <w:name w:val="Table Caption" />
310 <w:basedOn w:val="Caption" />
310 <w:basedOn w:val="Caption" />
311+ <w:pPr>
312+ <w:keepNext />
313+ </w:pPr>
311 </w:style>
314 </w:style>
312 <w:style w:type="paragraph" w:customStyle="1" w:styleId="ImageCaption">
315 <w:style w:type="paragraph" w:customStyle="1" w:styleId="ImageCaption">
313 <w:name w:val="Image Caption" />
316 <w:name w:val="Image Caption" />
314 <w:basedOn w:val="Caption" />
317 <w:basedOn w:val="Caption" />
315 </w:style>
318 </w:style>
319+ <w:style w:type="paragraph" w:customStyle="1" w:styleId="Figure">
320+ <w:name w:val="Figure" />
321+ <w:basedOn w:val="Normal" />
322+ </w:style>
323+ <w:style w:type="paragraph" w:customStyle="1" w:styleId="FigureWithCaption">
324+ <w:name w:val="Figure with Caption" />
325+ <w:basedOn w:val="Figure" />
326+ <w:pPr>
327+ <w:keepNext />
328+ </w:pPr>
329+ </w:style>
316 <w:style w:type="character" w:customStyle="1" w:styleId="BodyTextChar">
330 <w:style w:type="character" w:customStyle="1" w:styleId="BodyTextChar">
317 <w:name w:val="Body Text Char" />
331 <w:name w:val="Body Text Char" />
318 <w:basedOn w:val="DefaultParagraphFont" />
332 <w:basedOn w:val="DefaultParagraphFont" />
src/Text/Pandoc/Writers/Docx.hs+5
@@ -741,7 +741,12 @@ blockToOpenXML opts (Plain lst) = withParaProp (pCustomStyle "Compact")
741-- title beginning with fig: indicates that the image is a figure
741-- title beginning with fig: indicates that the image is a figure
742blockToOpenXML opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do
742blockToOpenXML opts (Para [Image alt (src,'f':'i':'g':':':tit)]) = do
743 setFirstPara
743 setFirstPara
744+ pushParaProp $ pCustomStyle $
745+ if null alt
746+ then "Figure"
747+ else "FigureWithCaption"
744 paraProps <- getParaProps False
748 paraProps <- getParaProps False
749+ popParaProp
745 contents <- inlinesToOpenXML opts [Image alt (src,tit)]
750 contents <- inlinesToOpenXML opts [Image alt (src,tit)]
746 captionNode <- withParaProp (pCustomStyle "ImageCaption")
751 captionNode <- withParaProp (pCustomStyle "ImageCaption")
747 $ blockToOpenXML opts (Para alt)
752 $ blockToOpenXML opts (Para alt)