Another try to fix docutils version differences.

This commit is contained in:
Georg Brandl 2009-12-29 17:06:35 +01:00
parent 51760a0fde
commit b4ef4da181

View File

@ -160,7 +160,12 @@ class EpubBuilder(StandaloneHTMLBuilder):
"""Remove all HTML markup and return only the text nodes."""
for c in doctree.children:
if isinstance(c, nodes.Text):
result.append(c)
try:
# docutils 0.4 and 0.5: Text is a UserString subclass
result.append(c.data)
except AttributeError:
# docutils 0.6: Text is a unicode subclass
result.append(c)
else:
result = self.collapse_text(c, result)
return result