aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2014-06-03 16:46:55 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2014-06-03 16:46:55 -0700
commit45f3851611007f18530b52c9fcc5f0106fbc6816 (patch)
treec87b5beb3e10bfc3d87b4df19e6a48ce3ba5b4f3
parent0ddb4cd2e8883c226ca7ab8a92737dc29f07dfda (diff)
downloadpandoc-45f3851611007f18530b52c9fcc5f0106fbc6816.tar.gz
Docx writer: Section numbering carries over from reference.docx.
Closes #1305.
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 785238d6f..4e64a79df 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -291,8 +291,13 @@ writeDocx opts doc@(Pandoc meta _) = do
let numpath = "word/numbering.xml"
numbering <- parseXml refArchive distArchive numpath
newNumElts <- mkNumbering (stLists st)
+ let allElts = onlyElems (elContent numbering) ++ newNumElts
let numEntry = toEntry numpath epochtime $ renderXml numbering{ elContent =
- elContent numbering ++ map Elem newNumElts }
+ -- we want all the abstractNums first, then the nums,
+ -- otherwise things break:
+ [Elem e | e <- allElts
+ , qName (elName e) == "abstractNum" ] ++
+ [Elem e | e <- allElts, qName (elName e) == "num" ] }
let docPropsPath = "docProps/core.xml"
let docProps = mknode "cp:coreProperties"
[("xmlns:cp","http://schemas.openxmlformats.org/package/2006/metadata/core-properties")