From 2f00dfcce0acd098ef8e56d1c6d9b67e318a28e7 Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Thu, 7 Aug 2025 19:32:37 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20MODS:=20Add=20missing=20type=3D'?= =?UTF-8?q?text'=20for=20mods:placeTerm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mods4pandas/lib.py | 7 +++++++ src/mods4pandas/mods4pandas.py | 1 + 2 files changed, 8 insertions(+) diff --git a/src/mods4pandas/lib.py b/src/mods4pandas/lib.py index 4bf182f..ff33c2a 100644 --- a/src/mods4pandas/lib.py +++ b/src/mods4pandas/lib.py @@ -187,6 +187,13 @@ class TagGroup: warnings.warn("Changed scriptTerm authority to lower case") return self + def add_missing_type_text(self) -> TagGroup: + for e in self.group: + if not e.attrib.get("type") == "text": + e.attrib["type"] = "text" + warnings.warn("Added type='text')") + return self + def merge_sub_tags_to_set(self) -> dict: from .mods4pandas import mods_to_dict diff --git a/src/mods4pandas/mods4pandas.py b/src/mods4pandas/mods4pandas.py index e31ce07..3252999 100755 --- a/src/mods4pandas/mods4pandas.py +++ b/src/mods4pandas/mods4pandas.py @@ -99,6 +99,7 @@ def mods_to_dict(mods, raise_errors=True): value["placeTerm"] = ( TagGroup(tag, group) .is_singleton() + .add_missing_type_text() .has_attributes({"type": "text"}) .text() )