Re: Howto ...

"Frédéric Gobry" <[email protected]> Fri, 2 Nov 2007 10:29:20 +0000
Newsgroups gmane.comp.gnome.apps.pybliographer
Message-ID <[email protected]>
2007/10/25, Flemming Bjerke <lister-ErnC9NNkj0Jaa/[email protected]>:
> ons, 24 10 2007 kl. 16:09 +0100, skrev Fr=E9d=E9ric Gobry:
> > > I should like to use the API's that the _bibtex module offers. But, I
> > > can't google or find any documentation:
> >
> > What are you trying to achieve?
>
> Let me give an example: I have a html-document that refers to a number
> references. These references are a subset of the references in a bibtex
> file. Now, I want to write a python script that parses the html-document
> and the bibtex-file in order to produce a list of litterature which is
> appended to the html-file.

This looks a bit like what pybcompact does for LaTeX documents. You
could have a look at scripts/pybcompact.py in the source distribution
of pybliographer for an example of how to do that.

> > Depending on your needs, the BibTeX
> > parser in pyblio-core 1.3, or the higher level python parser in pyblio
> > might be more helpful.
> What I would like to do, is to write python scripts in which I can
> import a library of functions that can parse, search, handle, change and
> store bibtex data. I could of course write such a library myself, but
> that would be waste of time since _bibtex already seems to be able to do
> it. My problem is that I can't find any documentation about how to use
> the functions in the _bibtex module?

Except the fact that you need to run your script with pybliographer
rather than python directly, I think the aforementioned script would
give you a good idea of how to do that. Basically you open the file
with

db =3D bibopen(filename)

...then access the bibtex records as if db is a dictionary.

-- =

Fr=E9d=E9ric

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/