summaryrefslogtreecommitdiffstats
path: root/abs/extra/epydoc/handle-docutils-0.6.patch
blob: 53f941c98182c9c989d761b326ffd195a6334a5b (plain)
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
# Description: Handle problems encountered with docutils 0.6.
#  The problem here is that the child.data element does not always exist any
#  more.  Apparently, the child element is sometimes a string instead.  So, we
#  work around it by only executing the code in question if child.data can be
#  referenced. Thanks to Thomas Hille for research and the initial patch.
# Bug-Debian: http://bugs.debian.org/561793
# Author: Kenneth J. Pronovici <pronovic@debian.org>
--- a/epydoc/markup/restructuredtext.py
+++ b/epydoc/markup/restructuredtext.py
@@ -304,13 +304,14 @@ class _SummaryExtractor(NodeVisitor):
         # Extract the first sentence.
         for child in node:
             if isinstance(child, docutils.nodes.Text):
-                m = self._SUMMARY_RE.match(child.data)
-                if m:
-                    summary_pieces.append(docutils.nodes.Text(m.group(1)))
-                    other = child.data[m.end():]
-                    if other and not other.isspace():
-                        self.other_docs = True
-                    break
+                if hasattr(child, 'data'):
+                    m = self._SUMMARY_RE.match(child.data)
+                    if m:
+                        summary_pieces.append(docutils.nodes.Text(m.group(1)))
+                        other = child.data[m.end():]
+                        if other and not other.isspace():
+                            self.other_docs = True
+                        break
             summary_pieces.append(child)
 
         summary_doc = self.document.copy() # shallow copy
@@ -489,10 +490,11 @@ class _SplitFieldsTranslator(NodeVisitor
             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 hasattr(child, 'data'):
+                    if child.data[:1] in ':-':
+                        child.data = child.data[1:].lstrip()
+                    elif child.data[:2] in (' -', ' :'):
+                        child.data = child.data[2:].lstrip()
 
             # Wrap the field body, and add a new field
             self._add_field(tagname, arg, fbody)