Closes issue #21.
0b64bf0 introduced a hack (http://git.io/1ZbMkg) related to an issue in bibtexparser : sciunto/python-bibtexparser/issues/17. This has been fixed by sciunto/python-bibtexparser@6beb646 and the hack can be safely removed. Pubs should be updated accordingly as soon as the bibtexparser FIX gets to a released version.
This commit is contained in:
parent
d37b15dc3d
commit
921c54f535
@ -1,4 +1,5 @@
|
|||||||
from __future__ import print_function, absolute_import, division, unicode_literals
|
from __future__ import (print_function, absolute_import, division,
|
||||||
|
unicode_literals)
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
@ -92,27 +93,20 @@ class EnDecoder(object):
|
|||||||
for key in bibfield_order:
|
for key in bibfield_order:
|
||||||
if key in bibentry:
|
if key in bibentry:
|
||||||
value = bibentry.pop(key)
|
value = bibentry.pop(key)
|
||||||
bibraw += ' {} = {{{}}},\n'.format(key, EnDecoder._encode_field(key, value))
|
bibraw += ' {} = {{{}}},\n'.format(
|
||||||
|
key, EnDecoder._encode_field(key, value))
|
||||||
for key, value in bibentry.items():
|
for key, value in bibentry.items():
|
||||||
if key != 'type':
|
if key != 'type':
|
||||||
bibraw += ' {} = {{{}}},\n'.format(key, EnDecoder._encode_field(key, value))
|
bibraw += ' {} = {{{}}},\n'.format(
|
||||||
|
key, EnDecoder._encode_field(key, value))
|
||||||
bibraw += '}\n'
|
bibraw += '}\n'
|
||||||
return bibraw
|
return bibraw
|
||||||
|
|
||||||
def decode_bibdata(self, bibdata_unicode):
|
def decode_bibdata(self, bibdata):
|
||||||
""""""
|
""""""
|
||||||
if isinstance(bibdata_unicode, str):
|
|
||||||
# Nothing to do for python3
|
|
||||||
bibdata_string = bibdata_unicode
|
|
||||||
else:
|
|
||||||
# For python2 bibtexparser expects utf8 encoded string
|
|
||||||
bibdata_string = bibdata_unicode.encode('utf8')
|
|
||||||
return self._decode_bibdata(bibdata_string)
|
|
||||||
|
|
||||||
def _decode_bibdata(self, bibdata_string):
|
|
||||||
try:
|
try:
|
||||||
entries = bp.bparser.BibTexParser(
|
entries = bp.bparser.BibTexParser(
|
||||||
bibdata_string, customization=customizations).get_entry_dict()
|
bibdata, customization=customizations).get_entry_dict()
|
||||||
# Remove 'id' attribute which is stored as citekey
|
# Remove 'id' attribute which is stored as citekey
|
||||||
for e in entries:
|
for e in entries:
|
||||||
entries[e].pop('id')
|
entries[e].pop('id')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user