Commit abb13595 authored by Andrey Golovizin's avatar Andrey Golovizin
Browse files

Fix doctests in documentation

parent 1fee83f2
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@ Reading and writing bibliography data

.. testsetup:: *

    from __future__ import unicode_literals, print_function

    import six

    from pybtex.database import BibliographyData, Entry, Person, parse_string


@@ -35,7 +39,7 @@ Here is a quick example:

    >>> from pybtex.database import parse_file
    >>> bib_data = parse_file('../examples/tugboat/tugboat.bib')
    >>> print bib_data.entries['Knuth:TB8-1-14'].fields['title']
    >>> print(bib_data.entries['Knuth:TB8-1-14'].fields['title'])
    Mixing right-to-left texts with left-to-right texts
    >>> for author in bib_data.entries['Knuth:TB8-1-14'].persons['author']:
    ...     print(unicode(author))
@@ -65,7 +69,7 @@ symmetrical to the functions described above:
    ...         ('year', '1986'),
    ...     ]),
    ... })
    >>> print bib_data.to_string('bibtex')
    >>> print(bib_data.to_string('bibtex'))
    @article{article-minimal,
        author = "L[eslie] B. Lamport",
        title = "The Gnats and Gnus Document Preparation System",
+7 −3
Original line number Diff line number Diff line
@@ -5,6 +5,10 @@ Designing styles

.. testsetup:: *

    from __future__ import unicode_literals, print_function

    import six

    from pybtex.richtext import Text, String, Tag, HRef, Protected, Symbol, nbsp, textutils


@@ -38,9 +42,9 @@ The basic workflow is:

    >>> from pybtex.richtext import Text, Tag
    >>> text = Text('How to be ', Tag('em', 'a cat'), '.')
    >>> print text.render_as('html')
    >>> print(text.render_as('html'))
    How to be <em>a cat</em>.
    >>> print text.render_as('latex')
    >>> print(text.render_as('latex'))
    How to be \emph{a cat}.


@@ -82,7 +86,7 @@ is represented by this object tree:
    ...     Tag('em', 'comprehensive'),
    ...     '.',
    ... )
    >>> print text.render_as('html')
    >>> print(text.render_as('html'))
    <a href="http://ctan.org/"><em>Comprehensive</em> TeX Archive Network</a> is <em>comprehensive</em>.

:py:class:`Protected` represents a "protected" piece of text, something like