Wiki formatting: Headings: tolerate spaces after line; added disable_rule method (required for rev. 1029)
authorDan
Thu, 02 Jul 2009 09:00:52 -0400
changeset 1031 8a4b75e73137
parent 1030 23959360dcfd
child 1032 9e61f16a8e47
Wiki formatting: Headings: tolerate spaces after line; added disable_rule method (required for rev. 1029)
includes/wikiengine/parse_mediawiki.php
includes/wikiformat.php
--- a/includes/wikiengine/parse_mediawiki.php	Thu Jul 02 08:58:54 2009 -0400
+++ b/includes/wikiengine/parse_mediawiki.php	Thu Jul 02 09:00:52 2009 -0400
@@ -59,7 +59,7 @@
   
   public function heading(&$text)
   {
-    if ( !preg_match_all('/^(={1,6}) *(.+?) *\\1$/m', $text, $results) )
+    if ( !preg_match_all('/^(={1,6}) *(.+?) *\\1 *$/m', $text, $results) )
       return array();
     
     $headings = array();
--- a/includes/wikiformat.php	Thu Jul 02 08:58:54 2009 -0400
+++ b/includes/wikiformat.php	Thu Jul 02 09:00:52 2009 -0400
@@ -291,6 +291,25 @@
   }
   
   /**
+   * Disable a render stage
+   * @param string stage
+   * @return null
+   */
+  
+  public function disable_rule($rule)
+  {
+    foreach ( $this->rules as $i => $current_rule )
+    {
+      if ( $current_rule === $rule )
+      {
+        unset($this->rules[$i]);
+        return null;
+      }
+    }
+    return null;
+  }
+  
+  /**
    * Generate a token
    * @param int Token index
    * @return string