Skip to content

Commit 1720621

Browse files
authored
Raises exception for not parsed lines of bib file (#65)
Associated issue number and/or pull request reference Partially fixes #46 Proposed solution to the issue Raises exception with brief message
2 parents 62f6927 + 9f521f2 commit 1720621

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

pandarize/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.8.8"
1+
__version__ = "0.0.8.9"

pandarize/parser.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,13 @@ def _itemize_bib(lst):
166166
dic['alias'] = s[jj:kk].replace('{', '')
167167
else:
168168
if s:
169-
ii = sorted(rfindall(s, '='))[0]
170-
if s[-1] == ',':
171-
s = s[:-1]
172-
out = LatexNodes2Text().latex_to_text(s[ii+1:]).strip()
173-
dic[s[:ii].strip()] = out
169+
try:
170+
ii = sorted(rfindall(s, '='))[0]
171+
if s[-1] == ',':
172+
s = s[:-1]
173+
out = LatexNodes2Text().latex_to_text(s[ii+1:]).strip()
174+
dic[s[:ii].strip()] = out
175+
except Exception as e:
176+
print(f'Error: the following line of the file is not in a parsible format.\n=> {s}\nDescription: {e}\n')
174177

175178
return dic

0 commit comments

Comments
 (0)