@@ -1104,15 +1104,23 @@ inlineToOpenXML' _ (Str str) =
1104inlineToOpenXML' opts Space = inlineToOpenXML opts (Str " ")
1104inlineToOpenXML' opts Space = inlineToOpenXML opts (Str " ")
1105inlineToOpenXML' opts SoftBreak = inlineToOpenXML opts (Str " ")
1105inlineToOpenXML' opts SoftBreak = inlineToOpenXML opts (Str " ")
1106inlineToOpenXML' _ (Span (ident,["comment-start"],kvs) ils) = do
1106inlineToOpenXML' _ (Span (ident,["comment-start"],kvs) ils) = do
1107+ -- prefer the "id" in kvs, since that is the one produced by the docx
1109+ let ident' = fromMaybe ident (lookup "id" kvs)
1110+ kvs' = filter (("id" /=) . fst) kvs
1107− modify $ \st -> st{ stComments = (("id",ident):kvs, ils) : stComments st }
1111+ modify $ \st -> st{ stComments = (("id",ident'):kvs', ils) : stComments st }
1108− return [ mknode "w:commentRangeStart" [("w:id", ident)] () ]
1112+ return [ mknode "w:commentRangeStart" [("w:id", ident')] () ]
1109−inlineToOpenXML' _ (Span (ident,["comment-end"],_) _) =
1113+inlineToOpenXML' _ (Span (ident,["comment-end"],kvs) _) =
1114+ -- prefer the "id" in kvs, since that is the one produced by the docx
1116+ let ident' = fromMaybe ident (lookup "id" kvs)
1110− return [ mknode "w:commentRangeEnd" [("w:id", ident)] ()
1118+ return [ mknode "w:commentRangeEnd" [("w:id", ident')] ()
1111− , mknode "w:r" []
1119+ , mknode "w:r" []
1112− [ mknode "w:rPr" []
1120+ [ mknode "w:rPr" []
1113− [ mknode "w:rStyle" [("w:val", "CommentReference")] () ]
1121+ [ mknode "w:rStyle" [("w:val", "CommentReference")] () ]
1114− , mknode "w:commentReference" [("w:id", ident)] () ]
1122+ , mknode "w:commentReference" [("w:id", ident')] () ]
1116inlineToOpenXML' opts (Span (ident,classes,kvs) ils) = do
1124inlineToOpenXML' opts (Span (ident,classes,kvs) ils) = do
1117 stylemod <- case lookup dynamicStyleKey kvs of
1125 stylemod <- case lookup dynamicStyleKey kvs of
1118 Just sty -> do
1126 Just sty -> do