Merge pull request #124 from pubs/fix/link_customization

Removes link and DOI customization. Fixes #119.
main
Olivier Mangin 7 years ago committed by GitHub
commit 4ceeccddad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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'])

@ -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)

Loading…
Cancel
Save