mirror of
https://gitdl.cn/https://github.com/chakralinux/desktop.git
synced 2025-02-03 18:07:16 +08:00
48 lines
2.3 KiB
Diff
48 lines
2.3 KiB
Diff
# 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)
|