/**
* Preprocessor using PHP arrays
*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
* @file
* @ingroup Parser
*/
}
/**
- * @param $args
+ * @param $args array
* @return PPCustomFrame_Hash
*/
function newCustomFrame( $args ) {
$ignoredElements = array( 'includeonly' );
$xmlishElements[] = 'includeonly';
}
- // `dws' stands for "discard white spaces". `<dws>' and all the whitespaces afer it are
- // discarded.
- $xmlishElements[] = 'dws';
$xmlishRegex = implode( '|', array_merge( $xmlishElements, $ignoredTags ) );
// Use "A" modifier (anchored) instead of "^", because ^ doesn't work with an offset
}
$tagStartPos = $i;
-
- // Handle tag dws.
- if ( $name == 'dws' ) {
- $i = $tagEndPos + 1;
- if ( preg_match( '/\s*/', $text, $matches, 0, $i ) ) {
- $i += strlen( $matches[0] );
- }
- $accum->addNodeWithText( 'ignore', substr( $text, $tagStartPos, $i - $tagStartPos ) );
- continue;
- }
-
if ( $text[$tagEndPos-1] == '/' ) {
// Short end tag
$attrEnd = $tagEndPos - 1;
} elseif ( $found == 'line-end' ) {
$piece = $stack->top;
// A heading must be open, otherwise \n wouldn't have been in the search list
- assert( $piece->open == "\n" );
+ assert( '$piece->open == "\n"' );
$part = $piece->getCurrentPart();
// Search back through the input to see if it has a proper close
// Do this using the reversed string since the other solutions (end anchor, etc.) are inefficient
* $args is optionally a multi-root PPNode or array containing the template arguments
*
* @param $args PPNode_Hash_Array|array
- * @param $title Title|false
+ * @param $title Title|bool
*
* @return PPTemplateFrame_Hash
*/
- function newChild( $args = false, $title = false ) {
+ function newChild( $args = false, $title = false, $indexOffset = 0 ) {
$namedArgs = array();
$numberedArgs = array();
if ( $title === false ) {
$bits = $arg->splitArg();
if ( $bits['index'] !== '' ) {
// Numbered parameter
- $numberedArgs[$bits['index']] = $bits['value'];
- unset( $namedArgs[$bits['index']] );
+ $index = $bits['index'] - $indexOffset;
+ $numberedArgs[$index] = $bits['value'];
+ unset( $namedArgs[$index] );
} else {
// Named parameter
$name = trim( $this->expand( $bits['name'], PPFrame::STRIP_COMMENTS ) );
}
if ( ++$this->parser->mPPNodeCount > $this->parser->mOptions->getMaxPPNodeCount() ) {
+ $this->parser->limitationWarn( 'node-count-exceeded',
+ $this->parser->mPPNodeCount,
+ $this->parser->mOptions->getMaxPPNodeCount()
+ );
return '<span class="error">Node-count limit exceeded</span>';
}
if ( $expansionDepth > $this->parser->mOptions->getMaxPPExpandDepth() ) {
+ $this->parser->limitationWarn( 'expansion-depth-exceeded',
+ $expansionDepth,
+ $this->parser->mOptions->getMaxPPExpandDepth()
+ );
return '<span class="error">Expansion depth limit exceeded</span>';
}
++$expansionDepth;
+ if ( $expansionDepth > $this->parser->mHighestExpansionDepth ) {
+ $this->parser->mHighestExpansionDepth = $expansionDepth;
+ }
$outStack = array( '', '' );
$iteratorStack = array( false, $root );
}
return $this->args[$index];
}
+
+ function getArguments() {
+ return $this->args;
+ }
}
/**