1
0
Fork 0
mirror of https://github.com/qurator-spk/modstool.git synced 2025-08-14 03:59:53 +02:00

🧹 MODS: Remove extra attributes in mods:titleInfo

This commit is contained in:
Gerber, Mike 2025-08-07 20:07:20 +02:00
parent 2f00dfcce0
commit 231f53eb7a
2 changed files with 9 additions and 0 deletions

View file

@ -194,6 +194,14 @@ class TagGroup:
warnings.warn("Added type='text')")
return self
def remove_attributes(self, attribs) -> TagGroup:
if not isinstance(attribs, Sequence):
attribs = [attribs]
for e in self.group:
for a in attribs:
e.attrib.pop(a, None)
return self
def merge_sub_tags_to_set(self) -> dict:
from .mods4pandas import mods_to_dict

View file

@ -200,6 +200,7 @@ def mods_to_dict(mods, raise_errors=True):
TagGroup(tag, group)
.filter(only_standard_title)
.is_singleton()
.remove_attributes(["ID", "{http://www.w3.org/XML/1998/namespace}lang"])
.has_no_attributes()
.descend(raise_errors)
)