MediaWiki master
MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter Class Reference

Provides methods for conversion between HtmlPageBundle and ParserOutput. More...

Static Public Member Functions

static hasPageBundle (ParserOutput $parserOutput)
 
static htmlPageBundleFromParserOutput (ParserOutput $parserOutput, SiteConfig $siteConfig, bool $bodyOnly=false,)
 Returns a Parsoid HtmlPageBundle equivalent to the given ParserOutput.
 
static pageBundleFromParserOutput (ParserOutput $parserOutput)
 Returns a Parsoid HtmlPageBundle equivalent to the given ParserOutput.
 
static parserOutputFromPageBundle (HtmlPageBundle $pageBundle, ?ParserOutput $originalParserOutput=null, ParsoidLinkTarget|PageReference|null $title=null, ?SiteConfig $siteConfig=null,)
 Creates a ParserOutput object containing the relevant data from the given HtmlPageBundle object.
 

Detailed Description

Provides methods for conversion between HtmlPageBundle and ParserOutput.

ParserOutput typically contains only the article content HTML (ie, without <body> tags), while a HtmlPageBundle can contain an entire document including <html> wrapper, metadata in the <head>, and article content inside a <body> tag.

Since
1.40
Access: internal

Definition at line 40 of file PageBundleParserOutputConverter.php.

Member Function Documentation

◆ hasPageBundle()

static MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter::hasPageBundle ( ParserOutput $parserOutput)
static

Definition at line 205 of file PageBundleParserOutputConverter.php.

◆ htmlPageBundleFromParserOutput()

static MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter::htmlPageBundleFromParserOutput ( ParserOutput $parserOutput,
SiteConfig $siteConfig,
bool $bodyOnly = false )
static

Returns a Parsoid HtmlPageBundle equivalent to the given ParserOutput.

Parameters
ParserOutput$parserOutput
SiteConfig$siteConfigParsoidSiteConfig service
bool$bodyOnlyIf false, returns a full document with metadata in the <head>. If true, the html section of the PageBundle returns the inner HTML of the <body> element only.
Returns
HtmlPageBundle

Definition at line 135 of file PageBundleParserOutputConverter.php.

◆ pageBundleFromParserOutput()

static MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter::pageBundleFromParserOutput ( ParserOutput $parserOutput)
static

Returns a Parsoid HtmlPageBundle equivalent to the given ParserOutput.

Parameters
ParserOutput$parserOutput
Returns
HtmlPageBundle
Deprecated
Use ::htmlPageBundleFromParserOutput

Definition at line 116 of file PageBundleParserOutputConverter.php.

◆ parserOutputFromPageBundle()

static MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter::parserOutputFromPageBundle ( HtmlPageBundle $pageBundle,
?ParserOutput $originalParserOutput = null,
ParsoidLinkTarget|PageReference|null $title = null,
?SiteConfig $siteConfig = null )
static

Creates a ParserOutput object containing the relevant data from the given HtmlPageBundle object.

We need to inject data-parsoid and other properties into the parser output object for caching, so we can use it for VE edits and transformations.

Parameters
HtmlPageBundle$pageBundle
?ParserOutput$originalParserOutputAny non-parsoid metadata from $originalParserOutput will be copied into the new ParserOutput object.
ParsoidLinkTarget | PageReference | null$titleThe given title will be copied into the new ParserOutput object.
?SiteConfig$siteConfig
Returns
ParserOutput

Definition at line 71 of file PageBundleParserOutputConverter.php.


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