changeset 3996:40f10410e0b3

fix bug : MoinMoinBugs/GuiEditorDestroysParserSyntax
author Byeongweon [tasyblue@gmail.com]
date Tue, 05 Aug 2008 09:29:13 +0900
parents 529b71b82fdc
children 238eceaf862d
files MoinMoin/converter/text_html_text_moin_wiki.py MoinMoin/parser/text_moin_wiki.py
diffstat 2 files changed, 15 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/converter/text_html_text_moin_wiki.py	Mon Aug 04 09:14:27 2008 +0900
+++ b/MoinMoin/converter/text_html_text_moin_wiki.py	Tue Aug 05 09:29:13 2008 +0900
@@ -921,6 +921,7 @@
         else:
             content_buffer = []
             longest_inner_formater = ''
+            bang_args = ''
 
             for i in node.childNodes:
                 if i.nodeType == Node.TEXT_NODE:
@@ -929,8 +930,14 @@
                     if delimiters:
                         longest_inner_formater = max([longest_inner_formater,\
                                                       max(delimiters)])
-                    content_buffer.append(i.data)
-                    #print "'%s'" % i.data
+                    for line in i.data.strip().split('\n'):
+                        if line.strip().startswith('#!'):
+                            if bang_args == '':
+                                bang_args = line.strip()
+                            else:
+                                content_buffer.extend([line, self.new_line])
+                        else:
+                            content_buffer.extend([line, self.new_line])
                 elif i.localName == 'br':
                     content_buffer.append(self.new_line_dont_remove)
                 else:
@@ -938,13 +945,13 @@
                     #print i.localName
 
             if (len(longest_inner_formater) >= 3):
-                self.text.extend(["{" * (len(longest_inner_formater) + 1), \
-                                  self.new_line])
+                self.text.extend([("{" * (len(longest_inner_formater) + 1)) + bang_args, \
+                                      self.new_line])
                 self.text.extend(content_buffer)
                 self.text.extend(["}" * (len(longest_inner_formater) + 1), \
                                       self.new_line])
             else:
-                self.text.extend(["{{{", self.new_line])
+                self.text.extend(["{{{"+bang_args, self.new_line])
                 self.text.extend(content_buffer)
                 self.text.extend(["}}}", self.new_line])
 
--- a/MoinMoin/parser/text_moin_wiki.py	Mon Aug 04 09:14:27 2008 +0900
+++ b/MoinMoin/parser/text_moin_wiki.py	Tue Aug 05 09:29:13 2008 +0900
@@ -1364,7 +1364,9 @@
                     lastpos += 1 # proceed, we don't want to match this again
             else:
                 if self.in_pre:
-                    self._parser_content(line[lastpos:])
+                    # ilastpos is more then 0 and result of line slice is empty make useless line
+                    if not (lastpos > 0 and line[lastpos:] == ''):
+                        self._parser_content(line[lastpos:])
                 elif line[lastpos:]:
                     ###result.append('<span class="info">[no match, add rest: <tt>"%s"<tt>]</span>' % line[lastpos:])
                     if not (inhibit_p or self.inhibit_p or self.in_pre or self.formatter.in_p or