Skip to content

Commit

Permalink
Ensure frame args are properly set up in the pipeline
Browse files Browse the repository at this point in the history
Currently unused but could be useful in the future to support T301080.

Change-Id: I6431ee24b9b477c8a83ffd0dd5684ec43f73a519
  • Loading branch information
subbuss authored and jenkins-bot committed Feb 10, 2022
1 parent 8942cb5 commit 55da309
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Utils/PipelineUtils.php
Expand Up @@ -76,8 +76,8 @@ public static function getDOMFragmentToken(
* - string pipelineType
* - array pipelineOpts
* - array tplArgs - if set, defines parameters for the child frame
* - string tplArgs.name
* - array tplArgs.attribs
* - string tplArgs['name']
* - KV[] tplArgs['attribs']
* - string srcText - if set, defines the source text for the expansion
* - SourceRange srcOffsets - if set, defines the range within the
* source text that $content corresponds to
Expand Down
5 changes: 3 additions & 2 deletions src/Wt2Html/Frame.php
Expand Up @@ -5,6 +5,7 @@

use Wikimedia\Parsoid\Config\Env;
use Wikimedia\Parsoid\Tokens\EOFTk;
use Wikimedia\Parsoid\Tokens\KV;
use Wikimedia\Parsoid\Tokens\Token;
use Wikimedia\Parsoid\Utils\PHPUtils;
use Wikimedia\Parsoid\Utils\PipelineUtils;
Expand Down Expand Up @@ -40,7 +41,7 @@ class Frame {
/**
* @param Title $title
* @param Env $env
* @param array $args
* @param KV[] $args
* @param string $srcText
* @param ?Frame $parentFrame
*/
Expand Down Expand Up @@ -93,7 +94,7 @@ public function getSrcText(): string {
/**
* Create a new child frame.
* @param Title $title
* @param array $args
* @param KV[] $args
* @param string $srcText
* @return Frame
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Wt2Html/ParserPipeline.php
Expand Up @@ -219,10 +219,10 @@ public function init( array $initialState = [] ) {
$srcText = $initialState['srcText'] ?? null;
if ( isset( $tplArgs['title'] ) ) {
$title = $tplArgs['title'];
$args = $tplArgs['attribs'];
$args = $tplArgs['attribs']; // KV[]
} else {
$title = $frame->getTitle();
$args = $frame->getArgs()->args;
$args = $frame->getArgs()->args; // KV[]
}
$frame = $frame->newChild( $title, $args, $srcText );
}
Expand Down
2 changes: 1 addition & 1 deletion src/Wt2Html/TT/TemplateHandler.php
Expand Up @@ -1134,7 +1134,7 @@ private function onTemplate( Token $token ): TokenHandlerResult {
/* If $tgt is not null, target will be present. */
$templateName = $tgt['target'];
$templateTitle = $tgt['title'];
$attribs = [];
$attribs = array_slice( $token->attribs, 1 ); // Strip template name

// We still need to check for limit violations because of the
// higher precedence of extension tags, which can result in nested
Expand Down

0 comments on commit 55da309

Please sign in to comment.