includes/wikiengine/parse_mediawiki.php
changeset 1078 67a4c839c7e1
parent 1073 b19a9bcb6a45
child 1081 745200a9cc2a
--- a/includes/wikiengine/parse_mediawiki.php	Sun Aug 09 01:26:57 2009 -0400
+++ b/includes/wikiengine/parse_mediawiki.php	Sun Aug 09 01:27:45 2009 -0400
@@ -22,6 +22,8 @@
     'externalnotext' => '#\[((?:https?|irc|ftp)://.+?)\]#'
   );
   
+  private $blockquote_rand_id;
+  
   public function lang(&$text)
   {
     global $lang;
@@ -152,15 +154,24 @@
   
   public function blockquote(&$text)
   {
-    if ( !preg_match_all('/^(?:(>+) *.+(?:\r?\n|$))+/m', $text, $quotes) )
-      return array();
-   
-    $pieces = array();
-    foreach ( $quotes[0] as $quote )
-      $pieces[] = "\t" . trim(preg_replace('/^>+ */m', "\t", $quote));
+    $rand_id = hexencode(AESCrypt::randkey(16), '', '');
     
-    $text = Carpenter::tokenize($text, $quotes[0]);
-    return $pieces;
+    while ( preg_match_all('/^(?:(>+) *.+(?:\r?\n|$))+/m', $text, $quotes) )
+    {
+      foreach ( $quotes[0] as $quote )
+      {
+        $piece = trim(preg_replace('/^> */m', '', $quote));
+        $text = str_replace_once($quote, "{blockquote:$rand_id}\n$piece\n{/blockquote:$rand_id}\n", $text);
+      }
+    }
+    //die('<pre>' . htmlspecialchars($text) . '</pre>');
+    
+    $this->blockquote_rand_id = $rand_id;
+  }
+  
+  public function blockquotepost(&$text)
+  {
+    return $this->blockquote_rand_id;
   }
   
   public function paragraph(&$text)