changeset 545:45a0c47d2749

change <p> generation for macros, update some comments imported from: moin--main--1.5--patch-549
author Thomas Waldmann <tw@waldmann-edv.de>
date Mon, 10 Apr 2006 10:38:45 +0000
parents bdaea0dcf3b1
children a3952e509faa
files ChangeLog MoinMoin/formatter/text_gedit.py MoinMoin/parser/wiki.py
diffstat 3 files changed, 23 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Apr 10 05:38:31 2006 +0000
+++ b/ChangeLog	Mon Apr 10 10:38:45 2006 +0000
@@ -2,6 +2,21 @@
 # arch-tag: automatic-ChangeLog--arch@arch.thinkmo.de--2003-archives/moin--main--1.5
 #
 
+2006-04-10 11:38:45 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-549
+
+    Summary:
+      change <p> generation for macros, update some comments
+    Revision:
+      moin--main--1.5--patch-549
+
+    change <p> generation for macros, update some comments
+    
+
+    modified files:
+     ChangeLog MoinMoin/formatter/text_gedit.py
+     MoinMoin/parser/wiki.py
+
+
 2006-04-10 06:38:31 GMT	Thomas Waldmann <tw@waldmann-edv.de>	patch-548
 
     Summary:
--- a/MoinMoin/formatter/text_gedit.py	Mon Apr 10 05:38:31 2006 +0000
+++ b/MoinMoin/formatter/text_gedit.py	Mon Apr 10 10:38:45 2006 +0000
@@ -94,7 +94,6 @@
     # Dynamic stuff / Plugins ############################################
     
     def macro(self, macro_obj, name, args):
-        # call the macro
         if args is not None:
             result =  "[[%s(%s)]]" % (name, args)    
         else:
@@ -103,7 +102,6 @@
 
     def processor(self, processor_name, lines, is_parser=0):
         """ processor_name MUST be valid!
-            writes out the result instead of returning it!
         """
         result = [self.preformatted(1)]
         for line in lines:
--- a/MoinMoin/parser/wiki.py	Mon Apr 10 05:38:31 2006 +0000
+++ b/MoinMoin/parser/wiki.py	Mon Apr 10 10:38:45 2006 +0000
@@ -829,7 +829,7 @@
     def _macro_repl(self, word):
         """Handle macros ([[macroname]])."""
         macro_name = word[2:-2]
-        self.inhibit_p = 1 # 0 fixes UserPreferences, but makes new trouble!
+        self.inhibit_p = 0 # 1 fixes UserPreferences, 0 fixes paragraph formatting for macros
 
         # check for arguments
         args = None
@@ -845,8 +845,7 @@
     def scan(self, scan_re, line):
         """ Scans one line
         
-        Append text before match, invoke replace() with match, and 
-        add text after match.
+        Append text before match, invoke replace() with match, and add text after match.
         """
         result = []
         lastpos = 0
@@ -860,19 +859,21 @@
                 ###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):
-                    result.append(self.formatter.paragraph(1, css_class="line879"))
+                    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):
+                result.append(self.formatter.paragraph(1, css_class="line867"))
             result.append(self.replace(match))
             lastpos = match.end()
         
         ###result.append('<span class="info">[no match, add rest: <tt>"%s"<tt>]</span>' % line[lastpos:])
         
-        # No match: Add paragraph with the text of the line
+        # Add paragraph with the remainder of the line
         if not (self.in_pre or self.inhibit_p or
                 self.formatter.in_p) and lastpos < len(line):
-            result.append(self.formatter.paragraph(1, css_class="line886"))
+            result.append(self.formatter.paragraph(1, css_class="line874"))
         result.append(self.formatter.text(line[lastpos:]))
         return u''.join(result)
 
@@ -889,7 +890,7 @@
                     # Open p for certain types
                     if not (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="line903"))
+                        result.append(self.formatter.paragraph(1, css_class="line891"))
                     
                     # Get replace method and replece hit
                     replace = getattr(self, '_' + type + '_repl')