solution for generating a new key is found
"Vitaly V. Ganusov" <V.V.Ganusov-A9UEEGoj2kpmR6Xm/[email protected]> Wed, 08 Nov 2006 17:19:34 +0100
| Newsgroups | gmane.comp.gnome.apps.pybliographer |
|---|---|
| Organization | Utrecht University |
| Message-ID | <[email protected]> |
Dear all,
we are using now a new type of the key for our bibtex databases that is
formatted the following way:
Author.journalYY where Author - is the last name of the first author,
journal - is the abbreviation of the journal title in lowercase letters
(i.e. Evoluton = e, Theoretical Population Biology = tpb, etc) and YY
are the last two digits of the year of publication.
Here is the script to be put in .pybrc.py for the generation of this key.
def generate_key_new_journal (entry, table):
if entry.has_key ('author'): aut = entry ['author']
elif entry.has_key ('editor'): aut = entry ['editor']
else: aut = ()
if entry.has_key ('journal') : journal = entry ['journal'].text
else: journal = ''
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, '')
tempjournal = split (journal, ' ')
if tempjournal == '': tempjournal = journal
journal = ''
for a in tempjournal:
journal = journal + a[0]
journal = journal.lower()
key = key + "." + journal
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', 'Author.journalYY', generate_key_new_journal)
To change keys in your bibtex database to this one do the following
1. save your bibtex database in refer format (make sure that exporting
format of pybliographic has no entry in variable %F)
2. import the refer database back into pybliographic and save it as bibtex.
Vitaly
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642