git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: Section numbering carries over from reference.docx.

Closes #1305.

commit45f3851611007f18530b52c9fcc5f0106fbc6816 authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 3 Jun 2014, 16:46 (12 years ago) parent0ddb4cd
1 file changed+6−1
src/Text/Pandoc/Writers/Docx.hs+6−1
src/Text/Pandoc/Writers/Docx.hs+6−1
@@ -291,8 +291,13 @@ writeDocx opts doc@(Pandoc meta _) = do
291291 let numpath = "word/numbering.xml"
292292 numbering <- parseXml refArchive distArchive numpath
293293 newNumElts <- mkNumbering (stLists st)
294+ let allElts = onlyElems (elContent numbering) ++ newNumElts
294295 let numEntry = toEntry numpath epochtime $ renderXml numbering{ elContent =
295− elContent numbering ++ map Elem newNumElts }
296+ -- we want all the abstractNums first, then the nums,
297+ -- otherwise things break:
298+ [Elem e | e <- allElts
299+ , qName (elName e) == "abstractNum" ] ++
300+ [Elem e | e <- allElts, qName (elName e) == "num" ] }
296301 let docPropsPath = "docProps/core.xml"
297302 let docProps = mknode "cp:coreProperties"
298303 [("xmlns:cp","http://schemas.openxmlformats.org/package/2006/metadata/core-properties")