Re: changing default key for pybliographer
Scott Webster <[email protected]>
| Newsgroups | gmane.comp.gnome.apps.pybliographer |
|---|---|
| Message-ID | <[email protected]> |
This thread is a bit old now, but I only got around to trying this recently. To recap: I am trying to change how the default 'key' is generated without modifying the base pybliographer install files... that is, I want to run the system installed version, but redefine some things using files in my home directory (since this is a shared machine). I can use my own pybrc.py file if I want, and whatever is in .pybrc.py (note the "dot") is also executed. I was trying to replace the functionality contained in (on my system) /usr/share/pybliographer/Pyblio/Utils.py with a new version by changing the "generate_key" function and then redefining that in .pybrc.py etc.) That didn't seem to work though, and I have since noticed that there are other key-generating functions contained in various files in /usr/share/pybliographer/Pyblio/Style/ So, I guess my first question to get started is: Which key generating function is used when I am running pybliographic and add a new entry (without manually specifying the key)? Maybe this depends on some other settings? If I know which function I need to change then I can start working on properly redefining that through some files in my home directory. Thanks, Scott On Fri, 22 Oct 2004 17:57:51 -0400, Yaroslav Halchenko <[email protected]> wrote: > *ravana[0] ~>grep '~' /usr/bin/pybliographer > sources.append (os.path.expanduser('~/.pybrc.py')) > > So I believe you can (re)define some functionality there... but the > developers should know better about hooks for userdefined code > > > > On Fri, Oct 22, 2004 at 01:43:38PM -0700, Scott Webster wrote: > > Interesting... I thought of writing something like this myself > > (currently I just manually enter each Key). > > > It would be nice if this was possible without editing the system wide > > pybliographer files though. I guess I could just install everything > > in my home directory and edit it there, but that's kindof a pain. Is > > there some other way to do this? > > > Thanks, > > > Scott > > > On Fri, 22 Oct 2004 15:45:17 +0100, david.evans-I9fZos/[email protected] > > <david.evans-I9fZos/[email protected]> wrote: > > > 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 > > > _______________________________________________ > > > 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 > > _______________________________________________ > > Pybliographer-general mailing list > > Pybliographer-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org > > https://lists.sourceforge.net/lists/listinfo/pybliographer-general > > -- > .-. > =------------------------------ /v\ ----------------------------= > Keep in touch // \\ (yoh@|www.)onerussian.com > Yaroslav Halchenko /( )\ ICQ#: 60653192 > Linux User ^^-^^ [175555] > Key http://www.onerussian.com/gpg-yoh.asc > GPG fingerprint 3BB6 E124 0643 A615 6F00 6854 8D11 4563 75C0 24C8 > > > ------------------------------------------------------- This SF.Net email is sponsored by: Sybase ASE Linux Express Edition - download now for FREE LinuxWorld Reader's Choice Award Winner for best database on Linux. http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click