diff --git a/pubs/endecoder.py b/pubs/endecoder.py index 0322b02..346af3a 100644 --- a/pubs/endecoder.py +++ b/pubs/endecoder.py @@ -113,7 +113,7 @@ class EnDecoder(object): author for author in entry['author']) if 'editor' in entry: entry['editor'] = ' and '.join( - editor['name'] for editor in entry['editor']) + editor for editor in entry['editor']) if 'keyword' in entry: entry['keyword'] = ', '.join( keyword for keyword in entry['keyword']) @@ -137,6 +137,12 @@ class EnDecoder(object): # Convert bibtexparser entrytype key to internal 'type' t = entries[e].pop(BP_ENTRYTYPE_KEY) 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: return entries else: @@ -149,7 +155,6 @@ class EnDecoder(object): error_msg = 'parsing error: undefined string in provided data: {}'.format(e) raise self.BibDecodingError(error_msg, bibdata) - @classmethod def _format_parsing_error(cls, e): """Transform a pyparsing exception into an error message diff --git a/pubs/version.py b/pubs/version.py index 4ca39e7..2b0631f 100644 --- a/pubs/version.py +++ b/pubs/version.py @@ -1 +1 @@ -__version__ = '0.8.2' +__version__ = '0.8.2-r1' diff --git a/tests/data/many_fields.bib b/tests/data/many_fields.bib new file mode 100644 index 0000000..0a4c11f --- /dev/null +++ b/tests/data/many_fields.bib @@ -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", +} diff --git a/tests/test_usecase.py b/tests/test_usecase.py index 952cb1b..c83a626 100644 --- a/tests/test_usecase.py +++ b/tests/test_usecase.py @@ -861,7 +861,7 @@ class TestUsecase(DataCommandTestCase): ] 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): cmds = ['pubs init',