BlockQuote Patch

Just about the only reason for having this page is to reference my patch which addresses for this FeatureRequests/BlockQuote for MoinMoin Release 1.3.4:

Just add this line to the big fat regex in MoinMoin/parser/wiki.py

(?P<blockquote>(\(\(\( ?|\)\)\)))

and this function to the same file

   1     def _blockquote_repl(self, word):
   2         """Handle code displays."""
   3         word = word.strip()
   4         if word == '(((' :
   5             self.request.write('<blockquote>')
   6             return ''
   7         elif word == ')))' :
   8             self.request.write('</blockquote>')
   9             return ''
  10         else :
  11             return word

This is the patch against v1.3.4:

--- Copy of wiki.py     2005-05-17 17:28:26.882604000 +0100
+++ wiki.py     2005-05-17 17:23:24.421597200 +0100
@@ -58,6 +58,7 @@
 (?P<emph_ib_or_bi>'{5}(?=[^']))
 (?P<emph>'{2,3})
 (?P<u>__)
+(?P<blockquote>(\(\(\( ?|\)\)\)))
 (?P<sup>\^.*?\^)
 (?P<sub>,,[^,]{1,40},,)
 (?P<tt>\{\{\{.*?\}\}\})
@@ -838,6 +839,19 @@
             self.in_pre = 1
             return ''
 
+    def _blockquote_repl(self, word):
+        """Handle code displays."""
+        word = word.strip()
+        if word == '(((' :
+            self.request.write('<blockquote>')
+            return ''
+        elif word == ')))' :
+            self.request.write('</blockquote>')
+            return ''
+        else :
+            return word
+
+
     def _pre_repl(self, word):
         """Handle code displays."""
         word = word.strip()

This is a bit of a hack but it works and allows you to use (((this is a quote))) to output <blockquote>this is a quote</blockquote>. It functions pretty much like the code formatting using {{{ (mostly because I blatently copied that code) but wiki formatting will still work within the blockquote so you can still italize things with ''.

Ideally, this should be structured as a parser which extends wiki.py but I couldn't figure out how to get that to work well. If you find problems with the patch, please let me know (especially if you've fixed them because it's highly likely I won't be able to).

Problems

It actually doesn't like newlines much so you're quote should be

(((
this is a quote
)))

not (((this is a quote)))

Perhaps someone smarter than I will figure this out.

Enjoy!

Update Request

I'm using 1.8.4., and the code doesn't work. We need update, on codes and manual both. Anybody can do it?

MoinMoin: JamieLawrence/BlockQuote (last edited 2009-08-31 17:14:39 by 58)