Re: changing default key for pybliographer
david.evans-I9fZos/[email protected]
| Newsgroups | gmane.comp.gnome.apps.pybliographer |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I did something similar by writing a new function in Utils.py. Mine
makes AuthorBCDYY,
where Author is the surname of the first author, B,C,D are the first
letters of the surnames of subsequent authors, and YY is the year.
It's probably an ugly hack by the standards of the developers, but it
works for me :)
Dave
def generate_key_new (entry, table):
if entry.has_key ('author'): aut = entry ['author']
elif entry.has_key ('editor'): aut = entry ['editor']
else: aut = ()
if len (aut) == 0:
global __entry
key = 'entry-%d' % __entry
__entry = __entry + 1
else:
honorific, first, last, lineage = aut [0].format ()
key = join (split (last, ' '), '')
nextkey = ''
if len (aut) > 1:
for a in aut:
honorific, first, last, lineage = a.format ()
nextkey = nextkey + join (map (lambda x:
x [0], split (last, ' ')), '')
nextkey = str (nextkey) [1:]
key = key + join (nextkey, '')
if entry.has_key ('date'):
year = entry ['date'].year
if year: key = key + str (year) [2:]
base = _flat (key)
key = Key.Key (table, base)
if table.has_key (key):
suff = ord ('a')
while table.has_key (key):
suff = suff + 1
if suff > ord ('z'):
suff = ord ('a')
base = base + 'a'
key = Key.Key (table, base + chr (suff))
return Key.Key (table, key)
Autoload.register ('key', 'New', generate_key_new)
---- Message from "Vitaly V. Ganusov" <[email protected]> at
2004-10-22 09:53:34 ------
>Hi,
>
>I'm intensively using pybliographer (gui version) to keep my library
in
>the bibtex format. One feature that I would like to change is the
>default way of creating a key for each new entry. Currently,
>pybliographer creates the key taking one letter of last names of 3
first
>authors of the entry plus year and plus additional letters (a,b,c,
etc)
>if such entry already is present. I would like to have it such as
the
>key is the complete last name of the first author plus the year of
>publication (last two digits - as it is currently) and adding a,b,c
>(etc) if needed at the end.
>
>Do you know if this can be done by changing configuration files or
>somehow else?
>
>help is greatly appreciated
>
>Vitaly
>
>--
>Vitaly V. Ganusov
>Population Biology, Ecology and Evolution Program
>Biology department
>Emory University
>Atlanta, GA 30322
>USA
>ph : +1 404-727-1765
>fax: +1 404-727-2880
>http://userwww.service.emory.edu/~vganuso/
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by: IT Product Guide on
ITManagersJournal
>Use IT products in your business? Tell us what you think of them.
Give us
>Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find
out more
>http://productguide.itmanagersjournal.com/guidepromo.tmpl
>_______________________________________________
>Pybliographer-general mailing list
>Pybliographer-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>https://lists.sourceforge.net/lists/listinfo/pybliographer-general
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl