#24 Update reStructuredText parser w.r.t docutils v0.7

open
nobody
None
5
2011-03-09
2011-03-09
RobM
No

Update reStructuredText parser for compatability with DocUtils v0.7.

This patch brings EpyDoc's usage of docutils.nodes.Text objects inline with
API changes made in DocUtils v0.6.

Specicially, Text objects no longer expose a `data` attribute holding the
objects string data, rather Text objects subclass Python's unicode class. It
follows that code which used to access this data as, say, `child.data` can now
access it simply as `child`.

Modification (as opposed to accessing) is slightly trickier. For instance a
sub-string can be obtained using slices (e.g. `Text[2:]`) but the object
returned is a `unicode` instance, not a `Text` instance. The can be easily
worked around by constructing a `Text` object from the string data, for
example::

child.data = child.data[2:].strip()

becomes::

child = docutils.node.Text( child[2:].strip() )

I wasn't able to find a test-suite for EpyDoc (the `epydoc/test` package looks
for `*.doctest` files, of which there are none), but this "works for me" on a
Python project containing 25,816 docstrings.

Discussion

  • RobM
    RobM
    2011-03-09

    Update reStructuredText parser for compatability with DocUtils v0.7.

     
    Attachments