Skip to content

Commit

Permalink
[YAML] Add exceptions based on rudimentary BibTeX syntax check
Browse files Browse the repository at this point in the history
  • Loading branch information
Ingmar Schoegl authored and ischoegl committed Jan 7, 2020
1 parent 143316a commit e63a10e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion interfaces/cython/cantera/ck2yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1350,7 +1350,13 @@ def readcitation():
break

if block[0]:
return re.findall(r'\w+', block[0])[1], block
regex = r"^@+([a-zA-z]+){+(\w+)[ ,]"
bib = re.findall(regex, block[0].strip())
if bib and block[-1].rstrip()[-1] == '}' and count == 0:
return bib[0][1], block
else:
raise InputError("Encountered invalid syntax in "
"BibTeX entry:\n{}".format('\n'.join(block)))
else:
return None, None

Expand Down

0 comments on commit e63a10e

Please sign in to comment.