diff --git a/pubs/endecoder.py b/pubs/endecoder.py index 5f75397..ea1fedf 100644 --- a/pubs/endecoder.py +++ b/pubs/endecoder.py @@ -50,9 +50,7 @@ def customizations(record): record = bp.customization.editor(record) record = bp.customization.journal(record) record = bp.customization.keyword(record) - record = bp.customization.link(record) record = bp.customization.page_double_hyphen(record) - record = bp.customization.doi(record) record = sanitize_citekey(record) @@ -95,8 +93,6 @@ class EnDecoder(object): entry[BP_ENTRYTYPE_KEY] = entry.pop(TYPE_KEY) for f in ignore_fields: entry.pop(f, None) - if 'link' in entry: - entry['link'] = ', '.join(link['url'] for link in entry['link']) if 'author' in entry: entry['author'] = ' and '.join( author for author in entry['author']) diff --git a/tests/test_endecoder.py b/tests/test_endecoder.py index 27efe75..8309557 100644 --- a/tests/test_endecoder.py +++ b/tests/test_endecoder.py @@ -121,6 +121,18 @@ class TestEnDecode(unittest.TestCase): self.assertEqual(lines[9].split('=')[0].strip(), u'note') self.assertEqual(lines[10].split('=')[0].strip(), u'abstract') + def test_endecode_link_as_url(self): + decoder = endecoder.EnDecoder() + if 'url = ' not in bibtex_raw0: + raise NotImplementedError( + 'The fixture bibraw0 has been changed; test needs an update.') + raw_with_link = bibtex_raw0.replace('url = ', 'link = ') + entry = decoder.decode_bibdata(raw_with_link) + lines = decoder.encode_bibdata(entry).splitlines() + self.assertEqual(lines[8].split('=')[0].strip(), u'url') + self.assertEqual(lines[8].split('=')[1].strip(), + u'{http://ilpubs.stanford.edu:8090/422/},') + def test_endecode_bibtex_ignores_fields(self): decoder = endecoder.EnDecoder() entry = decoder.decode_bibdata(bibtex_raw0)