|
MediaWiki master
|
Provides methods for conversion between HtmlPageBundle and ParserOutput. More...
Public Member Functions | |
| __construct (private readonly SiteConfig $siteConfig, private readonly ?RevisionLookup $revisionLookup, private readonly ?LanguageFactory $languageFactory,) | |
| htmlPageBundleFromParserOutput (ParserOutput $parserOutput, bool $bodyOnly=false,) | |
| Returns a Parsoid HtmlPageBundle equivalent to the given ParserOutput. | |
| parserOutputFromPageBundle (HtmlPageBundle $pageBundle, bool $isParsoidContent, ?ParserOutput $originalParserOutput=null, ParsoidLinkTarget|PageReference|null $title=null,) | |
| Creates a ParserOutput object containing the relevant data from the given HtmlPageBundle object. | |
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.
Definition at line 44 of file PageBundleParserOutputConverter.php.
| MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter::__construct | ( | private readonly SiteConfig | $siteConfig, |
| private readonly ?RevisionLookup | $revisionLookup, | ||
| private readonly ?LanguageFactory | $languageFactory ) |
Definition at line 46 of file PageBundleParserOutputConverter.php.
| MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter::htmlPageBundleFromParserOutput | ( | ParserOutput | $parserOutput, |
| bool | $bodyOnly = false ) |
Returns a Parsoid HtmlPageBundle equivalent to the given ParserOutput.
| ParserOutput | $parserOutput | |
| bool | $bodyOnly | If 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. |
Definition at line 122 of file PageBundleParserOutputConverter.php.
| MediaWiki\Parser\Parsoid\PageBundleParserOutputConverter::parserOutputFromPageBundle | ( | HtmlPageBundle | $pageBundle, |
| bool | $isParsoidContent, | ||
| ?ParserOutput | $originalParserOutput = null, | ||
| ParsoidLinkTarget|PageReference|null | $title = null ) |
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.
| HtmlPageBundle | $pageBundle | |
| bool | $isParsoidContent | True if the content of this $pageBundle was generated by Parsoid; false if it was generated by the legacy parser. |
| ?ParserOutput | $originalParserOutput | Any non-parsoid metadata from $originalParserOutput will be copied into the new ParserOutput object. |
| ParsoidLinkTarget | PageReference | null | $title | The given title will be copied into the new ParserOutput object. |
Definition at line 72 of file PageBundleParserOutputConverter.php.
References MediaWiki\Parser\ContentHolder\createFromPageBundle().