main
Fabien C. Y. Benureau 6 years ago
parent 6865e29d15
commit a484bab67d
No known key found for this signature in database
GPG Key ID: C3FB5E831A249A9A

@ -51,11 +51,9 @@ def author_last(author_str):
return author_str.split(',')[0] return author_str.split(',')[0]
def generate_citekey(bibdata, generate=True): def generate_citekey(bibdata):
""" Generate a citekey from bib_data. """ Generate a citekey from bib_data.
:param generate: if False, return the citekey defined in the file,
does not generate a new one.
:raise ValueError: if no author nor editor is defined. :raise ValueError: if no author nor editor is defined.
""" """
citekey, entry = get_entry(bibdata) citekey, entry = get_entry(bibdata)

@ -200,6 +200,7 @@ class Repository(object):
""" """
# can't have `/` in citekeys # can't have `/` in citekeys
# FIXME: a bit crude, but efficient for now (and allows unicode citekeys) # FIXME: a bit crude, but efficient for now (and allows unicode citekeys)
# TODO: check that the generated citekey does not have a slash too.
if '/' in base_key: if '/' in base_key:
base_key = bibstruct.generate_citekey(bibentry) base_key = bibstruct.generate_citekey(bibentry)
for n in itertools.count(): for n in itertools.count():

Loading…
Cancel
Save