wt2html/parser~ParserPipeline()

Show:

new ParserPipeline()

Wrap some stages into a pipeline.

Wrap some stages into a pipeline. The last member of the pipeline is supposed to emit events, while the first is supposed to support a process() method that sets the pipeline in motion.

Source:

Methods

addListenersOn()

Register the first pipeline stage with the last stage from a separate pipeline.

Register the first pipeline stage with the last stage from a separate pipeline.

Source:

process(input, sol)

Feed input tokens to the first pipeline stage.

Feed input tokens to the first pipeline stage.

Parameters:
Name Type Description
input Array | string

tokens

sol boolean

Whether tokens should be processed in start-of-line context.

Source:

processToplevelDoc()

Feed input tokens to the first pipeline stage.

Feed input tokens to the first pipeline stage.

Source:

resetState()

This is primarily required to reset native extensions which might have be shared globally per parsing environment (unlike pipeline stages and transformers that exist one per pipeline).

This is primarily required to reset native extensions which might have be shared globally per parsing environment (unlike pipeline stages and transformers that exist one per pipeline). So, cannot rely on 'end' event to reset pipeline because there will be one 'end' event per pipeline.

Ex: cite needs to maintain a global sequence across all template transclusion pipelines, extension, and top-level pipelines.

This lets us reuse pipelines to parse unrelated top-level pages Ex: parser tests. Currently only parser tests exercise this functionality.

Source:

setFrame()

Set the frame on the last pipeline stage (normally the AsyncTokenTransformManager).

Set the frame on the last pipeline stage (normally the AsyncTokenTransformManager).

Source:

setPipelineId()

This is useful for debugging.

This is useful for debugging.

Source:

setSourceOffsets()

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

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

Source: