Chapter 2. The scripting language

Table of Contents
Existing scripts
Writing your own scripts

pybliographer is in fact a simple set of classes and functions written in python, and that provides with a simple and homogenous access to bibliographic databases. Therefore, it is possible to write python scripts that make use of these specialized functions. The graphical interface, pybliographic, is itself a simple script on top of pybliographer.

To execute a script written for pybliographer, simply run

> pybliographer myscript.py

You can alternatively start your script by

#!/path/to/pybliographer

...rest of your script...
and make it executable.

Existing scripts

Some scripts are provided with pybliographer, both as example and as useful tools. They are quite short and should be readable with basical knowledge of python.

pybcheck

 This tool takes a list of files or directory, and check if
    they are valid (syntax, no entries with the same key,...)
    

It is possible to use its output directly in an emacs compile buffer, in order to jump directly to the encountered errors. To do so, type M-x compile, then the command pybcheck yourfiles, and use the middle button of the mouse to jump into the faulty file.

pybcompact

This tool extracts the citations made in a LaTeX document
    and generates a BibTeX file containing them.

Usually, one stores its bibliographies in one or several large BibTeX files, and lets bibtex extract the entries used in a LaTeX document. But it is sometime convenient to create a self-contained package (for example to share it in native form with somebody else, or to store it), with a minimalistic BibTeX file holding exactly the entries used in LaTeX. This tool does exactly that: it reads a LaTeX .aux file, and extract from the specified BibTeX databases the corresponding entries.

pybconvert

This  tool  converts from  one  bibliographic format  to
    another.

The general syntax is pretty simple. To convert from Refer to BibTeX for example, just run:

> pybconvert refer..bibtex toto.refer toto.bib

pybformat

This script generates a bibliography according to a
    bibliographic style, and outputs it in a specific format (like
    HTML, LaTeX,...) as it should appear in a document.

The general form of the command is

> pybformat [options] <style>:<format> database...

This command will use the format called alpha to create a bibliography in LaTeX. Several options are available to create these documents:

  • --output=... or -o ...: specify an output filename. STDOUT is the default

  • --header=... or -H ...: defines a file that will be prepended to the output file.

  • --footer=... or -F ...: defines a file that will be appended to the output file.

  • --list=styles or -l styles: lists the available styles

  • --list=output or -l output: lists the available output formats