git.iko.soy/typeable/pandoc
on master help sign in
Docx writer: Combine reference.docx numbering with pandoc's.

This should have fixed #1305, allowing the reference.docx to define section numbering, but it doesn't. Now the headings appear with proper indentation, but the numbers don't appear. Unclear why. styles.xml and numbering.xml basically match the docx which has the expected result.

commit0ddb4cd2e8883c226ca7ab8a92737dc29f07dfda authorJohn MacFarlane <fiddlosopher@gmail.com> dateTue 3 Jun 2014, 13:14 (12 years ago) parentec047aa
1 file changed+6−6
src/Text/Pandoc/Writers/Docx.hs+6−6
src/Text/Pandoc/Writers/Docx.hs+6−6
@@ -289,8 +289,10 @@ writeDocx opts doc@(Pandoc meta _) = do
289289
290290 -- construct word/numbering.xml
291291 let numpath = "word/numbering.xml"
292− numEntry <- (toEntry numpath epochtime . renderXml)
293− `fmap` mkNumbering (stLists st)
292+ numbering <- parseXml refArchive distArchive numpath
293+ newNumElts <- mkNumbering (stLists st)
294+ let numEntry = toEntry numpath epochtime $ renderXml numbering{ elContent =
295+ elContent numbering ++ map Elem newNumElts }
294296 let docPropsPath = "docProps/core.xml"
295297 let docProps = mknode "cp:coreProperties"
296298 [("xmlns:cp","http://schemas.openxmlformats.org/package/2006/metadata/core-properties")
@@ -392,12 +394,10 @@ styleToOpenXml style = parStyle : map toStyle alltoktypes
392394baseListId :: Int
393395baseListId = 1000
394396
395−mkNumbering :: [ListMarker] -> IO Element
397+mkNumbering :: [ListMarker] -> IO [Element]
396398mkNumbering lists = do
397399 elts <- mapM mkAbstractNum (ordNub lists)
398− return $ mknode "w:numbering"
399− [("xmlns:w","http://schemas.openxmlformats.org/wordprocessingml/2006/main")]
400− $ elts ++ zipWith mkNum lists [baseListId..(baseListId + length lists - 1)]
400+ return $ elts ++ zipWith mkNum lists [baseListId..(baseListId + length lists - 1)]
401401
402402mkNum :: ListMarker -> Int -> Element
403403mkNum marker numid =