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

Wrap some stages into a pipeline. More...

Public Member Functions

 __construct (bool $alwaysToplevel, string $type, string $outType, string $cacheKey, array $stages, Env $env)
 
 getCacheKey ()
 
 setPipelineId (int $id)
 This is useful for debugging.
 
 resetState (array $opts=[])
 Reset any local state in the pipeline stage.
 
 setSourceOffsets (SourceRange $so)
 Set source offsets for the source that this pipeline will process.
 
 setFrame (Frame $frame)
 Set frame on this pipeline stage (stages decide if they need it or not)
 
 parse ( $input, array $opts)
 Process input through the pipeline (potentially skipping the first stage in case that first stage is the source of input chunks we are processing in the rest of the pipeline)
 
 parseChunkily (string $input, array $opts)
 Parse input in chunks.
 
 selectiveParse (SelectiveUpdateData $selparData, array $options)
 Selective update parts of the old DOM based on $options $options has additional info about what needs updating.
 
 init (array $initialState=[])
 

Detailed Description

Wrap some stages into a pipeline.

Member Function Documentation

◆ init()

Wikimedia\Parsoid\Wt2Html\ParserPipeline::init ( array $initialState = [])
Parameters
array$initialStateOnce the pipeline is retrieved / constructed, it will be initialized with this state.

◆ parse()

Wikimedia\Parsoid\Wt2Html\ParserPipeline::parse ( $input,
array $opts )

Process input through the pipeline (potentially skipping the first stage in case that first stage is the source of input chunks we are processing in the rest of the pipeline)

Parameters
string|Token|array<Token|string>|DocumentFragment$input
array{sol:bool}$opts
  • sol (bool) Whether tokens should be processed in start-of-line context.
  • chunky (bool) Whether we are processing the input chunkily. If so, the first stage will be skipped
Returns
array|Document

◆ parseChunkily()

Wikimedia\Parsoid\Wt2Html\ParserPipeline::parseChunkily ( string $input,
array $opts )

Parse input in chunks.

Parameters
string$inputInput wikitext
array{sol:bool}$opts
  • atTopLevel: (bool) Whether we are processing the top-level document
  • sol: (bool) Whether input should be processed in start-of-line context
Returns
Document|array final DOM or array of token chnks

◆ resetState()

Wikimedia\Parsoid\Wt2Html\ParserPipeline::resetState ( array $opts = [])

Reset any local state in the pipeline stage.

Parameters
array$opts

◆ selectiveParse()

Wikimedia\Parsoid\Wt2Html\ParserPipeline::selectiveParse ( SelectiveUpdateData $selparData,
array $options )

Selective update parts of the old DOM based on $options $options has additional info about what needs updating.

FIXME: Doucment $options array here.

◆ setFrame()

Wikimedia\Parsoid\Wt2Html\ParserPipeline::setFrame ( Frame $frame)

Set frame on this pipeline stage (stages decide if they need it or not)

Parameters
Frame$frameframe

◆ setPipelineId()

Wikimedia\Parsoid\Wt2Html\ParserPipeline::setPipelineId ( int $id)

This is useful for debugging.

Parameters
int$id

◆ setSourceOffsets()

Wikimedia\Parsoid\Wt2Html\ParserPipeline::setSourceOffsets ( SourceRange $so)

Set source offsets for the source that this pipeline will process.

This lets us use different pipelines to parse fragments of the same page Ex: extension content (found on the same page) is parsed with a different pipeline than the top-level page.

Because of this, the source offsets are not [0, page.length) always and needs to be explicitly initialized

Parameters
SourceRange$so

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