r29837 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29836‎ | r29837 | r29838 >
Date:07:46, 16 January 2008
Author:tstarling
Status:old
Tags:
Comment:
#tag changes as per #wikimedia-tech committee
Modified paths:
  • /trunk/phase3/includes/CoreParserFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/CoreParserFunctions.php
@@ -221,6 +221,13 @@
222222 return '';
223223 }
224224 $tagName = strtolower( trim( $frame->expand( array_shift( $args ) ) ) );
 225+
 226+ if ( count( $args ) ) {
 227+ $inner = $frame->expand( array_shift( $args ) );
 228+ } else {
 229+ $inner = null;
 230+ }
 231+
225232 $stripList = $parser->getStripList();
226233 if ( !in_array( $tagName, $stripList ) ) {
227234 return '<span class="error">' .
@@ -228,33 +235,23 @@
229236 '</span>';
230237 }
231238
232 - $lastNumberedNode = false;
233239 $attributes = array();
234240 foreach ( $args as $arg ) {
235241 if ( !$xpath ) {
236242 $xpath = new DOMXPath( $arg->ownerDocument );
237243 }
238244 $names = $xpath->query( 'name', $arg );
239 - if ( $names->item( 0 )->hasAttributes() ) {
240 - $lastNumberedNode = $arg;
241 - } else {
 245+ if ( !$names->item( 0 )->hasAttributes() ) {
242246 $name = $frame->expand( $names->item( 0 ), PPFrame::STRIP_COMMENTS );
243 - if ( preg_match( '/^\d+$/', $name ) ) {
244 - // For = suppression syntax {{#tag|thing|1=2=3=4}}
245 - $lastNumberedNode = $arg;
246 - } else {
247 - $values = $xpath->query( 'value', $arg );
248 - $attributes[$name] = trim( $frame->expand( $values->item( 0 ) ) );
 247+ $values = $xpath->query( 'value', $arg );
 248+ $value = trim( $frame->expand( $values->item( 0 ) ) );
 249+ if ( preg_match( '/^(?:"|\')(.*)(?:"|\')$/s', $value, $m ) ) {
 250+ $value = $m[1];
249251 }
250 - }
 252+ $attributes[$name] = $value;
 253+ }
251254 }
252255
253 - if ( !$lastNumberedNode ) {
254 - $inner = null;
255 - } else {
256 - $values = $xpath->query( 'value', $lastNumberedNode );
257 - $inner = $frame->expand( $values->item( 0 ) );
258 - }
259256 $params = array(
260257 'name' => $tagName,
261258 'inner' => $inner,

Status & tagging log