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

Represents "PFragment tokens" from the preprocessor. More...

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

Public Member Functions

 __construct (SourceRange $tsr, string|KV $contents,)
 
 getMarker ()
 Return the Parsoid fragment marker, which can be passed to (eg) TokenizerUtils::parsoidFragmentMarkerToTokens()
 
 __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 "PFragment tokens" from the preprocessor.

These are the Parsoid equivalent of core "strip markers", and represent opaque transcluded content.

Member Function Documentation

◆ __clone()

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

◆ jsonSerialize()

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

◆ newFromJsonArray()

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

◆ printInternal()

Wikimedia\Parsoid\Tokens\PreprocPFragmentTk::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: