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

Static Public Member Functions

static flattenIfArray ( $a)
 If $a is an array, this recursively flattens all nested arrays.
 
static flattenString ( $c)
 FIXME: document.
 
static flattenStringlist (array $c)
 FIXME: document.
 
static getAttrVal ( $value, int $start, int $end)
 
static buildTableTokens (string $tagName, string $wtChar, $attrInfo, SourceRange $tsr, int $endPos, $content, bool $addEndTag=false)
 Build a token array representing <tag>$content</tag> alongwith appropriate attributes and TSR info set on the tokens.
 
static buildXMLTag (string $name, string $lcName, array $attribs, $endTag, bool $selfClose, SourceRange $tsr)
 Build a token representing <tag>, <tag >, or </tag> with appropriate attributes set on the token.
 
static inlineBreaks (string $input, int $pos, array $stops, Env $env)
 Inline breaks, flag-enabled rule which detects end positions for active higher-level rules in inline and other nested rules.
 
static popComments (array &$attrs)
 Pop off the end comments, if any.
 
static getAutoUrlTerminatingChars (bool $hasLeftParen)
 Get a string containing all the autourl terminating characters (as in legacy parser Parser.php::makeFreeExternalLink).
 
static enforceParserResourceLimits (Env $env, $token)
 
static protectAttrs (string $name)
 Protect Parsoid-inserted attributes by escaping them to prevent Parsoid-HTML spoofing in wikitext.
 
static resetAnnotationIncludeRegex ()
 Resets $inclAnnRegExp to null to avoid test environment side effects.
 

Member Function Documentation

◆ buildTableTokens()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::buildTableTokens ( string $tagName,
string $wtChar,
$attrInfo,
SourceRange $tsr,
int $endPos,
$content,
bool $addEndTag = false )
static

Build a token array representing <tag>$content</tag> alongwith appropriate attributes and TSR info set on the tokens.

Parameters
string$tagName
string$wtChar
mixed$attrInfo
SourceRange$tsr
int$endPos
mixed$content
bool$addEndTag
Returns
array (of tokens)

◆ buildXMLTag()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::buildXMLTag ( string $name,
string $lcName,
array $attribs,
$endTag,
bool $selfClose,
SourceRange $tsr )
static

Build a token representing <tag>, <tag >, or </tag> with appropriate attributes set on the token.

Parameters
string$name
string$lcName
array$attribs
mixed$endTag
bool$selfClose
SourceRange$tsr
Returns
Token

◆ enforceParserResourceLimits()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::enforceParserResourceLimits ( Env $env,
$token )
static
Parameters
Env$env
mixed$token

◆ flattenIfArray()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::flattenIfArray ( $a)
static

If $a is an array, this recursively flattens all nested arrays.

Parameters
mixed$a
Returns
mixed

◆ flattenString()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::flattenString ( $c)
static

FIXME: document.

Parameters
mixed$c
Returns
mixed

◆ flattenStringlist()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::flattenStringlist ( array $c)
static

FIXME: document.

Parameters
array$c
Returns
array

◆ getAttrVal()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::getAttrVal ( $value,
int $start,
int $end )
static
Parameters
mixed$value
int$startstart of TSR range
int$endend of TSR range
Returns
array

◆ getAutoUrlTerminatingChars()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::getAutoUrlTerminatingChars ( bool $hasLeftParen)
static

Get a string containing all the autourl terminating characters (as in legacy parser Parser.php::makeFreeExternalLink).

This list is slightly context-dependent because the inclusion of the right parenthesis depends on whether the provided character array $arr contains a left parenthesis.

Parameters
bool$hasLeftParenshould be true if the URL in question contains a left parenthesis.
Returns
string

◆ inlineBreaks()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::inlineBreaks ( string $input,
int $pos,
array $stops,
Env $env )
static

Inline breaks, flag-enabled rule which detects end positions for active higher-level rules in inline and other nested rules.

Those inner rules are then exited, so that the outer rule can handle the end marker.

Parameters
string$input
int$pos
array$stops
Env$env
Returns
bool
Exceptions

Exception

◆ popComments()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::popComments ( array & $attrs)
static

Pop off the end comments, if any.

Parameters
array&$attrs
Returns
array|null

◆ protectAttrs()

static Wikimedia\Parsoid\Wt2Html\TokenizerUtils::protectAttrs ( string $name)
static

Protect Parsoid-inserted attributes by escaping them to prevent Parsoid-HTML spoofing in wikitext.

Parameters
string$name
Returns
string

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