Re: format of citation keys
[email protected] (Unknown)
| Newsgroups | gmane.comp.gnome.apps.pybliographer |
|---|---|
| Message-ID | <[email protected]> |
hello dave
this looks promising.
i did what you suggested. followingly, i created a new pybliographic
database and importet a medline file. success -> keys look nice now!
however, my existing database are still with the old key format, and
that is not changed. so i tried exporting the database to medline
format, and import it into a new database. this gives the following
error:
maasha@krusty:~$ pybliographic
Traceback (most recent call last):
File "/usr/share/pybliographer/Pyblio/GnomeUI/Document.py", line 578, in ui_open_document
self.open_document (url, how)
File "/usr/share/pybliographer/Pyblio/GnomeUI/Document.py", line 592, in open_document
data = Open.bibopen (url, how = how)
File "/usr/share/pybliographer/Pyblio/Open.py", line 113, in bibopen
base = simple_try (url, how)
File "/usr/share/pybliographer/Pyblio/Open.py", line 95, in simple_try
base = opener (url, 0)
File "/usr/share/pybliographer/Pyblio/Format/Medline.py", line 279, in opener
base = Medline (url)
File "/usr/share/pybliographer/Pyblio/Format/Medline.py", line 206, in __init__
self.add (entry)
File "/usr/share/pybliographer/Pyblio/Base.py", line 188, in add
entry.key = Autoload.get_by_name ('key', keytype).data (entry, self)
File "/home/maasha/.pybrc.py", line 65, in generate_key_new2
key = 'entry-%d' % __entry
NameError: global name '__entry' is not defined
now, what is this?
i should say it comes from the script .pybrc.py ?
# DAE new type of key format AuthorBCDEYY
from string import *
from Pyblio import Key, Autoload, recode
_flat = recode.recode ('latin1..flat')
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)
def generate_key_new2 (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, ' '), '')
if entry.has_key ('date'):
year = entry ['date'].year
if year: key = key + str(year)
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', 'New2', generate_key_new2)
suggestions for a fix?
best regards
martin
On Mon, Jan 31, 2005 at 03:09:10PM +0000, david.evans-I9fZos/[email protected] wrote:
> If you use the attached .pybrc.py file (put it in your home directory
> before starting pybliographic), and select the imaginatively named
> New2 keyformat in Preferences, then I think that does what you want.
> If not, you should be able to edit that file to change it.
>
> hope that helps
>
> Dave
>
> ---- Message from [email protected] (Martin A. Hansen) at 2005-01-31
> 15:50:50 ------
> >hello
> >
> >
> >the following is cut & pasted from a pybliographic entry:
> >
> >Article [BDD+98]
> >Author Bork, P.; Dandekar, T.; Diaz-Lazcoz, Y.; Eisenhaber, F.;
> Huynen, M.; Yuan, Y.
> >Title Predicting function: from genes to genomes and back.
> >Journal J Mol Biol
> >Date 1998
> >Volume 283
> >Number 4
> >Pages 707-25
> >
> >
> >the format of the citation key is [BDD+98]. it is clear to me that
> the idea behind this
> >abbreviation is that the BDD is the first letter in the first three
> authors, and the + denotes
> >that there are more than three authors, and 98 denotes the year of
> the publication. this
> >format may seem logical enough, however, it is very un-intuitive and
> frustrating to work with,
> >when citing references in latex or lyx. the reason is that i
> remember all the papers being
> >cited by the first author - that is the above paper is Bork 1998 in
> my mind. thus i think it
> >would make much more sense to change the format of the citaion key
> to the name of the first
> >author along with the publication year so that [BDD+98] becomes
> [BORK1998]. if dr bork authors
> >more than one paper a year, then the succeeding papers should have
> a, b, c ... suffixed. eg.
> >[BORK1998a], [BORK1998b] ...
> >
> >
> >can this be done without too much trouble?
> >
> >
> >best regards
> >
> >
> >martin
> >
> >
> >-------------------------------------------------------
> >This SF.Net email is sponsored by: IntelliVIEW -- Interactive
> Reporting
> >Tool for open source databases. Create drag-&-drop reports. Save time
> >by over 75%! Publish reports on the web. Export to DOC, XLS, RTF,
> etc.
> >Download a FREE copy at http://www.intelliview.com/go/osdn_nl
> >_______________________________________________
> >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: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl