From 69220a2e49ae8f7b013924ee0d8023f2917ecd36 Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Thu, 1 Sep 2022 17:33:42 +0200 Subject: [PATCH] build(codemeta): Support `[ORCID]` syntax --- codemeta_update.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/codemeta_update.py b/codemeta_update.py index 65c1c95c..a9f78147 100755 --- a/codemeta_update.py +++ b/codemeta_update.py @@ -37,17 +37,21 @@ class CodeMetaManipulator(object): if entry is None: entry = OrderedDict() entry['@type'] = 'Person' - for field in ('givenName', 'familyName', 'email'): + for field in ('givenName', 'familyName', 'email', 'orcid'): val = matchdict.get(field, None) if val is not None: - entry[field] = val + if field == 'orcid': + entry['@id'] = val + else: + entry[field] = val return entry def handle_person_list_file(self, filename, cm_field_name): fp = open(filename, 'r', encoding='utf8') findregex = re.compile(r'^(?P[-\w\s]*[-\w]),\s*' r'(?P[-\w\s]*[-\w])\s*' - r'(?:<(?P\S+@\S+)>)?$') + r'(?:<(?P\S+@\S+)>)?\s*' + r'(\[(?P\S+)\])?$') person_list = self.data.setdefault(cm_field_name, []) for line in fp: line = line.strip()