|
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 | 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 | encapsulateExpansionHTML (Env $env, Token $token, array $expansion, 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 ( $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 | tunnelDOMThroughTokens (Env $env, Token $token, DocumentFragment $domFragment, array $opts) |
| Convert a HTML5 DOM into a mw:DOMFragment and generate appropriate tokens to insert into the token stream for further processing.
|
|
static | makeExpansion (Env $env, DocumentFragment $domFragment) |
|
static | extractExpansions (Env $env, Element $body) |
| Extract transclusion and extension expansions from a DOM, and return them in a structure like this: { transclusions: { 'key1': { html: 'html1', nodes: [<node1>, <node2>] } }, extensions: { 'key2': { html: 'html2', nodes: [<node1>, <node2>] } }, files: { 'key3': { html: 'html3', nodes: [<node1>, <node2>] } } }.
|
|
static | fetchHTML (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::extractExpansions |
( |
Env | $env, |
|
|
Element | $body ) |
|
static |
Extract transclusion and extension expansions from a DOM, and return them in a structure like this: { transclusions: { 'key1': { html: 'html1', nodes: [<node1>, <node2>] } }, extensions: { 'key2': { html: 'html2', nodes: [<node1>, <node2>] } }, files: { 'key3': { html: 'html3', nodes: [<node1>, <node2>] } } }.
- Parameters
-
- Returns
- array
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