Parsoid
A bidirectional parser between wikitext and HTML5
|
Token transformation manager. More...
Public Member Functions | ||||
__construct (Env $env, array $options, string $stageId, ?PipelineStage $prevStage=null) | ||||
setPipelineId (int $id) | ||||
getFrame () | ||||
getOptions () | ||||
addTransformer (TokenHandler $t) | ||||
Register a token transformer.
| ||||
shuttleTokensToEndOfStage (array $toks) | ||||
processChunk (array $tokens) | ||||
Push the tokens through all the registered transformers. | ||||
resetState (array $opts) | ||||
Resets any internal state for this pipeline stage.This is usually called so a cached pipeline can be reused.
| ||||
process ( $tokens, ?array $opts=null) | ||||
See PipelineStage::process docs as well. | ||||
processChunkily ( $input, array $opts=null) | ||||
Public Member Functions inherited from Wikimedia\Parsoid\Wt2Html\PipelineStage | ||||
__construct (Env $env, ?PipelineStage $prevStage=null) | ||||
getPipelineId () | ||||
getEnv () | ||||
setFrame (Frame $frame) | ||||
Set frame on this pipeline stage. | ||||
setSourceOffsets (SourceRange $so) | ||||
Set the source offsets for the content being processing by this pipeline This matters for when a substring of the top-level page is being processed in its own pipeline. | ||||
processChunkily ( $input, ?array $options) | ||||
Process wikitext, an array of tokens, or a DOM document depending on what pipeline stage this is. | ||||
Public Attributes | |
$tokenTimes = 0 | |
$profile | |
Additional Inherited Members | |
Protected Attributes inherited from Wikimedia\Parsoid\Wt2Html\PipelineStage | |
$prevStage | |
$pipelineId = -1 | |
$env = null | |
bool | $atTopLevel = false |
Defaults to false and resetState initializes it. | |
$frame | |
Token transformation manager.
Individual transformations implement the TokenHandler interface. The parser pipeline registers individual transformers.
See https://www.mediawiki.org/wiki/Parsoid/Token_stream_transformations for more documentation. This abstract class could eventually be eliminated and the various token transforms just extend PipelineStage directly.
Wikimedia\Parsoid\Wt2Html\TokenTransformManager::addTransformer | ( | TokenHandler | $t | ) |
Register a token transformer.
TokenHandler | $t |
Reimplemented from Wikimedia\Parsoid\Wt2Html\PipelineStage.
Wikimedia\Parsoid\Wt2Html\TokenTransformManager::process | ( | $tokens, | |
?array | $opts = null ) |
See PipelineStage::process docs as well.
This doc block refines the generic arg types to be specific to this pipeline stage.
Process a chunk of tokens.
array | $tokens | Array of tokens to process |
?array | $opts |
Reimplemented from Wikimedia\Parsoid\Wt2Html\PipelineStage.
Wikimedia\Parsoid\Wt2Html\TokenTransformManager::processChunk | ( | array | $tokens | ) |
Push the tokens through all the registered transformers.
Wikimedia\Parsoid\Wt2Html\TokenTransformManager::resetState | ( | array | $opts | ) |
Resets any internal state for this pipeline stage.This is usually called so a cached pipeline can be reused.
array | $options |
Reimplemented from Wikimedia\Parsoid\Wt2Html\PipelineStage.
Wikimedia\Parsoid\Wt2Html\TokenTransformManager::setPipelineId | ( | int | $id | ) |
Reimplemented from Wikimedia\Parsoid\Wt2Html\PipelineStage.