Respect <noinclude> and <includeonly> during {{subst:}} expansion as well as ordinary...
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 16 Nov 2005 10:16:46 +0000 (10:16 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 16 Nov 2005 10:16:46 +0000 (10:16 +0000)
RELEASE-NOTES
includes/Parser.php

index 6bedbc6..ca13ac5 100644 (file)
@@ -228,6 +228,8 @@ fully support the editing toolbar, but was found to be too confusing.
   a warning in prefs and use default sig if not balanced)
 * (bug 2740) Accept image deletions on 'enter' submit from MSIE
 * (bug 3939) Don't try to load text for interwiki redirect target
+* Respect <noinclude> and <includeonly> during {{subst:}} expansion as well as
+  ordinary templates.
 
 
 === Caveats ===
index 14f42e6..648cc77 100644 (file)
@@ -2504,16 +2504,18 @@ class Parser
                        # Add a new element to the templace recursion path
                        $this->mTemplatePath[$part1] = 1;
 
+                       # If there are any <onlyinclude> tags, only include them
+                       if ( in_string( '<onlyinclude>', $text ) && in_string( '</onlyinclude>', $text ) ) {
+                               preg_match_all( '/<onlyinclude>(.*?)<\/onlyinclude>/s', $text, $m );
+                               $text = '';
+                               foreach ($m[1] as $piece)
+                                       $text .= $this->trimOnlyinclude( $piece );
+                       }
+                       # Remove <noinclude> sections and <includeonly> tags
+                       $text = preg_replace( '/<noinclude>.*?<\/noinclude>/s', '', $text );
+                       $text = strtr( $text, array( '<includeonly>' => '' , '</includeonly>' => '' ) );
+                       
                        if( $this->mOutputType == OT_HTML ) {
-                               if ( in_string( '<onlyinclude>', $text ) && in_string( '</onlyinclude>', $text ) ) {
-                                       preg_match_all( '/<onlyinclude>(.*?)<\/onlyinclude>/s', $text, $m );
-                                       $text = '';
-                                       foreach ($m[1] as $piece)
-                                               $text .= $this->trimOnlyinclude( $piece );
-                               }
-                               # Remove <noinclude> sections and <includeonly> tags
-                               $text = preg_replace( '/<noinclude>.*?<\/noinclude>/s', '', $text );
-                               $text = strtr( $text, array( '<includeonly>' => '' , '</includeonly>' => '' ) );
                                # Strip <nowiki>, <pre>, etc.
                                $text = $this->strip( $text, $this->mStripState );
                                $text = Sanitizer::removeHTMLtags( $text, array( &$this, 'replaceVariables' ), $assocArgs );