Skip to content
Snippets Groups Projects
Commit d04c3f0a authored by Florian Obersteiner's avatar Florian Obersteiner :8ball:
Browse files

revision keywrd comments parser

parent f8ea4e0c
No related branches found
No related tags found
1 merge request!15updated normal comments handling
......@@ -216,26 +216,26 @@ class StandardNormalComments(collections.UserList):
# in the order listed in the ICARTT documentation.
currentKeyword = None
keywordLine = False
for l in raw:
possibleKeyword = l.split(":")[0].strip()
if possibleKeyword in self.keywords or re.match(
"R[a-zA-Z0-9]{1,2}[ ]*", possibleKeyword
):
if possibleKeyword in self.keywords or re.match("R[a-zA-Z0-9]{1,2}[ ]*", possibleKeyword):
currentKeyword = possibleKeyword
keywordLine = True
if not currentKeyword in self.keywords: # for the revisions only...
self.keywords[currentKeyword] = KeywordComment(
currentKeyword, False
)
self.keywords[currentKeyword] = KeywordComment(currentKeyword, False)
else:
keywordLine = False
if currentKeyword is None:
self.freeform.append(l)
elif keywordLine:
self.keywords[currentKeyword].append(l.replace(l.split(":")[0] + ":", "").strip())
else:
self.keywords[currentKeyword].append(
l.replace(l.split(":")[0] + ":", "").strip()
)
self.keywords[currentKeyword].append(l.strip())
for key in self.keywords:
if self.keywords[key].data == []:
if not self.keywords[key].data:
warnings.warn(
f"Normal comments: required keyword {str(key)} is missing."
)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment