Patch for RST compatability with latest version of docutils
Brought to you by:
edloper
The docutils package available from the reStructuredText website does not provide a "data" attribute on node.Text objects. This breaks Epydoc's RST integration.
A patch is provided to use the new node.Text interface (all occurances of "child.data" have been replaced with just "child").
Fix use of docutils.node.Text objects (no longer expose 'data' attribute)
The provided patch does not seem right for me. The second batch (from line 489) changes child only locally and should have no effect on the output.
It seems, I can't add my patch as a file, so I try it inline here:
<pre>
--- /home/hoel/epydoc-3.0.1/epydoc/markup/restructuredtext.py 2008-01-28 19:15:33.000000000 +0100
+++ /usr/software/gltools/python/Python-2.5-test/lib/python2.5/site-packages/epydoc-3.0.1-py2.5.egg/epydoc/markup/restructuredtext.py 2010-10-26 10:13:53.000007000 +0200
@@ -304,10 +304,10 @@
# Extract the first sentence.
for child in node:
if isinstance(child, docutils.nodes.Text):
- m = self._SUMMARY_RE.match(child.data)
+ m = self._SUMMARY_RE.match(child)
if m:
summary_pieces.append(docutils.nodes.Text(m.group(1)))
- other = child.data[m.end():]
+ other = child[m.end():]
if other and not other.isspace():
self.other_docs = True
break
@@ -489,10 +489,10 @@
if (len(fbody[0]) > 0 and
isinstance(fbody[0][0], docutils.nodes.Text)):
child = fbody[0][0]
- if child.data[:1] in ':-':
- child.data = child.data[1:].lstrip()
- elif child.data[:2] in (' -', ' :'):
- child.data = child.data[2:].lstrip()
+ if child.astext()[:1] in ':-':
+ fbody[0][0] = Text(child[1:].lstrip())
+ elif child.astext()[:2] in (' -', ' :'):
+ fbody[0][0] = Text(child[2:].lstrip())
# Wrap the field body, and add a new field
self._add_field(tagname, arg, fbody)
</pre>