Chapter 4. Creating new Styles

Table of Contents
Global formatting
Bibliography definition
Future of the format

It is possible to describe your own bibliography style, by writing a simple XML file. The XML file should have the following header:

<?xml version="1.0"?>
<!DOCTYPE bibstyle PUBLIC "-//Pybliographer//DTD Bibliographic Style Format//EN" "">

The whole description should fit in a <bibstyle> pair of tags, whose content is shortly described in this section. It is suggested that the interested users look at the corresponding DTD, which describes the allowed syntax in details. This DTD can be found in the same directory as the default style files.

Global formatting

The XML style file describes how the different data fields are organized in order to create a bibliographic style. For example, it can specify that an article starts with the article title in bold, followed by the authors names, etc.

In its current incarnation, the XML format can however not describe lower-level informations, like how an author's name should be output. This is done by pointing to a set of python functions, grouped in a module. Let's consider the following example:

  <module name="generic">
    <define field="author">full_authors</define>
    <define field="editor">first_last_full_authors</define>
    <define field="date">european_date</define>
    <define method="keys">string_keys</define>
  </module>

In this example, we require that the author fields should be formatted by the full_authors() function, located in the generic module.

Such a module has to be declared in the pybrc.py file, by a line like:
Autoload.preregister ('style','Generic','Pyblio.Style.Generic')

The precise definition of the formatting functions is better explained by looking at the code of Generic.py for example.