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

A page bundle stores metadata and separated data-parsoid and data-mw content. More...

+ Inheritance diagram for Wikimedia\Parsoid\Core\BasePageBundle:
+ Collaboration diagram for Wikimedia\Parsoid\Core\BasePageBundle:

Public Member Functions

 validate (string $contentVersion, ?string &$errorMessage=null)
 Check if this pagebundle is valid.
 
 withHtml (string $html, array $fragments=[])
 Build an HtmlPageBundle by adding HTML string contents to this base page bundle.
 
 withDocument (Document $doc, array $fragments=[])
 Build an DomPageBundle by adding DOM contents to this base page bundle.
 
 toBasePageBundle ()
 Build a BasePageBundle with just the metadata from another page bundle.
 
 toJsonArray ()
 

Static Public Member Functions

static newFromJsonArray (array $json)
 

Detailed Description

A page bundle stores metadata and separated data-parsoid and 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 and HtmlPageBundle for similar structures which include the actual HTML/DOM content.

Member Function Documentation

◆ newFromJsonArray()

static Wikimedia\Parsoid\Core\BasePageBundle::newFromJsonArray ( array $json)
static

◆ toJsonArray()

Wikimedia\Parsoid\Core\BasePageBundle::toJsonArray ( )

◆ validate()

Wikimedia\Parsoid\Core\BasePageBundle::validate ( string $contentVersion,
?string & $errorMessage = null )

Check if this pagebundle is valid.

Parameters
string$contentVersionDocument content version to validate against.
?string&$errorMessageError message will be returned here.
Returns
bool

◆ withDocument()

Wikimedia\Parsoid\Core\BasePageBundle::withDocument ( Document $doc,
array $fragments = [] )

Build an DomPageBundle by adding DOM contents to this base page bundle.

Parameters
Document$docThe owner Document
array<string,DocumentFragment>$fragments Additional named DocumentFragments
Returns
DomPageBundle

◆ withHtml()

Wikimedia\Parsoid\Core\BasePageBundle::withHtml ( string $html,
array $fragments = [] )

Build an HtmlPageBundle by adding HTML string contents to this base page bundle.

Parameters
string$htmlThe main document HTML
array<string,string>$fragments Additional named HTML fragments
Returns
HtmlPageBundle

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