Re: [Q] Scripting interface.

Daniel Carrera <dcarrera-8yXg+M/94Z32fBVCVOL8/[email protected]>
Newsgroups gmane.comp.gnome.apps.pybliographer
Message-ID <[email protected]>
Frederic Gobry wrote:

> I joined IRC 2 minutes after you left... and indeed, so far it's a quiet
> place :-)

:-)

> So far (pyblio 1.2), the bibtex parser is in C with a python binding. It
> also proved to be a pain to port (as there were endless issues with GNU
> recode on which it depends). The other importers are in pure python.
> 
> I'll try hard for 1.3 to not have hard requirements on external compiled
> dependencies.

I'll have my fingers crossed.


> Regard OO.org integration (a feature that is very high on the wish list
> :-)),

:-)

> do you know what would be needed to have some tight interaction ?
> (ie, inserting entries from the db itself, displaying the actual biblio
> keys in the document, inserting the final biblio where requested,...)

The OOo object model (called UNO) provides that for you.  Now, you should 
know that this will only work with the python that comes with the standard 
OOo installation.  It comes with all the libraries needed for the UNO 
binding which are not found in the regual python install.

 > I had no time to dig in the doc, so if you could provide us with a rough
 > sketch...

Yes, I can.  See here:

http://www.math.umd.edu/~dcarrera/biblio_uno.py

This could be the "framework" for a basic bibliographic filter.

The program needs a get_entries() function that returns the bibliographic 
entries as a dictioary with certain entries.  With that function, this 
program will then stick those entries into OOo's bibliographic databse.


You can also see this "in action" here:

http://www.math.umd.edu/~dcarrera/openoffice/bibtex/filter.html

This was my first attempt at a BibTeX filter.  It's really crappy.  But it's 
the only executable program I have so I an show you.


In order to make a filter that integrates tightly with OOo (e.g. has a menu 
entry, no need for the command-line) we have to do some more work.  There 
are some examples in the PyUNO web page.  But it's easiest to start with 
just a command-line program such as this one.

Disclaimer: Yes, I realize that my Python code is really ugly.  I'm a Python 
newbie.

Cheers,
Daniel.


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.