changeset 1815:4dbc0547b7e0

merged main
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 24 Feb 2007 20:42:21 +0100
parents 11b75f065ebd (current diff) 1c3d65c8ae8f (diff)
children 4a31739bc6e1
files
diffstat 2 files changed, 11 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_moin_wiki.py	Sat Feb 24 20:41:01 2007 +0100
+++ b/MoinMoin/parser/text_moin_wiki.py	Sat Feb 24 20:42:21 2007 +0100
@@ -870,9 +870,8 @@
             self.macro = macro.Macro(self)
         return self.formatter.macro(self.macro, macro_name, args)
 
-    def scan(self, scan_re, line):
+    def scan(self, scan_re, line, inhibit_p=False):
         """ Scans one line
-        
         Append text before match, invoke replace() with match, and add text after match.
         """
         result = []
@@ -886,27 +885,27 @@
 
                 ###result.append(u'<span class="info">[add text before match: <tt>"%s"</tt>]</span>' % line[lastpos:match.start()])
 
-                if not (self.inhibit_p or self.in_pre or self.formatter.in_p):
+                if not (inhibit_p or self.inhibit_p or self.in_pre or self.formatter.in_p):
                     result.append(self.formatter.paragraph(1, css_class="line862"))
                 result.append(self.formatter.text(line[lastpos:match.start()]))
 
             # Replace match with markup
-            if not (self.inhibit_p or self.in_pre or self.formatter.in_p or
+            if not (inhibit_p or self.inhibit_p or self.in_pre or self.formatter.in_p or
                     self.in_table or self.in_list):
                 result.append(self.formatter.paragraph(1, css_class="line867"))
-            result.append(self.replace(match))
+            result.append(self.replace(match, inhibit_p))
             lastpos = match.end()
 
         ###result.append('<span class="info">[no match, add rest: <tt>"%s"<tt>]</span>' % line[lastpos:])
 
         # Add paragraph with the remainder of the line
-        if not (self.in_pre or self.in_li or self.in_dd or self.inhibit_p or
+        if not (inhibit_p or self.in_pre or self.in_li or self.in_dd or self.inhibit_p or
                 self.formatter.in_p) and lastpos < len(line):
             result.append(self.formatter.paragraph(1, css_class="line874"))
         result.append(self.formatter.text(line[lastpos:]))
         return u''.join(result)
 
-    def replace(self, match):
+    def replace(self, match, inhibit_p=False):
         """ Replace match using type name """
         result = []
         for type, hit in match.groupdict().items():
@@ -914,7 +913,7 @@
 
                 ##result.append(u'<span class="info">[replace: %s: "%s"]</span>' % (type, hit))
                 # Open p for certain types
-                if not (self.inhibit_p or self.formatter.in_p
+                if not (inhibit_p or self.inhibit_p or self.formatter.in_p
                         or self.in_pre or (type in self.no_new_p_before)):
                     result.append(self.formatter.paragraph(1, css_class="line891"))
 
@@ -938,7 +937,7 @@
         else:
             return ''
 
-    def format(self, formatter):
+    def format(self, formatter, inhibit_p=False):
         """ For each line, scan through looking for magic
             strings, outputting verbatim any intervening text.
         """
@@ -1122,7 +1121,7 @@
 
             # Scan line, format and write
             scanning_re = self.in_pre and pre_scan_re or scan_re
-            formatted_line = self.scan(scanning_re, line)
+            formatted_line = self.scan(scanning_re, line, inhibit_p=inhibit_p)
             self.request.write(formatted_line)
             if self.in_pre == 'no_parser':
                 self.request.write(self.formatter.linebreak())
--- a/MoinMoin/wikiutil.py	Sat Feb 24 20:41:01 2007 +0100
+++ b/MoinMoin/wikiutil.py	Sat Feb 24 20:42:21 2007 +0100
@@ -1636,8 +1636,8 @@
     import StringIO
     out = StringIO.StringIO()
     request.redirect(out)
-    wikiizer = Parser(text, request, line_anchors=line_anchors)
-    wikiizer.format(request.formatter)
+    wikiizer = Parser(text, request)
+    wikiizer.format(request.formatter,inhibit_p=True)
     result = out.getvalue()
     request.redirect()
     del out