diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-06-29 11:15:13 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-06-29 11:15:13 -0700 |
commit | a01ba4463f1f0d14a8032f147cddb76dadb4b853 (patch) | |
tree | ebfad60e1d88f9a2b7ded3b1119a6682b3e0280e /src/Text/Pandoc/Writers | |
parent | a3d745e48560a55d9a9ea9fa43ffdd5a8b84987f (diff) | |
download | pandoc-a01ba4463f1f0d14a8032f147cddb76dadb4b853.tar.gz |
Docx writer: Fixed a couple bugs in Figure numbering.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r-- | src/Text/Pandoc/Writers/Docx.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs index b3e008b8a..a3c4b6be1 100644 --- a/src/Text/Pandoc/Writers/Docx.hs +++ b/src/Text/Pandoc/Writers/Docx.hs @@ -856,7 +856,7 @@ blockToOpenXML' opts (Plain lst) = do blockToOpenXML' opts (Para [Image attr alt (src,T.stripPrefix "fig:" -> Just tit)]) = do setFirstPara fignum <- gets stNextFigureNum - modify $ \st -> st{ stNextFigureNum = fignum + 1 } + unless (null alt) $ modify $ \st -> st{ stNextFigureNum = fignum + 1 } let figid = "fig" <> tshow fignum figname <- translateTerm Term.Figure prop <- pStyleM $ @@ -870,10 +870,9 @@ blockToOpenXML' opts (Para [Image attr alt (src,T.stripPrefix "fig:" -> Just tit else withParaPropM (pStyleM "Image Caption") $ blockToOpenXML opts (Para $ Span (figid,[],[]) - [Str "Figure\160", + [Str (figname <> "\160"), RawInline (Format "openxml") - ("<w:fldSimple w:instr=\"SEQ " - <> figname + ("<w:fldSimple w:instr=\"SEQ Figure" <> " \\* ARABIC \"><w:r><w:t>" <> tshow fignum <> "</w:t></w:r></w:fldSimple>"), |