changeset 3998:63a209dee4b3

fix delimiter process routine to handle close delimiter also. see MoinMoinBugs/GuiEditorCantNest
author Byeongweon [tasyblue@gmail.com]
date Fri, 08 Aug 2008 04:27:12 +0900
parents 238eceaf862d
children 5fbdb471fb42
files MoinMoin/converter/text_html_text_moin_wiki.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/converter/text_html_text_moin_wiki.py	Thu Aug 07 20:42:43 2008 +0900
+++ b/MoinMoin/converter/text_html_text_moin_wiki.py	Fri Aug 08 04:27:12 2008 +0900
@@ -922,6 +922,7 @@
             content_buffer = []
             longest_inner_formater = ''
             bang_args = ''
+            delimiters = []
 
             """ 
             below code fixed for MoinMoinBugs/GuiEditorCantNest bug
@@ -931,11 +932,9 @@
 
             for i in node.childNodes:
                 if i.nodeType == Node.TEXT_NODE:
-                    # get longest pre tag({{{) from content
-                    delimiters = re.compile("(?u){+").findall(i.data)
-                    if delimiters:
-                        longest_inner_formater = max([longest_inner_formater,\
-                                                      max(delimiters)])
+                    # get longest pre tag({{{ or }}}) from content
+                    delimiters.extend(re.compile("((?u){+)").findall(i.data))
+                    delimiters.extend(re.compile("((?u)}+)").findall(i.data))
                     for line in i.data.strip().split('\n'):
                         if line.strip().startswith('#!'):
                             if bang_args == '':
@@ -950,6 +949,9 @@
                     pass
                     #print i.localName
 
+            if delimiters:
+                longest_inner_formater = max(delimiters)
+
             if (len(longest_inner_formater) >= 3):
                 self.text.extend([("{" * (len(longest_inner_formater) + 1)) + bang_args, \
                                       self.new_line])