|
static | pFragmentToParsoidFragmentMarkers (PFragment $fragment) |
| Returns a wikitext string with embedded parsoid fragment markers, as well as a mapping from the marker IDs to PFragment objects.
|
|
static | getDOMFragmentToken ( $content, SourceRange $srcOffsets, array $opts=[]) |
| Creates a dom-fragment-token for processing 'content' (an array of tokens) in its own subpipeline all the way to DOM.
|
|
static | processContentInPipeline (Env $env, Frame $frame, $content, array $opts) |
| Processes content (wikitext, array of tokens, whatever) in its own pipeline based on options.
|
|
static | dumpTplSrc (Env $env, Token $token, string $templateName, string $src, bool $fragmentMode=false) |
| Dump template source if '–dump tplsrc' flag was set.
|
|
static | preparePFragment (Env $env, Frame $frame, PFragment $pFragment, array $opts) |
| Prepare a PFragment for our parsing pipeline: split the fragment, convert it to embedded fragment markers, and add those markers to the pfragment map in the env.
|
|
static | processTemplateSource (Env $env, Frame $frame, Token $token, ?array $tplArgs, string $src, array $opts=[]) |
|
static | expandAttrValueToDOM (Env $env, Frame $frame, array $v, bool $expandTemplates, bool $inTemplate) |
| Expands value all the way to DOM.
|
|
static | expandAttrValuesToDOM (Env $env, $frame, array $vals, bool $expandTemplates, bool $inTemplate) |
|
static | tunnelDOMThroughTokens (Env $env, Token $token, DocumentFragment $domFragment, array $opts) |
| Generates wrapper tokens for a HTML expansion – the wrapper tokens are placeholders that adequately represent semantics of the HTML DOM for the purposes of additional token transformations that will be applied to them.
|
|
static | addSpanWrappers (array $nodes, ?Node $startAt=null, ?Node $stopAt=null) |
| Wrap text and comment nodes in a node list into spans, so that all top-level nodes are elements.
|
|
static | parseToHTML (Env $env, string $source) |
| Fetches output of encapsulations that return HTML from the legacy parser.
|
|
This file contains parsing pipeline related utilities.
static Wikimedia\Parsoid\Utils\PipelineUtils::getDOMFragmentToken |
( |
| $content, |
|
|
SourceRange | $srcOffsets, |
|
|
array | $opts = [] ) |
|
static |
Creates a dom-fragment-token for processing 'content' (an array of tokens) in its own subpipeline all the way to DOM.
These tokens will be processed by their own handler (DOMFragmentBuilder) in the last stage of the async pipeline.
srcOffsets should always be provided to process top-level page content in a subpipeline. Without it, DSR computation and template wrapping cannot be done in the subpipeline. While unpackDOMFragment can do this on unwrapping, that can be a bit fragile and makes dom-fragments a leaky abstraction by leaking subpipeline processing into the top-level pipeline.
- Parameters
-
| string|Token|array<Token|string> | $content The array of tokens to process. |
SourceRange | $srcOffsets | Wikitext source offsets (start/end) of these tokens. |
array | $opts | Parsing options.
- Token token The token that generated the content.
- bool inlineContext Is this DOM fragment used in an inline context?
|
- Returns
- SelfclosingTagTk