Parsoid
A bidirectional parser between wikitext and HTML5
|
Simple noinclude / onlyinclude implementation. More...
Public Member Functions | ||||
__construct (TokenTransformManager $manager, array $options) | ||||
Public Member Functions inherited from Wikimedia\Parsoid\Wt2Html\TT\TokenCollector | ||||
onTag (Token $token) | ||||
This handler is called for tokens that are not EOFTk or NLTk tokens.The handler may choose to process only specific kinds of tokens. For example, a list handler may only process 'listitem' TagTk tokens.
| ||||
onEnd (EOFTk $token) | ||||
This handler is called for EOF tokens only.
| ||||
onAny ( $token) | ||||
This handler is called for all tokens in the token stream except if (a) The more specific handlers above modified the token (b) the more specific handlers (onTag, onEnd, onNewline) have set the skip flag in their return values.(c) this handlers 'active' flag is set to false (can be set by any of the handlers).
| ||||
Public Member Functions inherited from Wikimedia\Parsoid\Wt2Html\TT\TokenHandler | ||||
setPipelineId (int $id) | ||||
resetState (array $options) | ||||
Resets any internal state for this token handler. | ||||
isDisabled () | ||||
Is this transformer disabled? | ||||
onNewline (NlTk $token) | ||||
This handler is called for newline tokens only. | ||||
process ( $tokens) | ||||
Push an input array of tokens through the transformer and return the transformed tokens. | ||||
Protected Member Functions | |
type () | |
Token type to register for ('tag', 'text' etc) | |
name () | |
(optional, only for token type 'tag'): tag name. | |
toEnd () | |
Match the 'end' tokens as closing tag as well (accept unclosed sections). | |
ackEnd () | |
Whether to transform unmatched end tags. | |
transformation (array $collection) | |
When an end delimiter is found, this function is called with the collected token array including the start and end delimiters. | |
Additional Inherited Members | |
Static Public Member Functions inherited from Wikimedia\Parsoid\Wt2Html\TT\TokenCollector | |
static | buildMetaToken (TokenTransformManager $manager, string $tokenName, bool $isEnd, SourceRange $tsr, ?string $src) |
This helper function will build a meta token in the right way for these tags. | |
Static Protected Member Functions inherited from Wikimedia\Parsoid\Wt2Html\TT\TokenCollector | |
static | buildStrippedMetaToken (TokenTransformManager $manager, string $tokenName, Token $startDelim, ?Token $endDelim) |
Protected Attributes inherited from Wikimedia\Parsoid\Wt2Html\TT\TokenCollector | |
array | $scopeStack = [] |
Protected Attributes inherited from Wikimedia\Parsoid\Wt2Html\TT\TokenHandler | |
$env | |
$manager | |
$pipelineId | |
$options | |
bool | $disabled = false |
This is set if the token handler is disabled for the entire pipeline. | |
bool | $onAnyEnabled = true |
This is set/reset by the token handlers at various points in the token stream based on what is encountered. | |
$atTopLevel = false | |
Simple noinclude / onlyinclude implementation.
Strips all tokens in noinclude sections.
Wikimedia\Parsoid\Wt2Html\TT\IncludeOnly::__construct | ( | TokenTransformManager | $manager, |
array | $options ) |
TokenTransformManager | $manager | manager enviroment |
array | $options | various configuration options |
Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenCollector.
|
protected |
Whether to transform unmatched end tags.
If this returns true, unbalanced end tags will be passed to transform(). If it returns false, they will be left in the token stream unmodified.
Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenCollector.
|
protected |
(optional, only for token type 'tag'): tag name.
Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenCollector.
|
protected |
Match the 'end' tokens as closing tag as well (accept unclosed sections).
Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenCollector.
|
protected |
When an end delimiter is found, this function is called with the collected token array including the start and end delimiters.
The subclass should transform it and return the result.
array | $array |
Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenCollector.
|
protected |
Token type to register for ('tag', 'text' etc)
Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenCollector.