Fixed the fact that defaults in template arguments {{{x|y}}} don't work when substing...
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 30 Jan 2008 02:52:14 +0000 (02:52 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 30 Jan 2008 02:52:14 +0000 (02:52 +0000)
includes/Parser.php
includes/Preprocessor_DOM.php

index ae6a5ae..5f56c0d 100644 (file)
@@ -3169,7 +3169,13 @@ class Parser
                $argName = trim( $nameWithSpaces );
                $object = false;
                $text = $frame->getArgument( $argName );
-               if (  $text === false && ( $this->ot['html'] || $this->ot['pre'] ) && $parts->getLength() > 0 ) {
+               if (  $text === false && $parts->getLength() > 0 
+                 && ( 
+                   $this->ot['html'] 
+                   || $this->ot['pre'] 
+                   || ( $this->ot['wiki'] && $frame->isTemplate() )
+                 )
+               ) {
                        # No match in frame, use the supplied default
                        $object = $parts->item( 0 )->getChildren();
                }
@@ -3666,9 +3672,6 @@ class Parser
                # Because mOutputType is OT_WIKI, this will only process {{subst:xxx}} type tags
                $text = $this->replaceVariables( $text );
 
-               # Strip out <nowiki> etc. added via replaceVariables
-               #$text = $this->strip( $text, $this->mStripState, false, array( 'gallery' ) );
-
                # Signatures
                $sigText = $this->getUserSig( $user );
                $text = strtr( $text, array(
index 4e29669..0fa48c4 100644 (file)
@@ -1097,7 +1097,6 @@ class PPFrame_DOM implements PPFrame {
                return $out;
        }
 
-
        function __toString() {
                return 'frame{}';
        }
@@ -1127,6 +1126,13 @@ class PPFrame_DOM implements PPFrame {
        function loopCheck( $title ) {
                return !isset( $this->loopCheckHash[$title->getPrefixedDBkey()] );
        }
+
+       /**
+        * Return true if the frame is a template frame
+        */
+       function isTemplate() {
+               return false;
+       }
 }
 
 /**
@@ -1207,6 +1213,13 @@ class PPTemplateFrame_DOM extends PPFrame_DOM {
                }
                return $text;
        }
+
+       /**
+        * Return true if the frame is a template frame
+        */
+       function isTemplate() {
+               return true;
+       }
 }
 
 class PPNode_DOM implements PPNode {