X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e42c7b856732d0f7c3a209a42c269c613d40578a..ddfc587a2ea899f654d940c21f102316a39985bd:/wxPython/samples/stxview/StructuredText/ST.py?ds=inline diff --git a/wxPython/samples/stxview/StructuredText/ST.py b/wxPython/samples/stxview/StructuredText/ST.py index 2e6d0aba1f..3917adcaa8 100644 --- a/wxPython/samples/stxview/StructuredText/ST.py +++ b/wxPython/samples/stxview/StructuredText/ST.py @@ -26,7 +26,9 @@ def insert(struct, top, level): """ #print "struct", struct, top-1 if not top-1 in range(len(struct)): - return None + if struct: + return struct[len(struct)-1].getSubparagraphs() + return struct run = struct[top-1] i = 0 while i+1 < level: @@ -142,8 +144,11 @@ def StructuredText(paragraphs, paragraph_delimiter=re.compile('\n\s*\n')): if result > 0: currentlevel = result currentindent = indent - run = insert(struct,level,currentlevel) - run.append(StructuredTextParagraph(paragraph, indent=indent, level=currentlevel)) + if not level: + struct.append(StructuredTextParagraph(paragraph, indent=indent, level=currentlevel)) + else: + run = insert(struct,level,currentlevel) + run.append(StructuredTextParagraph(paragraph, indent=indent, level=currentlevel)) else: if insert(struct,level,currentlevel): run = insert(struct,level,currentlevel)