# 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 );