aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/Docx/OpenXML.hs19
-rw-r--r--test/command/6959.md12
-rw-r--r--test/docx/golden/comments.docxbin10841 -> 10824 bytes
3 files changed, 23 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/Docx/OpenXML.hs b/src/Text/Pandoc/Writers/Docx/OpenXML.hs
index c9c1bc80f..f687a3493 100644
--- a/src/Text/Pandoc/Writers/Docx/OpenXML.hs
+++ b/src/Text/Pandoc/Writers/Docx/OpenXML.hs
@@ -773,17 +773,20 @@ inlineToOpenXML' _ (Span (ident,["comment-start"],kvs) ils) = do
kvs' = filter (("id" /=) . fst) kvs
modify $ \st -> st{ stComments = (("id",ident'):kvs', ils) : stComments st }
return [ Elem $ mknode "w:commentRangeStart" [("w:id", ident')] () ]
-inlineToOpenXML' _ (Span (ident,["comment-end"],kvs) _) =
+inlineToOpenXML' opts (Span (ident,["comment-end"],kvs) content) = do
-- prefer the "id" in kvs, since that is the one produced by the docx
-- reader.
let ident' = fromMaybe ident (lookup "id" kvs)
- in return . map Elem $
- [ mknode "w:commentRangeEnd" [("w:id", ident')] ()
- , mknode "w:r" []
- [ mknode "w:rPr" []
- [ mknode "w:rStyle" [("w:val", "CommentReference")] () ]
- , mknode "w:commentReference" [("w:id", ident')] () ]
- ]
+ -- process nested content: see #8189
+ nestedContent <- inlinesToOpenXML opts content
+ let thisCommentEnd =
+ [ mknode "w:commentRangeEnd" [("w:id", ident')] ()
+ , mknode "w:r" []
+ [ mknode "w:rPr" []
+ [ mknode "w:rStyle" [("w:val", "CommentReference")] () ]
+ , mknode "w:commentReference" [("w:id", ident')] () ]
+ ]
+ return $ map Elem thisCommentEnd ++ nestedContent
inlineToOpenXML' opts (Span (ident,classes,kvs) ils) = do
stylemod <- case lookup dynamicStyleKey kvs of
Just (fromString . T.unpack -> sty) -> do
diff --git a/test/command/6959.md b/test/command/6959.md
new file mode 100644
index 000000000..b09a189f5
--- /dev/null
+++ b/test/command/6959.md
@@ -0,0 +1,12 @@
+```
+% pandoc -t docx | pandoc -f docx -t markdown --track-changes=all
+[This is the comment]{.comment-start id="1" author="Mike"
+date="2020-12-17T16:53:00Z"} [Here is my reply]{.comment-start id="2"
+author="Mike" date="2020-12-17T17:39:00Z"} This is the content being
+commented on [[]{.comment-end id="2"}]{.comment-end id="1"}
+^D
+[This is the comment]{.comment-start id="1" author="Mike"
+date="2020-12-17T16:53:00Z"} [Here is my reply]{.comment-start id="2"
+author="Mike" date="2020-12-17T17:39:00Z"} This is the content being
+commented on [[]{.comment-end id="2"}]{.comment-end id="1"}
+```
diff --git a/test/docx/golden/comments.docx b/test/docx/golden/comments.docx
index 57dbde327..2fe0f22bf 100644
--- a/test/docx/golden/comments.docx
+++ b/test/docx/golden/comments.docx
Binary files differ