Add author to people.xml (called during initialization).
(self, author)
| 1179 | return False |
| 1180 | |
| 1181 | def _add_author_to_people(self, author): |
| 1182 | """Add author to people.xml (called during initialization).""" |
| 1183 | people_path = self.word_path / "people.xml" |
| 1184 | |
| 1185 | # people.xml should already exist from _setup_tracking |
| 1186 | if not people_path.exists(): |
| 1187 | raise ValueError("people.xml should exist after _setup_tracking") |
| 1188 | |
| 1189 | editor = self["word/people.xml"] |
| 1190 | root = editor.get_node(tag="w15:people") |
| 1191 | |
| 1192 | # Check if author already exists |
| 1193 | if self._has_author(editor, author): |
| 1194 | return |
| 1195 | |
| 1196 | # Add author with proper XML escaping to prevent injection |
| 1197 | escaped_author = html.escape(author, quote=True) |
| 1198 | person_xml = f'''<w15:person w15:author="{escaped_author}"> |
| 1199 | <w15:presenceInfo w15:providerId="None" w15:userId="{escaped_author}"/> |
| 1200 | </w15:person>''' |
| 1201 | editor.append_to(root, person_xml) |
| 1202 | |
| 1203 | def _ensure_comment_relationships(self): |
| 1204 | """Ensure word/_rels/document.xml.rels has comment relationships.""" |
no test coverage detected