summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdwin Török <edwin@etorok.net>2023-12-19 00:20:28 +0000
committerJohn MacFarlane <jgm@berkeley.edu>2023-12-18 17:15:03 -0800
commitdbd1019a9706a6c91a7f83428f3cf0490f104cb4 (patch)
treefe1930a02369e272eb4221db2c3f6c6a4a52ea2e
parent1e4775f069fd4a4a776fcd95135d32665a4982a1 (diff)
fix(docx): fix validation error on endnotePr
Copying `endnotePr` causes validation errors, because it is now referencing something that doesn't exist in the document: ``` { "FilePath": "test/docx/golden/custom_style_reference.docx", "ValidationErrors": "[{\"Description\":\"Element 'w:endnote' referenced by 'endnote@http://schemas.openxmlformats.org/wordprocessingml/2006/main:id' does not exist in part '/MainDocumentPart/EndnotesPart'. The reference value is '0'.\",\"Path\":{\"NamespacesDefinitions\":[\"xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\"],\"Namespaces\":{},\"XPath\":\"/w:settings[1]/w:endnotePr[1]/w:endnote[2]\",\"PartUri\":\"/word/settings.xml\"},\"Id\":\"Sem_MissingReferenceElement\",\"ErrorType\":\"Semantic\"},{\"Description\":\"Element 'w:endnote' referenced by 'endnote@http://schemas.openxmlformats.org/wordprocessingml/2006/main:id' does not exist in part '/MainDocumentPart/EndnotesPart'. The reference value is '-1'.\",\"Path\":{\"NamespacesDefinitions\":[\"xmlns:w=\\\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\\\"\"],\"Namespaces\":{},\"XPath\":\"/w:settings[1]/w:endnotePr[1]/w:endnote[1]\",\"PartUri\":\"/word/settings.xml\"},\"Id\":\"Sem_MissingReferenceElement\",\"ErrorType\":\"Semantic\"}]" } ``` For now don't copy this element, it wasn't copied before, and it doesn't seem necessary to fix the ordering problems we had with settings. Fixes: c9bf4da74 ("Docx writer: ensure that elements in settings are ordered correctly.") Signed-off-by: Edwin Török <edwin@etorok.net>
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs1
-rw-r--r--test/docx/golden/custom_style_reference.docxbin12555 -> 12544 bytes
2 files changed, 0 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 3acd695c5..44c0e900d 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -590,7 +590,6 @@ writeDocx opts doc = do
, "updateFields"
, "hdrShapeDefaults"
, "footnotePr"
- , "endnotePr"
, "compat"
, "docVars"
, "rsids"
diff --git a/test/docx/golden/custom_style_reference.docx b/test/docx/golden/custom_style_reference.docx
index 096efff96..18e3ebf3f 100644
--- a/test/docx/golden/custom_style_reference.docx
+++ b/test/docx/golden/custom_style_reference.docx
Binary files differ