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:
parent
2f00dfcce0
commit
231f53eb7a
2 changed files with 9 additions and 0 deletions
|
@ -194,6 +194,14 @@ class TagGroup:
|
||||||
warnings.warn("Added type='text')")
|
warnings.warn("Added type='text')")
|
||||||
return self
|
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:
|
def merge_sub_tags_to_set(self) -> dict:
|
||||||
from .mods4pandas import mods_to_dict
|
from .mods4pandas import mods_to_dict
|
||||||
|
|
||||||
|
|
|
@ -200,6 +200,7 @@ def mods_to_dict(mods, raise_errors=True):
|
||||||
TagGroup(tag, group)
|
TagGroup(tag, group)
|
||||||
.filter(only_standard_title)
|
.filter(only_standard_title)
|
||||||
.is_singleton()
|
.is_singleton()
|
||||||
|
.remove_attributes(["ID", "{http://www.w3.org/XML/1998/namespace}lang"])
|
||||||
.has_no_attributes()
|
.has_no_attributes()
|
||||||
.descend(raise_errors)
|
.descend(raise_errors)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue