Merge pull request #189 from pubs/fix/188

Temporary fix for #188
main
Olivier Mangin 6 years ago committed by GitHub
commit ca5d7631b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -113,7 +113,7 @@ class EnDecoder(object):
author for author in entry['author']) author for author in entry['author'])
if 'editor' in entry: if 'editor' in entry:
entry['editor'] = ' and '.join( entry['editor'] = ' and '.join(
editor['name'] for editor in entry['editor']) editor for editor in entry['editor'])
if 'keyword' in entry: if 'keyword' in entry:
entry['keyword'] = ', '.join( entry['keyword'] = ', '.join(
keyword for keyword in entry['keyword']) keyword for keyword in entry['keyword'])
@ -137,6 +137,12 @@ class EnDecoder(object):
# Convert bibtexparser entrytype key to internal 'type' # Convert bibtexparser entrytype key to internal 'type'
t = entries[e].pop(BP_ENTRYTYPE_KEY) t = entries[e].pop(BP_ENTRYTYPE_KEY)
entries[e][TYPE_KEY] = t entries[e][TYPE_KEY] = t
# Temporary fix to #188 (to be fully fixed when the upstream
# issue: sciunto-org/python-bibtexparser/#229 is fixed too)
if 'editor' in entries[e]:
entries[e]['editor'] = [
editor['name'] if isinstance(editor, dict) else editor
for editor in entries[e]['editor']]
if len(entries) > 0: if len(entries) > 0:
return entries return entries
else: else:
@ -149,7 +155,6 @@ class EnDecoder(object):
error_msg = 'parsing error: undefined string in provided data: {}'.format(e) error_msg = 'parsing error: undefined string in provided data: {}'.format(e)
raise self.BibDecodingError(error_msg, bibdata) raise self.BibDecodingError(error_msg, bibdata)
@classmethod @classmethod
def _format_parsing_error(cls, e): def _format_parsing_error(cls, e):
"""Transform a pyparsing exception into an error message """Transform a pyparsing exception into an error message

@ -1 +1 @@
__version__ = '0.8.2' __version__ = '0.8.2-r1'

@ -0,0 +1,16 @@
@ARTICLE{Cesar2013,
authors = {Jean César},
title = {An amazing title},
year = {2013},
month = "jan",
volume = {12},
pages = {12-23},
journal = {Nice Journal},
abstract = {This is an abstract. This line should be long enough to test
multilines... and with a french érudit word},
comments = {A comment},
editors = {Edith Or and Anne Other},
keywords = {keyword1, keyword2},
links = {http://my.link/to-content},
subjects = "Some topic of interest",
}

@ -861,7 +861,7 @@ class TestUsecase(DataCommandTestCase):
] ]
outs = self.execute_cmds(cmds) outs = self.execute_cmds(cmds)
self.assertEqual(8, len(outs[-1].split('\n'))) self.assertEqual(9, len(outs[-1].split('\n')))
def test_import_one(self): def test_import_one(self):
cmds = ['pubs init', cmds = ['pubs init',

Loading…
Cancel
Save