r84015 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84014‎ | r84015 | r84016 >
Date:13:14, 15 March 2011
Author:purodha
Status:ok
Tags:
Comment:
Allow name=value parameters in {{#babel: ... }} which are collected and passed as parameters to wiki templates.
Modified paths:
  • /trunk/extensions/Babel/Babel.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Babel/Babel.class.php
@@ -26,12 +26,20 @@
2727 self::mTemplateLinkBatch( $parameters );
2828
2929 $content = '';
 30+ $templateParameters = array(); // collects name=value parameters to be passed to wiki templates.
3031 foreach ( $parameters as $name ) {
 32+ if (strpos($name, '=') !== false) {
 33+ $templateParameters[] = $name;
 34+ continue;
 35+ }
3136 $components = self::mParseParameter( $name );
3237 $template = wfMsgForContent( 'babel-template', $name );
3338 if ( $name === '' ) {
3439 continue;
3540 } elseif ( self::mPageExists( $template ) ) {
 41+ if ( count($templateParameters) ) {
 42+ $template .= '|'.implode('|', $templateParameters);
 43+ }
3644 $content .= $parser->replaceVariables( "{{{$template}}}" );
3745 } elseif ( $components !== false ) {
3846 $content .= self::mGenerateBox( $components['code'], $components['level'] );
@@ -112,7 +120,7 @@
113121 }
114122
115123 /**
116 - * Identify whether or not a page exists or not.
 124+ * Identify whether or not a page exists.
117125 *
118126 * @param $name String: Name of the page to check.
119127 * @return Boolean: Indication of whether the page exists.

Follow-up revisions

RevisionCommit summaryAuthorDate
r84248Minor enhancements and fixes following up r84229, r84078, 84027, 84015.purodha14:17, 18 March 2011

Status & tagging log