git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: Fixed a couple bugs in Figure numbering.
commita01ba4463f1f0d14a8032f147cddb76dadb4b853 authorJohn MacFarlane <jgm@berkeley.edu> dateTue 29 Jun 2021, 11:15 (5 years ago) parenta3d745e
1 file changed+3−4
src/Text/Pandoc/Writers/Docx.hs+3−4
src/Text/Pandoc/Writers/Docx.hs+3−4
@@ -856,7 +856,7 @@ blockToOpenXML' opts (Plain lst) = do
856856blockToOpenXML' opts (Para [Image attr alt (src,T.stripPrefix "fig:" -> Just tit)]) = do
857857 setFirstPara
858858 fignum <- gets stNextFigureNum
859− modify $ \st -> st{ stNextFigureNum = fignum + 1 }
859+ unless (null alt) $ modify $ \st -> st{ stNextFigureNum = fignum + 1 }
860860 let figid = "fig" <> tshow fignum
861861 figname <- translateTerm Term.Figure
862862 prop <- pStyleM $
@@ -870,10 +870,9 @@ blockToOpenXML' opts (Para [Image attr alt (src,T.stripPrefix "fig:" -> Just tit
870870 else withParaPropM (pStyleM "Image Caption")
871871 $ blockToOpenXML opts
872872 (Para $ Span (figid,[],[])
873− [Str "Figure\160",
873+ [Str (figname <> "\160"),
874874 RawInline (Format "openxml")
875− ("<w:fldSimple w:instr=\"SEQ "
876− <> figname
875+ ("<w:fldSimple w:instr=\"SEQ Figure"
877876 <> " \\* ARABIC \"><w:r><w:t>"
878877 <> tshow fignum
879878 <> "</w:t></w:r></w:fldSimple>"),