Commit 269550f7 authored by Amos Latteier's avatar Amos Latteier

Fixed a bug in how examples were handled.

Before this failed::

  line one

    line two

Now this example is handled correctly.
parent 1b24f247
......@@ -89,15 +89,25 @@ from string import split, join, replace, expandtabs, strip, find, rstrip
StringType=type('')
ListType=type([])
def flatten(obj, append):
if obj.getNodeType()==STDOM.TEXT_NODE:
append(obj.getNodeValue())
else:
for child in obj.getChildNodes():
flatten(child, append)
class StructuredTextExample(ST.StructuredTextParagraph):
"""Represents a section of document with literal text, as for examples"""
def __init__(self, subs, **kw):
t=[]; a=t.append
for s in subs: a(s.getNodeValue())
apply(ST.StructuredTextParagraph.__init__,
(self, join(t,'\n\n'), ()),
kw)
t=[]
a=t.append
for s in subs:
flatten(s, a)
apply(ST.StructuredTextParagraph.__init__,
(self, join(t,'\n\n'), ()),
kw)
def getColorizableTexts(self): return ()
def setColorizableTexts(self, src): pass # never color examples
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment