From: Frederic G. <fre...@ep...> - 2000-10-09 07:54:50
|
> I don't use LyX (raw latex for me, thank you), but I have my grumpy ideas > about what my keys should look like. Is there a good entry point into the > code where different modules could be installed? Then each person could write > their own. I doubt anyone else wants keys like: > Finnefrock97:_time_resolved_measurements_overlayer_ordering Pybliographer has a simple extension mechanism that allows for user defined variables and on-demand loadable modules. These mechanisms are implemented by Pyblio/Config.py and Pyblio/Autoload.py. All the keys are generated by the function generate_key(entry, base) in Pyblio/Utils.py. The first argument is the entry that requires a new key, and base is the database that will adopt the entry. The generating function has to ensure key unicity. Ask me for more details if the code is unclear. For the moment, there is no extension mechanism for the keys. But I've committed some modifications this week-end, so that you can define a new function in your .pybrc.py and register it as the official key generator. This modification will be in pybliographer 1.0.6. For the moment, you can try to change the version in Pyblio/Utils.py so that you have something that suits your needs, but don't forget to backup your function before you install 1.0.6. The other method is to get the CVS version of pybliographer (from GNOME cvs) and immediately use the extension mechanism. > Also, what's the best/approved way of writing another input conversion script? > An XML file or python code like Medline.py ? I'm not sure I see how an XML file could be an input conversion script... For the moment, there is no XML parser for databases, even if this is planned for the future... No, the standard way is to write a python module, a la Medline.py > I think the biggest frustration with any of the free bibliographic programs > out there is that they won't read/write the formats that you absolutely need. > And new formats sprout up like weeds. Could you write a brief description of > how to write/submit these conversion scripts? I would like to contribute, and > also get pybliographer to really work for me. Maybe others feel the same way. I would be really happy to receive any contribution in terms of formats, extensions, ... To create a new format, you just have to mimic an existing module like Medline and find a name for it. Then you can send me the py file with explanations on what it can read, and I'll add it in the main distribution. On your side, to test it, just create a new file in Pyblio/Format and preregister it in pybrc.py so that the system is aware of its existence. Then you should be able to use it directly. Basically, a format module has to register three methods : one to create a database from a file/URL, one to create an iterator from the same source, and one that can write entries of any type in the format you parse. An iterator is an abstraction that allows to loop over a sequence of entries. I suggest you have a look at the Reference documentation, especially on Iterator, DataBase and Entry, and then try to understand a parser, like Refer.py. Just tell me if something is not clear, I would be glad to give you additional informations. Frédéric |