File: INSTALL.rst

package info (click to toggle)
pybtex-docutils 0.2.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 248 kB
  • sloc: python: 314; makefile: 145
file content (37 lines) | stat: -rw-r--r-- 970 bytes parent folder | download | duplicates (2)
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
Install the module with ``pip install pybtex-docutils``, or from
source using ``python setup.py install``.

.. _minimal-example:

Minimal Example
---------------

.. code-block:: python

    import six
    import pybtex.database.input.bibtex
    import pybtex.plugin

    style = pybtex.plugin.find_plugin('pybtex.style.formatting', 'plain')()
    backend = pybtex.plugin.find_plugin('pybtex.backends', 'docutils')()
    parser = pybtex.database.input.bibtex.Parser()
    data = parser.parse_stream(six.StringIO(u"""
    @Book{1985:lindley,
      author =    {D. Lindley},
      title =     {Making Decisions},
      publisher = {Wiley},
      year =      {1985},
      edition =   {2nd},
    }
    """))
    for entry in style.format_entries(six.itervalues(data.entries)):
        print(backend.paragraph(entry))

would produce:

.. code-block:: xml

   <paragraph>
     D. Lindley. <emphasis>Making Decisions</emphasis>.
     Wiley, 2nd edition, 1985.
   </paragraph>