X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c12bc4de5887421242de7f619b3c5e265bf631ac..edb89f7e356761b4fbdaebb8b5ebd5c7a7643da7:/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)