docx writer: avoid extra copy of abstractNum and num elements...
...in numbering.xml. This caused pandoc-produced docx files to be uneditable using Word Online. The problem was that recent versions of reference.docx include samples of various kinds of text, including lists. The numering elements for these were getting copied over to the new docx, where they clashed with the autogenerated elements produced by pandoc. This didn't confuse Desktop Word, but it did confuse Word Online. Closes #5358.
This commit is contained in:
parent
f7ebd5107d
commit
b7cbd7b8c9
28 changed files with 9 additions and 1 deletions
|
@ -465,7 +465,15 @@ 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 pandocAdded e =
|
||||
case findAttrBy ((== "abstractNumId") . qName) e >>= safeRead of
|
||||
Just numid -> numid >= (990 :: Int)
|
||||
Nothing ->
|
||||
case findAttrBy ((== "numId") . qName) e >>= safeRead of
|
||||
Just numid -> numid >= (1000 :: Int)
|
||||
Nothing -> False
|
||||
let oldElts = filter (not . pandocAdded) $ onlyElems (elContent numbering)
|
||||
let allElts = oldElts ++ newNumElts
|
||||
let numEntry = toEntry numpath epochtime $ renderXml numbering{ elContent =
|
||||
-- we want all the abstractNums first, then the nums,
|
||||
-- otherwise things break:
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue