A page bundle stores an HTML string with separated data-parsoid and (optionally) data-mw content.
More...
|
| __construct (string $html, ?array $parsoid=null, ?array $mw=null, ?string $version=null, ?array $headers=null, ?string $contentmodel=null) |
|
| validate (string $contentVersion, ?string &$errorMessage=null) |
| Check if this pagebundle is valid.
|
|
| responseData () |
|
| toSingleDocumentHtml (array $options=[]) |
| Convert this PageBundle to "single document" form, where page bundle information is embedded in the <head> of the document.
|
|
| toInlineAttributeHtml (array $options=[]) |
| Convert this PageBundle to "inline attribute" form, where page bundle information is represented as inline JSON-valued attributes.
|
|
| toJsonArray () |
|
A page bundle stores an HTML string with separated data-parsoid and (optionally) data-mw content.
The data-parsoid and data-mw content is indexed by the id attributes on individual nodes. This content needs to be loaded before the data-parsoid and/or data-mw information can be used.
Note that the parsoid/mw properties of the page bundle are in "serialized
array" form; that is, they are flat arrays appropriate for json-encoding and do not contain DataParsoid or DataMw objects.
See DomPageBundle for a similar structure used where the HTML string has been parsed into a DOM.
static Wikimedia\Parsoid\Core\PageBundle::fromDomPageBundle |
( |
DomPageBundle | $dpb, |
|
|
array | $options = [] ) |
|
static |
Convert a DomPageBundle to a PageBundle.
This serializes the DOM from the DomPageBundle, with the given $options. The options can also provide defaults for content version, headers, content model, and offsetType if they weren't already set in the DomPageBundle.
- Parameters
-
DomPageBundle | $dpb | |
array | $options | XMLSerializer options |
- Returns
- PageBundle