|
MediaWiki master
|
Public Member Functions | |
| __clone () | |
| addFragment (string $name=self::BODY_FRAGMENT, ?string $html=null) | |
| createFragment (?string $html=null) | |
| getAsDom (string $fragmentName=self::BODY_FRAGMENT) | |
| Returns the designated fragment as a DOM DocumentFragment, or null if it is not present. | |
| getAsHtmlString (string $fragmentName=self::BODY_FRAGMENT) | |
| Returns the designated fragment as an HTML string version, or null if it is not present. | |
| getBasePageBundle () | |
| Return the BasePageBundle of the ContentHolder. | |
| has (string $fragmentName) | |
| Returns false if the designated fragment is not present in the ContentHolder. | |
| ignoreForObjectEquality () | |
| isParsoidContent () | |
| Returns true if this ContentHolder contains Parsoid-generated content. | |
| preferDom () | |
| Given a ContentHolderTransformStage that has two valid transform options, returns true if the state of the ContentHolder calls for a DOM transform, false if it calls for a text transform. | |
| setAsDom (string $fragmentName=self::BODY_FRAGMENT, ?DocumentFragment $fragment=null) | |
| Sets or removes a fragment, provided as a DOM DocumentFragment. | |
| setAsHtmlString (string $fragmentName=self::BODY_FRAGMENT, ?string $html=null) | |
| Sets or removes a fragment, provided as an HTML string. | |
Static Public Member Functions | |
| static | createEmpty () |
| Creates an empty ContentHolder that can be used as a placeholder. | |
| static | createFromLegacyString (string $html) |
| Create a ContentHolder from a legacy body HTML string, typically returned by the legacy parser. | |
| static | createFromParsoidPageBundle (HtmlPageBundle $pb) |
| Create a ContentHolder from a Parsoid HtmlPageBundle. | |
Public Attributes | |
| const | BODY_FRAGMENT = "body" |
A ContentHolder holds a map of fragments that can be HTML string or DOM fragments. It should, as much as possible, be used in a consistent format and/or limit format switches, as conversions of all the fragments happen on all accessors, which has a performance impact.
ContentHolder currently makes no guarantee on the preservation of the document outside of the <body> tag. In particular, if a full Parsoid document with a <head> tag is passed as a string, and converted to DOM, the <head> content is lost. This must be taken into account in particular if we create an ExtractBody DOM pass, in which case the <base> tag contained in the <head> must be handled before conversion. OutputTransform steps after ExtractBody should however be unaffected.
Definition at line 38 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::__clone | ( | ) |
Definition at line 314 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::addFragment | ( | string | $name = self::BODY_FRAGMENT, |
| ?string | $html = null ) |
Definition at line 231 of file ContentHolder.php.
|
static |
Creates an empty ContentHolder that can be used as a placeholder.
This does not contain any body content.
Definition at line 94 of file ContentHolder.php.
Referenced by MediaWiki\Parser\ParserOutput\__construct().
| MediaWiki\Parser\ContentHolder::createFragment | ( | ?string | $html = null | ) |
Definition at line 218 of file ContentHolder.php.
|
static |
Create a ContentHolder from a legacy body HTML string, typically returned by the legacy parser.
Definition at line 64 of file ContentHolder.php.
Referenced by MediaWiki\Parser\ParserOutput\__construct().
|
static |
Create a ContentHolder from a Parsoid HtmlPageBundle.
Definition at line 76 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::getAsDom | ( | string | $fragmentName = self::BODY_FRAGMENT | ) |
Returns the designated fragment as a DOM DocumentFragment, or null if it is not present.
Definition at line 143 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::getAsHtmlString | ( | string | $fragmentName = self::BODY_FRAGMENT | ) |
Returns the designated fragment as an HTML string version, or null if it is not present.
Definition at line 129 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::getBasePageBundle | ( | ) |
Return the BasePageBundle of the ContentHolder.
Definition at line 241 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::has | ( | string | $fragmentName | ) |
Returns false if the designated fragment is not present in the ContentHolder.
Definition at line 118 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::ignoreForObjectEquality | ( | ) |
Definition at line 324 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::isParsoidContent | ( | ) |
Returns true if this ContentHolder contains Parsoid-generated content.
Definition at line 105 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::preferDom | ( | ) |
Given a ContentHolderTransformStage that has two valid transform options, returns true if the state of the ContentHolder calls for a DOM transform, false if it calls for a text transform.
Right now, this is strictly directed by whether the ContentHolder is in DOM format or in HTML format; this might change in the future if we maintain both formats in some cases.
Definition at line 334 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::setAsDom | ( | string | $fragmentName = self::BODY_FRAGMENT, |
| ?DocumentFragment | $fragment = null ) |
Sets or removes a fragment, provided as a DOM DocumentFragment.
| string | $fragmentName | name of the fragment to set |
| DocumentFragment | null | $fragment | the fragment to set, or null to remove a fragment. |
Definition at line 193 of file ContentHolder.php.
| MediaWiki\Parser\ContentHolder::setAsHtmlString | ( | string | $fragmentName = self::BODY_FRAGMENT, |
| ?string | $html = null ) |
Sets or removes a fragment, provided as an HTML string.
| string | $fragmentName | name of the fragment to set |
| string | null | $html | string of the fragment to set, or null to remove a fragment. |
Definition at line 161 of file ContentHolder.php.
| const MediaWiki\Parser\ContentHolder::BODY_FRAGMENT = "body" |
Definition at line 39 of file ContentHolder.php.