r5294 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r5293‎ | r5294 | r5295 >
Date:21:10, 18 September 2004
Author:jeluf
Status:old
Tags:
Comment:
BUG#16 BUG#60 BUG#70 BUG#80 BUG#283 BUG#161 BUG#131 BUG#302
Patch by Wil Mahan
Instead of parsing each template separately, built a big wikitext and parse this.
Modified paths:
  • /branches/REL1_3/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_3/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: branches/REL1_3/phase3/RELEASE-NOTES
@@ -6,6 +6,8 @@
77 == Version 1.3.4, 2004-??-?? ==
88
99 Changes from 1.3.3:
 10+* Fixed lots of template-related bugs, esp. for cases where template
 11+ variables are used for links, images, etc.
1012 * Fixed transformation of page messages when viewing Special:Allmessages
1113 * Handle "ISBN ISBN 1234" correctly
1214 * Fixed warning on Category pages
Index: branches/REL1_3/phase3/includes/Parser.php
@@ -789,15 +789,6 @@
790790 return $t ;
791791 }
792792
793 - # Parses the text and adds the result to the strip state
794 - # Returns the strip tag
795 - function stripParse( $text, $newline, $args )
796 - {
797 - $text = $this->strip( $text, $this->mStripState );
798 - $text = $this->internalParse( $text, (bool)$newline, $args, false );
799 - return $newline.$this->insertStripItem( $text, $this->mStripState );
800 - }
801 -
802793 function internalParse( $text, $linestart, $args = array(), $isMain=true ) {
803794 $fname = 'Parser::internalParse';
804795 wfProfileIn( $fname );
@@ -1597,10 +1588,10 @@
15981589
15991590 if ( $this->mOutputType == OT_HTML ) {
16001591 # Argument substitution
1601 - $text = preg_replace_callback( "/(\\n?){{{([$titleChars]*?)}}}/", 'wfArgSubstitution', $text );
 1592+ $text = preg_replace_callback( "/{{{([$titleChars]*?)}}}/", 'wfArgSubstitution', $text );
16021593 }
16031594 # Template substitution
1604 - $regex = '/(\\n?){{(['.$nonBraceChars.']*)(\\|.*?|)}}/s';
 1595+ $regex = '/{{(['.$nonBraceChars.']*)(\\|.*?|)}}/s';
16051596 $text = preg_replace_callback( $regex, 'wfBraceSubstitution', $text );
16061597
16071598 array_pop( $this->mArgStack );
@@ -1653,15 +1644,13 @@
16541645
16551646 $title = NULL;
16561647
1657 - # $newline is an optional newline character before the braces
16581648 # $part1 is the bit before the first |, and must contain only title characters
16591649 # $args is a list of arguments, starting from index 0, not including $part1
16601650
1661 - $newline = $matches[1];
1662 - $part1 = $matches[2];
1663 - # If the third subpattern matched anything, it will start with |
 1651+ $part1 = $matches[1];
 1652+ # If the second subpattern matched anything, it will start with |
16641653
1665 - $args = $this->getTemplateArgs($matches[3]);
 1654+ $args = $this->getTemplateArgs($matches[2]);
16661655 $argc = count( $args );
16671656
16681657 # {{{}}}
@@ -1832,7 +1821,8 @@
18331822 }
18341823
18351824 # Run full parser on the included text
1836 - $text = $this->stripParse( $text, $newline, $assocArgs );
 1825+ $text = $this->removeHTMLtags( $text );
 1826+ $text = $this->replaceVariables( $text, $assocArgs );
18371827
18381828 # Resume the link cache and register the inclusion as a link
18391829 if ( !is_null( $title ) ) {
@@ -1850,13 +1840,13 @@
18511841
18521842 # Triple brace replacement -- used for template arguments
18531843 function argSubstitution( $matches ) {
1854 - $newline = $matches[1];
1855 - $arg = trim( $matches[2] );
 1844+ $arg = trim( $matches[1] );
18561845 $text = $matches[0];
18571846 $inputArgs = end( $this->mArgStack );
18581847
18591848 if ( array_key_exists( $arg, $inputArgs ) ) {
1860 - $text = $this->stripParse( $inputArgs[$arg], $newline, array() );
 1849+ $text = $this->removeHTMLtags( $inputArgs[$arg] );
 1850+ $text = $this->replaceVariables( $text, array() );
18611851 }
18621852
18631853 return $text;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r5255BUG#60 Patch by Wil Mahan...jeluf06:15, 17 September 2004

Status & tagging log