aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs27
-rw-r--r--test/docx/golden/block_quotes.docxbin10067 -> 10061 bytes
-rw-r--r--test/docx/golden/codeblock.docxbin9916 -> 9910 bytes
-rw-r--r--test/docx/golden/comments.docxbin10254 -> 10248 bytes
-rw-r--r--test/docx/golden/custom_style_no_reference.docxbin10017 -> 10011 bytes
-rw-r--r--test/docx/golden/custom_style_preserve.docxbin10646 -> 10640 bytes
-rw-r--r--test/docx/golden/custom_style_reference.docxbin12400 -> 12397 bytes
-rw-r--r--test/docx/golden/definition_list.docxbin9916 -> 9910 bytes
-rw-r--r--test/docx/golden/document-properties-short-desc.docxbin9922 -> 9916 bytes
-rw-r--r--test/docx/golden/document-properties.docxbin10399 -> 10393 bytes
-rw-r--r--test/docx/golden/headers.docxbin10055 -> 10049 bytes
-rw-r--r--test/docx/golden/image.docxbin26733 -> 26727 bytes
-rw-r--r--test/docx/golden/inline_code.docxbin9855 -> 9849 bytes
-rw-r--r--test/docx/golden/inline_formatting.docxbin10035 -> 10029 bytes
-rw-r--r--test/docx/golden/inline_images.docxbin26789 -> 26783 bytes
-rw-r--r--test/docx/golden/link_in_notes.docxbin10077 -> 10071 bytes
-rw-r--r--test/docx/golden/links.docxbin10248 -> 10242 bytes
-rw-r--r--test/docx/golden/lists.docxbin10314 -> 10308 bytes
-rw-r--r--test/docx/golden/lists_continuing.docxbin10110 -> 10104 bytes
-rw-r--r--test/docx/golden/lists_multiple_initial.docxbin10192 -> 10186 bytes
-rw-r--r--test/docx/golden/lists_restarting.docxbin10108 -> 10102 bytes
-rw-r--r--test/docx/golden/nested_anchors_in_header.docxbin10212 -> 10206 bytes
-rw-r--r--test/docx/golden/notes.docxbin10024 -> 10018 bytes
-rw-r--r--test/docx/golden/raw-blocks.docxbin9956 -> 9950 bytes
-rw-r--r--test/docx/golden/raw-bookmarks.docxbin10090 -> 10084 bytes
-rw-r--r--test/docx/golden/table_one_row.docxbin9925 -> 9920 bytes
-rw-r--r--test/docx/golden/table_with_list_cell.docxbin10230 -> 10225 bytes
-rw-r--r--test/docx/golden/tables.docxbin10271 -> 10266 bytes
-rw-r--r--test/docx/golden/track_changes_deletion.docxbin9899 -> 9893 bytes
-rw-r--r--test/docx/golden/track_changes_insertion.docxbin9882 -> 9876 bytes
-rw-r--r--test/docx/golden/track_changes_move.docxbin9916 -> 9910 bytes
-rw-r--r--test/docx/golden/track_changes_scrubbed_metadata.docxbin10028 -> 10022 bytes
-rw-r--r--test/docx/golden/unicode.docxbin9841 -> 9835 bytes
-rw-r--r--test/docx/golden/verbatim_subsuper.docxbin9888 -> 9882 bytes
34 files changed, 14 insertions, 13 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index e11961bfd..75bed1595 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -469,12 +469,12 @@ writeDocx opts doc = do
-- adds references to footnotes or endnotes we don't have...
-- we do, however, copy some settings over from reference
let settingsPath = "word/settings.xml"
- settingsList = [ "w:autoHyphenation"
- , "w:consecutiveHyphenLimit"
- , "w:hyphenationZone"
- , "w:doNotHyphenateCap"
- , "w:evenAndOddHeaders"
- , "w:proofState"
+ settingsList = [ "autoHyphenation"
+ , "consecutiveHyphenLimit"
+ , "hyphenationZone"
+ , "doNotHyphenateCap"
+ , "evenAndOddHeaders"
+ , "proofState"
]
settingsEntry <- copyChildren refArchive distArchive settingsPath epochtime settingsList
@@ -577,16 +577,17 @@ copyChildren :: (PandocMonad m)
copyChildren refArchive distArchive path timestamp elNames = do
ref <- parseXml refArchive distArchive path
dist <- parseXml distArchive distArchive path
+ let elsToCopy =
+ map cleanElem $ filterChildrenName (\e -> qName e `elem` elNames) ref
+ let elsToKeep =
+ [e | Elem e <- elContent dist, not (any (hasSameNameAs e) elsToCopy)]
return $ toEntry path timestamp $ renderXml dist{
- elContent = elContent dist ++ copyContent ref
+ elContent = map Elem elsToKeep ++ map Elem elsToCopy
}
where
- strName QName{qName=name, qPrefix=prefix}
- | Just p <- prefix = p <> ":" <> name
- | otherwise = name
- shouldCopy = (`elem` elNames) . strName
- cleanElem el@Element{elName=name} = Elem el{elName=name{qURI=Nothing}}
- copyContent = map cleanElem . filterChildrenName shouldCopy
+ hasSameNameAs (Element {elName = n1}) (Element {elName = n2}) =
+ qName n1 == qName n2
+ cleanElem el@Element{elName=name} = el{elName=name{qURI=Nothing}}
-- this is the lowest number used for a list numId
baseListId :: Int
diff --git a/test/docx/golden/block_quotes.docx b/test/docx/golden/block_quotes.docx
index af1b33ca2..b6973fcfd 100644
--- a/test/docx/golden/block_quotes.docx
+++ b/test/docx/golden/block_quotes.docx
Binary files differ
diff --git a/test/docx/golden/codeblock.docx b/test/docx/golden/codeblock.docx
index f748f1f01..f0d35d3ad 100644
--- a/test/docx/golden/codeblock.docx
+++ b/test/docx/golden/codeblock.docx
Binary files differ
diff --git a/test/docx/golden/comments.docx b/test/docx/golden/comments.docx
index ac9d56680..fb1c15dec 100644
--- a/test/docx/golden/comments.docx
+++ b/test/docx/golden/comments.docx
Binary files differ
diff --git a/test/docx/golden/custom_style_no_reference.docx b/test/docx/golden/custom_style_no_reference.docx
index f27727edd..43d536b65 100644
--- a/test/docx/golden/custom_style_no_reference.docx
+++ b/test/docx/golden/custom_style_no_reference.docx
Binary files differ
diff --git a/test/docx/golden/custom_style_preserve.docx b/test/docx/golden/custom_style_preserve.docx
index 1da499d6a..8865010d1 100644
--- a/test/docx/golden/custom_style_preserve.docx
+++ b/test/docx/golden/custom_style_preserve.docx
Binary files differ
diff --git a/test/docx/golden/custom_style_reference.docx b/test/docx/golden/custom_style_reference.docx
index 4d2fe245d..10f7bf661 100644
--- a/test/docx/golden/custom_style_reference.docx
+++ b/test/docx/golden/custom_style_reference.docx
Binary files differ
diff --git a/test/docx/golden/definition_list.docx b/test/docx/golden/definition_list.docx
index f386fcea3..2a7d81a34 100644
--- a/test/docx/golden/definition_list.docx
+++ b/test/docx/golden/definition_list.docx
Binary files differ
diff --git a/test/docx/golden/document-properties-short-desc.docx b/test/docx/golden/document-properties-short-desc.docx
index debe9a3f6..2fcd14908 100644
--- a/test/docx/golden/document-properties-short-desc.docx
+++ b/test/docx/golden/document-properties-short-desc.docx
Binary files differ
diff --git a/test/docx/golden/document-properties.docx b/test/docx/golden/document-properties.docx
index cd17400bf..39533f42d 100644
--- a/test/docx/golden/document-properties.docx
+++ b/test/docx/golden/document-properties.docx
Binary files differ
diff --git a/test/docx/golden/headers.docx b/test/docx/golden/headers.docx
index d3af8a3dd..c8d67c45b 100644
--- a/test/docx/golden/headers.docx
+++ b/test/docx/golden/headers.docx
Binary files differ
diff --git a/test/docx/golden/image.docx b/test/docx/golden/image.docx
index 1c4e738c0..8a7aeec10 100644
--- a/test/docx/golden/image.docx
+++ b/test/docx/golden/image.docx
Binary files differ
diff --git a/test/docx/golden/inline_code.docx b/test/docx/golden/inline_code.docx
index 35f43f19f..969237cec 100644
--- a/test/docx/golden/inline_code.docx
+++ b/test/docx/golden/inline_code.docx
Binary files differ
diff --git a/test/docx/golden/inline_formatting.docx b/test/docx/golden/inline_formatting.docx
index 8de3f70f6..cda936a39 100644
--- a/test/docx/golden/inline_formatting.docx
+++ b/test/docx/golden/inline_formatting.docx
Binary files differ
diff --git a/test/docx/golden/inline_images.docx b/test/docx/golden/inline_images.docx
index e76558be9..69991e791 100644
--- a/test/docx/golden/inline_images.docx
+++ b/test/docx/golden/inline_images.docx
Binary files differ
diff --git a/test/docx/golden/link_in_notes.docx b/test/docx/golden/link_in_notes.docx
index 88bae8142..40e848195 100644
--- a/test/docx/golden/link_in_notes.docx
+++ b/test/docx/golden/link_in_notes.docx
Binary files differ
diff --git a/test/docx/golden/links.docx b/test/docx/golden/links.docx
index 455adcfc7..28237a30d 100644
--- a/test/docx/golden/links.docx
+++ b/test/docx/golden/links.docx
Binary files differ
diff --git a/test/docx/golden/lists.docx b/test/docx/golden/lists.docx
index 081d9ddba..bf075805e 100644
--- a/test/docx/golden/lists.docx
+++ b/test/docx/golden/lists.docx
Binary files differ
diff --git a/test/docx/golden/lists_continuing.docx b/test/docx/golden/lists_continuing.docx
index fc9213fc5..e7d308e13 100644
--- a/test/docx/golden/lists_continuing.docx
+++ b/test/docx/golden/lists_continuing.docx
Binary files differ
diff --git a/test/docx/golden/lists_multiple_initial.docx b/test/docx/golden/lists_multiple_initial.docx
index b636fd3f8..9763e347e 100644
--- a/test/docx/golden/lists_multiple_initial.docx
+++ b/test/docx/golden/lists_multiple_initial.docx
Binary files differ
diff --git a/test/docx/golden/lists_restarting.docx b/test/docx/golden/lists_restarting.docx
index 252623215..b717ca619 100644
--- a/test/docx/golden/lists_restarting.docx
+++ b/test/docx/golden/lists_restarting.docx
Binary files differ
diff --git a/test/docx/golden/nested_anchors_in_header.docx b/test/docx/golden/nested_anchors_in_header.docx
index a8c3f5478..873e731d2 100644
--- a/test/docx/golden/nested_anchors_in_header.docx
+++ b/test/docx/golden/nested_anchors_in_header.docx
Binary files differ
diff --git a/test/docx/golden/notes.docx b/test/docx/golden/notes.docx
index 43e650ebd..134cb2eaf 100644
--- a/test/docx/golden/notes.docx
+++ b/test/docx/golden/notes.docx
Binary files differ
diff --git a/test/docx/golden/raw-blocks.docx b/test/docx/golden/raw-blocks.docx
index fe4f7845b..c49ed79c8 100644
--- a/test/docx/golden/raw-blocks.docx
+++ b/test/docx/golden/raw-blocks.docx
Binary files differ
diff --git a/test/docx/golden/raw-bookmarks.docx b/test/docx/golden/raw-bookmarks.docx
index 45e90608f..1f2cbb214 100644
--- a/test/docx/golden/raw-bookmarks.docx
+++ b/test/docx/golden/raw-bookmarks.docx
Binary files differ
diff --git a/test/docx/golden/table_one_row.docx b/test/docx/golden/table_one_row.docx
index e60bb303f..a0160cdb4 100644
--- a/test/docx/golden/table_one_row.docx
+++ b/test/docx/golden/table_one_row.docx
Binary files differ
diff --git a/test/docx/golden/table_with_list_cell.docx b/test/docx/golden/table_with_list_cell.docx
index a4037cf32..6427d475c 100644
--- a/test/docx/golden/table_with_list_cell.docx
+++ b/test/docx/golden/table_with_list_cell.docx
Binary files differ
diff --git a/test/docx/golden/tables.docx b/test/docx/golden/tables.docx
index bc1bc27f8..470eac2ae 100644
--- a/test/docx/golden/tables.docx
+++ b/test/docx/golden/tables.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_deletion.docx b/test/docx/golden/track_changes_deletion.docx
index 247725aaa..3542b8f9c 100644
--- a/test/docx/golden/track_changes_deletion.docx
+++ b/test/docx/golden/track_changes_deletion.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_insertion.docx b/test/docx/golden/track_changes_insertion.docx
index 3863afef2..b36b4485e 100644
--- a/test/docx/golden/track_changes_insertion.docx
+++ b/test/docx/golden/track_changes_insertion.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_move.docx b/test/docx/golden/track_changes_move.docx
index 5c848b63a..e30ab06ae 100644
--- a/test/docx/golden/track_changes_move.docx
+++ b/test/docx/golden/track_changes_move.docx
Binary files differ
diff --git a/test/docx/golden/track_changes_scrubbed_metadata.docx b/test/docx/golden/track_changes_scrubbed_metadata.docx
index e0c843713..11597d578 100644
--- a/test/docx/golden/track_changes_scrubbed_metadata.docx
+++ b/test/docx/golden/track_changes_scrubbed_metadata.docx
Binary files differ
diff --git a/test/docx/golden/unicode.docx b/test/docx/golden/unicode.docx
index 78a773bdd..c7bff82e5 100644
--- a/test/docx/golden/unicode.docx
+++ b/test/docx/golden/unicode.docx
Binary files differ
diff --git a/test/docx/golden/verbatim_subsuper.docx b/test/docx/golden/verbatim_subsuper.docx
index c66a45b74..c70f6946e 100644
--- a/test/docx/golden/verbatim_subsuper.docx
+++ b/test/docx/golden/verbatim_subsuper.docx
Binary files differ