]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/samples/stxview/StructuredText/ST.py
Got a new version of StructuredText from Zope's CVS.
[wxWidgets.git] / wxPython / samples / stxview / StructuredText / ST.py
index 2e6d0aba1f114b51a4b7fcdbac17ec0bb243de71..3917adcaa82f9d4a2b560b254c63e735349b5fec 100644 (file)
@@ -26,7 +26,9 @@ def insert(struct, top, level):
     """
     #print "struct", struct, top-1
     if not top-1 in range(len(struct)):
     """
     #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:
     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
             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)
         else:
             if insert(struct,level,currentlevel):
                 run = insert(struct,level,currentlevel)