From 371c7ef0de43989cf03fe8c436cd364a89c72118 Mon Sep 17 00:00:00 2001 From: Jonas Kulhanek Date: Mon, 29 Nov 2021 10:06:09 +0100 Subject: [PATCH] Fix failing tests --- pubs/bibstruct.py | 2 +- pubs/config/spec.py | 4 +++- tests/test_bibstruct.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pubs/bibstruct.py b/pubs/bibstruct.py index 23c3f6a..1d19f4f 100644 --- a/pubs/bibstruct.py +++ b/pubs/bibstruct.py @@ -113,7 +113,7 @@ def get_first_word(title): return word -def generate_citekey(bibdata, format_string='{author_last_name}{year}{short_title}'): +def generate_citekey(bibdata, format_string='{author_last_name}{year}'): """ Generate a citekey from bib_data. :raise ValueError: if no author nor editor is defined. diff --git a/pubs/config/spec.py b/pubs/config/spec.py index 92a8747..95c6e75 100644 --- a/pubs/config/spec.py +++ b/pubs/config/spec.py @@ -53,7 +53,9 @@ normalize_citekey = boolean(default=False) # {{author_last_name}}{{year}}{{short_title}} generates 'Yang2020Towards' # {{author_last_name:l}}{{year}}{{short_title:l}} generates 'yang2020towards' # {{author_last_name:u}}{{year}} generates 'YANG2020' -citekey_format = string(default='{{author_last_name:l}}{{year}}{{short_title:l}}') +# +# Uncomment the following line to enable automatic citekey generation +# citekey_format = string(default='{{author_last_name:l}}{{year}}{{short_title:l}}') [formating] diff --git a/tests/test_bibstruct.py b/tests/test_bibstruct.py index d06b0d8..e3b4299 100644 --- a/tests/test_bibstruct.py +++ b/tests/test_bibstruct.py @@ -43,7 +43,7 @@ class TestGenerateCitekey(unittest.TestCase): self.assertEqual(key, 'Salinger1961') def test_all_keys(self): - template = '{author_last_name}-{year}-{first_word}' + template = '{author_last_name}-{year}-{short_title}' bibentry = copy.deepcopy(fixtures.doe_bibentry) key = bibstruct.generate_citekey(bibentry, template) self.assertEqual(key, 'Doe-2013-Nice')