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

Represents an "extension tag" preprocessor piece. More...

+ Inheritance diagram for Wikimedia\Parsoid\Tokens\PreprocAngleTk:
+ Collaboration diagram for Wikimedia\Parsoid\Tokens\PreprocAngleTk:

Public Member Functions

 __construct (SourceRange $tsr, public string $open, public string $extAttrs, KV $contents, public ?string $close,)
 
 name ()
 Return the normalized name of this extension tag.
 
 getOpenKV (string $key=self::CONTENTS_ATTR)
 Return a KV for the open string.
 
 getExtAttrsKV (string $key=self::CONTENTS_ATTR)
 Return a KV for the attributes.
 
 getCloseKV (string $key=self::CONTENTS_ATTR)
 Return a KV for the close string.
 
 __clone ()
 
 jsonSerialize ()
 
- Public Member Functions inherited from Wikimedia\Parsoid\Tokens\PreprocTk
 getContents ()
 
 getContentsKV ()
 
 setContents (array $contents, SourceRange $tsr)
 
 setContentsKV (KV $contents)
 
 __toString ()
 Return the string form of this PreprocTk; this should be identical to the original "preprocessed" wikitext.
 
 getBarredArgs ()
 Split this token by | and return target and named args.
 
 print ( $pretty=true)
 Pretty-print a PreprocTk token.
 
- Public Member Functions inherited from Wikimedia\Parsoid\Tokens\Token
 toJsonArray ()
 
 getType ()
 Returns a string key for this token.
 
 addAttribute (string $name, $value, ?KVSourceRange $srcOffsets=null)
 Generic set attribute method.
 
 addNormalizedAttribute (string $name, $value, $origValue)
 Generic set attribute method with support for change detection.
 
 getAttributeV (string $name)
 Generic attribute accessor.
 
 getAttributeKV (string $name)
 Generic attribute accessor.
 
 hasAttribute (string $name)
 Generic attribute accessor.
 
 setAttribute (string $name, $value)
 Set an unshadowed attribute.
 
 setShadowInfo (string $name, $value, $origValue)
 Store the original value of an attribute in a token's dataParsoid.
 
 setShadowInfoIfModified (string $name, $value, $origValue)
 Store the original value of an attribute in a token's dataParsoid.
 
 getAttributeShadowInfo (string $name)
 Attribute info accessor for the wikitext serializer.
 
 removeAttribute (string $name)
 Completely remove all attributes with this name.
 
 addSpaceSeparatedAttribute (string $name, string $value)
 Add a space-separated property value.
 
 getWTSource (Source ... $source)
 Get the wikitext source of a token.
 
 fetchExpandedAttrValue (string $key)
 

Static Public Member Functions

static newFromJsonArray (array $json)
 
- Static Public Member Functions inherited from Wikimedia\Parsoid\Tokens\PreprocTk
static newContentsKV (array $contents, ?SourceRange $tsr)
 Helper: return a new contents KV.
 
static trimContentsKV (KV $contents)
 Trim whitespace from both sides of a contents KV.
 
static splitContentsBy (string|array|callable $sep, KV $contents, int $limit=-1)
 Split a contents KV by a string or a function.
 
static printContents ( $contents, bool $pretty=true)
 Pretty-print a contents KV on multiple lines.
 
- Static Public Member Functions inherited from Wikimedia\Parsoid\Tokens\Token
static jsonClassHintFor (string $keyName)
 
static hint ()
 
static getToken ( $input)
 Get a token from some PHP structure.
 

Protected Member Functions

 printInternal (array &$result, string $prefix, bool $pretty)
 Pretty-print this PreprocTk token.
Parameters
list<string>&$result An array of output lines.
string$prefixIndentation prefix

 
- Protected Member Functions inherited from Wikimedia\Parsoid\Tokens\PreprocTk
 recomputeTsr ()
 
- Protected Member Functions inherited from Wikimedia\Parsoid\Tokens\Token
 __construct (?DataParsoid $dataParsoid, ?DataMw $dataMw)
 

Additional Inherited Members

- Public Attributes inherited from Wikimedia\Parsoid\Tokens\PreprocTk
const CONTENTS_ATTR = 'mw:contents'
 
- Public Attributes inherited from Wikimedia\Parsoid\Tokens\Token
DataParsoid $dataParsoid
 
DataMw $dataMw = null
 
array $attribs = null
 
- Static Protected Member Functions inherited from Wikimedia\Parsoid\Tokens\PreprocTk
static printContentsInternal (array &$result, array $pieces, string $prefix, bool $pretty)
 

Detailed Description

Represents an "extension tag" preprocessor piece.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Tokens\PreprocAngleTk::__construct ( SourceRange $tsr,
public string $open,
public string $extAttrs,
KV $contents,
public ?string $close )
Parameters
$openThe name of the extension tag, not including the leading <.
$extAttrsThe attribute string, including leading whitespace but not including the trailing >.
$contentsThe contents of the extension tag.
$closeThe close tag, including leading < and trailing >, or null for a self-closed tag.

Member Function Documentation

◆ __clone()

Wikimedia\Parsoid\Tokens\PreprocAngleTk::__clone ( )

◆ jsonSerialize()

Wikimedia\Parsoid\Tokens\PreprocAngleTk::jsonSerialize ( )

◆ newFromJsonArray()

static Wikimedia\Parsoid\Tokens\PreprocAngleTk::newFromJsonArray ( array $json)
static

◆ printInternal()

Wikimedia\Parsoid\Tokens\PreprocAngleTk::printInternal ( array & $result,
string $prefix,
bool $pretty )
protected

Pretty-print this PreprocTk token.

Parameters
list<string>&$result An array of output lines.
string$prefixIndentation prefix

Reimplemented from Wikimedia\Parsoid\Tokens\PreprocTk.


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