|
Parsoid
A bidirectional parser between wikitext and HTML5
|
Catch-all class for all token types. More...
Inheritance diagram for Wikimedia\Parsoid\Tokens\Token:
Collaboration diagram for Wikimedia\Parsoid\Tokens\Token:Public Member Functions | |
| __clone () | |
| jsonSerialize () | |
| 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. | |
| 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 | jsonClassHintFor (string $keyName) |
| static | newFromJsonArray (array $json) |
| static | hint () |
| static | getToken ( $input) |
| Get a token from some PHP structure. | |
Public Attributes | |
| DataParsoid | $dataParsoid |
| DataMw | $dataMw = null |
| array | $attribs = null |
Protected Member Functions | |
| __construct (?DataParsoid $dataParsoid, ?DataMw $dataMw) | |
Catch-all class for all token types.
| Wikimedia\Parsoid\Tokens\Token::addAttribute | ( | string | $name, |
| $value, | |||
| ?KVSourceRange | $srcOffsets = null ) |
Generic set attribute method.
| string | $name | Always a string when used this way. The more complex form (where the key is a non-string) are found when KV objects are constructed in the tokenizer. |
| string|Token|array<Token|string> | $value | |
| ?KVSourceRange | $srcOffsets |
| Wikimedia\Parsoid\Tokens\Token::addNormalizedAttribute | ( | string | $name, |
| $value, | |||
| $origValue ) |
Generic set attribute method with support for change detection.
Set a value and preserve the original wikitext that produced it.
| string | $name | |
| string|Token|array<Token|string> | $value | |
| mixed | $origValue |
| Wikimedia\Parsoid\Tokens\Token::addSpaceSeparatedAttribute | ( | string | $name, |
| string | $value ) |
Add a space-separated property value.
These are Parsoid-added attributes, not something present in source. So, only a regular ASCII space characters will be used here.
| string | $name | The attribute name |
| string | $value | The value to add to the attribute |
| Wikimedia\Parsoid\Tokens\Token::getAttributeKV | ( | string | $name | ) |
Generic attribute accessor.
| string | $name |
| Wikimedia\Parsoid\Tokens\Token::getAttributeShadowInfo | ( | string | $name | ) |
Attribute info accessor for the wikitext serializer.
Performs change detection and uses unnormalized attribute values if set. Expects the context to be set to a token.
| string | $name |
| Wikimedia\Parsoid\Tokens\Token::getAttributeV | ( | string | $name | ) |
Generic attribute accessor.
| string | $name |
|
static |
Get a token from some PHP structure.
Used by the PHPUnit tests.
| KV | Token | array | string | int | float | bool | null | $input |
| Wikimedia\Parsoid\Tokens\Token::getType | ( | ) |
Returns a string key for this token.
| Wikimedia\Parsoid\Tokens\Token::getWTSource | ( | Source ... | $source | ) |
Get the wikitext source of a token.
| Source | ...$source Optional Source, for context. |
| Wikimedia\Parsoid\Tokens\Token::hasAttribute | ( | string | $name | ) |
Generic attribute accessor.
| string | $name |
|
abstract |
Reimplemented in Wikimedia\Parsoid\Tokens\CommentTk, Wikimedia\Parsoid\Tokens\CompoundTk, Wikimedia\Parsoid\Tokens\EOFTk, Wikimedia\Parsoid\Tokens\NlTk, Wikimedia\Parsoid\Tokens\PreprocAngleTk, Wikimedia\Parsoid\Tokens\PreprocHeadingTk, Wikimedia\Parsoid\Tokens\PreprocIgnoreTk, Wikimedia\Parsoid\Tokens\PreprocPFragmentTk, Wikimedia\Parsoid\Tokens\PreprocTk, and Wikimedia\Parsoid\Tokens\XMLTagTk.
|
static |
Reimplemented in Wikimedia\Parsoid\Tokens\CommentTk, Wikimedia\Parsoid\Tokens\EmptyLineTk, Wikimedia\Parsoid\Tokens\EndTagTk, Wikimedia\Parsoid\Tokens\EOFTk, Wikimedia\Parsoid\Tokens\IndentPreTk, Wikimedia\Parsoid\Tokens\ListTk, Wikimedia\Parsoid\Tokens\NlTk, Wikimedia\Parsoid\Tokens\PreprocAngleTk, Wikimedia\Parsoid\Tokens\PreprocHeadingTk, Wikimedia\Parsoid\Tokens\PreprocIgnoreTk, Wikimedia\Parsoid\Tokens\PreprocPFragmentTk, Wikimedia\Parsoid\Tokens\PreprocTk, Wikimedia\Parsoid\Tokens\SelfclosingTagTk, and Wikimedia\Parsoid\Tokens\TagTk.
| Wikimedia\Parsoid\Tokens\Token::removeAttribute | ( | string | $name | ) |
Completely remove all attributes with this name.
| string | $name |
| Wikimedia\Parsoid\Tokens\Token::setAttribute | ( | string | $name, |
| $value ) |
Set an unshadowed attribute.
| string | $name | |
| string|Token|array<Token|string> | $value |
| Wikimedia\Parsoid\Tokens\Token::setShadowInfo | ( | string | $name, |
| $value, | |||
| $origValue ) |
Store the original value of an attribute in a token's dataParsoid.
| string | $name | |
| mixed | $value | |
| mixed | $origValue |