Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Wt2Html\Frame Class Reference

A frame represents a template expansion scope including parameters passed to the template (args). More...

+ Inheritance diagram for Wikimedia\Parsoid\Wt2Html\Frame:

Public Member Functions

 __construct (Title $title, Env $env, array $args, string $srcText, ?Frame $parentFrame=null)
 
 getEnv ()
 
 getTitle ()
 
 getArgs ()
 
 getSrcText ()
 
 newChild (Title $title, array $args, string $srcText)
 Create a new child frame.
 
 expand (array $chunk, array $options)
 Expand / convert a thunk (a chunk of tokens not yet fully expanded).
 
 loopAndDepthCheck (Title $title, int $maxDepth, bool $ignoreLoop)
 Check if expanding a template would lead to a loop, or would exceed the maximum expansion depth.
 
 expandTemplateArg (Token $tplArgToken)
 

Detailed Description

A frame represents a template expansion scope including parameters passed to the template (args).

It provides a generic 'expand' method which expands / converts individual parameter values in its scope. It also provides methods to check if another expansion would lead to loops or exceed the maximum expansion depth.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Wt2Html\Frame::__construct ( Title $title,
Env $env,
array $args,
string $srcText,
?Frame $parentFrame = null )
Parameters
Title$title
Env$env
KV[]$args
string$srcText
?Frame$parentFrame

Member Function Documentation

◆ expand()

Wikimedia\Parsoid\Wt2Html\Frame::expand ( array $chunk,
array $options )

Expand / convert a thunk (a chunk of tokens not yet fully expanded).

Parameters
Token[]$chunk
array$options
Returns
Token[]

◆ expandTemplateArg()

Wikimedia\Parsoid\Wt2Html\Frame::expandTemplateArg ( Token $tplArgToken)
Parameters
Token$tplArgToken
Returns
array tokens representing the arg value

◆ loopAndDepthCheck()

Wikimedia\Parsoid\Wt2Html\Frame::loopAndDepthCheck ( Title $title,
int $maxDepth,
bool $ignoreLoop )

Check if expanding a template would lead to a loop, or would exceed the maximum expansion depth.

Parameters
Title$title
int$maxDepth
bool$ignoreLoop
Returns
?string null => no error; non-null => error message

◆ newChild()

Wikimedia\Parsoid\Wt2Html\Frame::newChild ( Title $title,
array $args,
string $srcText )

Create a new child frame.

Parameters
Title$title
KV[]$args
string$srcText
Returns
Frame

The documentation for this class was generated from the following file: