MCPcopy Create free account
hub / github.com/SpaceZephyr/myskill / _load_existing_comments

Method _load_existing_comments

docx/scripts/document.py:904–929  ·  view source on GitHub ↗

Load existing comments from files to enable replies.

(self)

Source from the content-addressed store, hash-verified

902 return max_id + 1
903
904 def _load_existing_comments(self):
905 """Load existing comments from files to enable replies."""
906 if not self.comments_path.exists():
907 return {}
908
909 editor = self["word/comments.xml"]
910 existing = {}
911
912 for comment_elem in editor.dom.getElementsByTagName("w:comment"):
913 comment_id = comment_elem.getAttribute("w:id")
914 if not comment_id:
915 continue
916
917 # Find para_id from the w:p element within the comment
918 para_id = None
919 for p_elem in comment_elem.getElementsByTagName("w:p"):
920 para_id = p_elem.getAttribute("w14:paraId")
921 if para_id:
922 break
923
924 if not para_id:
925 continue
926
927 existing[int(comment_id)] = {"para_id": para_id}
928
929 return existing
930
931 # ==================== Private: Setup Methods ====================
932

Callers 1

__init__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected