1
0
mirror of synced 2024-11-22 01:04:23 +01:00

Remove a duplicate function

This is a leftover from today's best-effort merges.
This commit is contained in:
jvoisin 2024-04-05 19:51:14 +02:00
parent 156855ab7e
commit a47ac01eb6

View File

@ -355,39 +355,6 @@ class MSOfficeParser(ZipParser):
tree.write(full_path, xml_declaration=True, encoding='utf-8') tree.write(full_path, xml_declaration=True, encoding='utf-8')
return True return True
@staticmethod
def __remove_document_comment_meta(full_path: str) -> bool:
try:
tree, namespace = _parse_xml(full_path)
except ET.ParseError as e: # pragma: no cover
logging.error("Unable to parse %s: %s", full_path, e)
return False
# search the docs to see if we can bail early
range_start = tree.find('.//w:commentRangeStart', namespace)
range_end = tree.find('.//w:commentRangeEnd', namespace)
references = tree.find('.//w:commentReference', namespace)
if range_start is None and range_end is None and references is None:
return True # No comment meta tags are present
parent_map = {c:p for p in tree.iter() for c in p}
# iterate over the elements and add them to list
elements_del = list()
for element in tree.iterfind('.//w:commentRangeStart', namespace):
elements_del.append(element)
for element in tree.iterfind('.//w:commentRangeEnd', namespace):
elements_del.append(element)
for element in tree.iterfind('.//w:commentReference', namespace):
elements_del.append(element)
# remove the elements
for element in elements_del:
parent_map[element].remove(element)
tree.write(full_path, xml_declaration=True, encoding='utf-8')
return True
def __remove_content_type_members(self, full_path: str) -> bool: def __remove_content_type_members(self, full_path: str) -> bool:
""" The method will remove the dangling references """ The method will remove the dangling references
form the [Content_Types].xml file, since MS office doesn't like them form the [Content_Types].xml file, since MS office doesn't like them