fix for 187
This commit is contained in:
parent
c8352fb7df
commit
e58ae98b93
@ -54,7 +54,6 @@ def many_from_path(ui, bibpath, ignore=False):
|
|||||||
|
|
||||||
bibpath = system_path(bibpath)
|
bibpath = system_path(bibpath)
|
||||||
if os.path.isdir(bibpath):
|
if os.path.isdir(bibpath):
|
||||||
print([os.path.splitext(f)[-1][1:] for f in os.listdir(bibpath)])
|
|
||||||
all_files = [os.path.join(bibpath, f) for f in os.listdir(bibpath)
|
all_files = [os.path.join(bibpath, f) for f in os.listdir(bibpath)
|
||||||
if os.path.splitext(f)[-1][1:] == 'bib']
|
if os.path.splitext(f)[-1][1:] == 'bib']
|
||||||
else:
|
else:
|
||||||
|
@ -122,7 +122,7 @@ class EnDecoder(object):
|
|||||||
def decode_bibdata(self, bibdata):
|
def decode_bibdata(self, bibdata):
|
||||||
"""Decodes bibdata from string.
|
"""Decodes bibdata from string.
|
||||||
|
|
||||||
If the decoding fails, returns a BibParseError.
|
If the decoding fails, returns a BibDecodingError.
|
||||||
"""
|
"""
|
||||||
if len(bibdata) == 0:
|
if len(bibdata) == 0:
|
||||||
error_msg = 'parsing error: the provided string has length zero.'
|
error_msg = 'parsing error: the provided string has length zero.'
|
||||||
@ -131,7 +131,6 @@ class EnDecoder(object):
|
|||||||
entries = bp.bparser.BibTexParser(
|
entries = bp.bparser.BibTexParser(
|
||||||
bibdata, common_strings=True, customization=customizations,
|
bibdata, common_strings=True, customization=customizations,
|
||||||
homogenize_fields=True).get_entry_dict()
|
homogenize_fields=True).get_entry_dict()
|
||||||
|
|
||||||
# Remove id from bibtexparser attribute which is stored as citekey
|
# Remove id from bibtexparser attribute which is stored as citekey
|
||||||
for e in entries:
|
for e in entries:
|
||||||
entries[e].pop(BP_ID_KEY)
|
entries[e].pop(BP_ID_KEY)
|
||||||
@ -140,6 +139,9 @@ class EnDecoder(object):
|
|||||||
entries[e][TYPE_KEY] = t
|
entries[e][TYPE_KEY] = t
|
||||||
if len(entries) > 0:
|
if len(entries) > 0:
|
||||||
return entries
|
return entries
|
||||||
|
else:
|
||||||
|
raise self.BibDecodingError(('no valid entry found in the provided data: '
|
||||||
|
' {}').format(bibdata), bibdata)
|
||||||
except (pyparsing.ParseException, pyparsing.ParseSyntaxException) as e:
|
except (pyparsing.ParseException, pyparsing.ParseSyntaxException) as e:
|
||||||
error_msg = self._format_parsing_error(e)
|
error_msg = self._format_parsing_error(e)
|
||||||
raise self.BibDecodingError(error_msg, bibdata)
|
raise self.BibDecodingError(error_msg, bibdata)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user