mirror of
https://github.com/qurator-spk/modstool.git
synced 2025-08-14 03:59:53 +02:00
🧹 MODS: Handle mods:languageTerm with authority=iso639-2/rfc3066
This commit is contained in:
parent
5f1c1f68a7
commit
64aafbb88c
2 changed files with 13 additions and 0 deletions
|
@ -187,6 +187,18 @@ class TagGroup:
|
|||
warnings.warn("Changed scriptTerm authority to lower case")
|
||||
return self
|
||||
|
||||
def fix_language_term(self) -> TagGroup:
|
||||
for e in self.group:
|
||||
if e.attrib["authority"] == "iso639-2":
|
||||
e.attrib["authority"] = "iso639-2b"
|
||||
warnings.warn("Changed languageTerm authority to iso639-2b")
|
||||
if e.attrib["authority"] == "rfc3066":
|
||||
if e.text == "de":
|
||||
e.attrib["authority"] = "iso639-2b"
|
||||
e.text = "deu"
|
||||
warnings.warn("Changed languageTerm authority from rfc3066 to iso639-2b")
|
||||
return self
|
||||
|
||||
def add_missing_type_text(self) -> TagGroup:
|
||||
for e in self.group:
|
||||
if not e.attrib.get("type") == "text":
|
||||
|
|
|
@ -255,6 +255,7 @@ def mods_to_dict(mods, raise_errors=True):
|
|||
elif tag == "{http://www.loc.gov/mods/v3}languageTerm":
|
||||
value["languageTerm"] = (
|
||||
TagGroup(tag, group)
|
||||
.fix_language_term()
|
||||
.has_attributes({"authority": "iso639-2b", "type": "code"})
|
||||
.text_set()
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue