1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
|
<chapter id="styles">
<title>Creating new Styles</title>
<para>It is possible to describe your own bibliography style, by
writing a simple XML file. The XML file should have the following
header:</para>
<programlisting>
<?xml version="1.0"?>
</programlisting>
<para>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.</para>
<sect1 id="styles-global">
<title>Global formatting</title>
<para>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.</para>
<para>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:</para>
<programlisting>
<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>
</programlisting>
<para>In this example, we require that the
<emphasis>author</emphasis> fields should be formatted by the
<function>full_authors()</function> function, located in the
<filename>generic</filename> module.</para>
<para>Such a module has to be declared in the
<filename>pybrc.py</filename> file, by a line like:
<programlisting>Autoload.preregister ('style','Generic','Pyblio.Style.Generic')</programlisting>
</para>
<para>The precise definition of the formatting functions is better
explained by looking at the code of
<filename>Generic.py</filename> for example.</para>
</sect1>
<sect1 id="styles-definition">
<title>Bibliography definition</title>
<para>Once the basic formatting definitions have been specified,
it is possible to describe the aspect of the actual
bibliographies with following tags:</para>
<itemizedlist>
<listitem>
<para> <style name="<varname>stylename</varname>"></para>
<para>This tag specifies the current display style, among
<emphasis>bold, italic, slanted, emph</emphasis>.</para>
</listitem>
<listitem>
<para> <inentry name="<varname>entryname</varname>"></para>
<para>This tag encloses a block that is only to appear in
entries of type <varname>entryname</varname>.</para>
</listitem>
<listitem>
<para> <notinentry name="<varname>entryname</varname>"></para>
<para>This tag encloses a block that is only to appear in
entries that are <emphasis>not</emphasis> of type
<varname>entryname</varname>.</para>
</listitem>
<listitem>
<para> <infield name="<varname>fieldname</varname>"></para>
<para>This tag encloses a block that only appears when the
specified <varname>fieldname</varname> field exists in the
current entry.</para>
</listitem>
<listitem>
<para><notinfield name="<varname>fieldname</varname>"></para>
<para>This tag encloses a block that only appears when the
specified <varname>fieldname</varname> field <emphasis>does
not</emphasis> exist in the current entry.</para>
</listitem>
<listitem>
<para> <content <optional>name="<varname>fieldname</varname>"</optional>/></para>
<para>This empty tag is replaced by the content of the current
field (when placed in a <infield> block) or the content of
the field specified as attribute.</para>
</listitem>
<listitem>
<para> <separator></para>
<para>This tag's content evaluates to nothing when no text has
been issued so far. It is a convenient way to add a delimiter
after a series of fields without being worried of the special
case when the fields are not defined.</para>
</listitem>
</itemizedlist>
<para>The existing style files are a good source of examples.</para>
</sect1>
<sect1 id="styles-future">
<title>Future of the format</title>
<para>In the future, this rudimentary format will most likely be
replaced with an XSL-based mechanism, which should encompass both
the XML definition and the python modules, thus providing
standalone style files, parsable by any XSL parser.</para>
</sect1>
</chapter>
|