MediaWiki 1.43.1
MediaWiki\Parser\Parsoid\HtmlToContentTransform Class Reference

This class allows HTML to be transformed to a page content source format such as wikitext. More...

Collaboration diagram for MediaWiki\Parser\Parsoid\HtmlToContentTransform:

Public Member Functions

 __construct (string $modifiedHTML, PageIdentity $page, Parsoid $parsoid, array $parsoidSettings, PageConfigFactory $pageConfigFactory, IContentHandlerFactory $contentHandlerFactory)
 
 getContentModel ()
 
 getModifiedDocument ()
 
 getModifiedHtmlSize ()
 The size of the modified HTML in characters.
 
 getOffsetType ()
 
 getOriginalBody ()
 NOTE: The return value of this method depends on setOriginalData() having been called first.
 
 getOriginalHtml ()
 Returns the original HTML, with any necessary processing applied.
 
 getOriginalRevisionId ()
 
 getOriginalSchemaVersion ()
 
 getSchemaVersion ()
 NOTE: The return value of this method depends on setOriginalData() having been called first.
 
 hasOriginalDataParsoid ()
 NOTE: The return value of this method depends on setOriginalData() having been called first.
 
 hasOriginalHtml ()
 NOTE: The return value of this method depends on setOriginalData() having been called first.
 
 htmlToContent ()
 Returns a Content object derived from the supplied HTML.
 
 knowsOriginalContent ()
 
 setContentLanguage (Bcp47Code $lang)
 
 setMetrics ( $metrics)
 Set metrics sink.
 
 setModifiedDataMW (array $modifiedDataMW)
 
 setOptions (array $options)
 
 setOriginalContent (Content $content)
 Sets the original content (such as wikitext).
 
 setOriginalDataMW (array $originalDataMW)
 
 setOriginalDataParsoid (array $originalDataParsoid)
 
 setOriginalHtml (string $originalHtml)
 
 setOriginalRevision (RevisionRecord $rev)
 
 setOriginalRevisionId (int $oldid)
 
 setOriginalSchemaVersion (string $originalSchemaVeraion)
 
 setOriginalText (string $text)
 Sets the original source text (usually wikitext).
 

Protected Member Functions

 parseHTML (string $html, bool $validateXMLNames=false)
 

Protected Attributes

StatsFactory $metrics = null
 

Detailed Description

This class allows HTML to be transformed to a page content source format such as wikitext.

Since
1.40
Stability: unstable
should be stable before 1.40 release

Definition at line 40 of file HtmlToContentTransform.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::__construct ( string $modifiedHTML,
PageIdentity $page,
Parsoid $parsoid,
array $parsoidSettings,
PageConfigFactory $pageConfigFactory,
IContentHandlerFactory $contentHandlerFactory )
Parameters
string$modifiedHTML
PageIdentity$page
Parsoid$parsoid
array$parsoidSettings
PageConfigFactory$pageConfigFactory
IContentHandlerFactory$contentHandlerFactory

Definition at line 71 of file HtmlToContentTransform.php.

Member Function Documentation

◆ getContentModel()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::getContentModel ( )

Definition at line 475 of file HtmlToContentTransform.php.

◆ getModifiedDocument()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::getModifiedDocument ( )

Definition at line 322 of file HtmlToContentTransform.php.

◆ getModifiedHtmlSize()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::getModifiedHtmlSize ( )

The size of the modified HTML in characters.

Returns
int

Definition at line 309 of file HtmlToContentTransform.php.

◆ getOffsetType()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::getOffsetType ( )

Definition at line 479 of file HtmlToContentTransform.php.

◆ getOriginalBody()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::getOriginalBody ( )

NOTE: The return value of this method depends on setOriginalData() having been called first.

Returns
Element
Exceptions
ClientError

Definition at line 403 of file HtmlToContentTransform.php.

◆ getOriginalHtml()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::getOriginalHtml ( )

Returns the original HTML, with any necessary processing applied.

Todo
Make this method redundant, nothing should operate on HTML strings.
Returns
string

Definition at line 361 of file HtmlToContentTransform.php.

◆ getOriginalRevisionId()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::getOriginalRevisionId ( )

Definition at line 467 of file HtmlToContentTransform.php.

◆ getOriginalSchemaVersion()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::getOriginalSchemaVersion ( )

Definition at line 439 of file HtmlToContentTransform.php.

◆ getSchemaVersion()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::getSchemaVersion ( )

NOTE: The return value of this method depends on setOriginalData() having been called first.

Returns
string

Definition at line 449 of file HtmlToContentTransform.php.

◆ hasOriginalDataParsoid()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::hasOriginalDataParsoid ( )

NOTE: The return value of this method depends on setOriginalData() having been called first.

Returns
bool

Definition at line 350 of file HtmlToContentTransform.php.

◆ hasOriginalHtml()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::hasOriginalHtml ( )

NOTE: The return value of this method depends on setOriginalData() having been called first.

Returns
bool

Definition at line 340 of file HtmlToContentTransform.php.

◆ htmlToContent()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::htmlToContent ( )

Returns a Content object derived from the supplied HTML.

Returns
Content

Definition at line 616 of file HtmlToContentTransform.php.

◆ knowsOriginalContent()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::knowsOriginalContent ( )

Definition at line 471 of file HtmlToContentTransform.php.

◆ parseHTML()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::parseHTML ( string $html,
bool $validateXMLNames = false )
protected
Parameters
string$html
bool$validateXMLNames
Returns
Document
Exceptions
ClientError

Definition at line 392 of file HtmlToContentTransform.php.

◆ setContentLanguage()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setContentLanguage ( Bcp47Code $lang)
Parameters
Bcp47Code$lang

Definition at line 150 of file HtmlToContentTransform.php.

◆ setMetrics()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setMetrics ( $metrics)

Set metrics sink.

Note
Passing a StatsdDataFactoryInterface here has been deprecated since 1.43.
Parameters
StatsFactory | StatsdDataFactoryInterface$metrics

Definition at line 96 of file HtmlToContentTransform.php.

References wfDeprecated().

◆ setModifiedDataMW()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setModifiedDataMW ( array $modifiedDataMW)
Note
Call this after all original data has been set!
Parameters
array$modifiedDataMW

Definition at line 201 of file HtmlToContentTransform.php.

◆ setOptions()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setOptions ( array $options)

Definition at line 114 of file HtmlToContentTransform.php.

◆ setOriginalContent()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setOriginalContent ( Content $content)

Sets the original content (such as wikitext).

Parameters
Content$content

Definition at line 173 of file HtmlToContentTransform.php.

◆ setOriginalDataMW()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setOriginalDataMW ( array $originalDataMW)
Parameters
array$originalDataMW

Definition at line 233 of file HtmlToContentTransform.php.

◆ setOriginalDataParsoid()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setOriginalDataParsoid ( array $originalDataParsoid)
Parameters
array$originalDataParsoid

Definition at line 250 of file HtmlToContentTransform.php.

◆ setOriginalHtml()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setOriginalHtml ( string $originalHtml)
Parameters
string$originalHtml

Definition at line 221 of file HtmlToContentTransform.php.

◆ setOriginalRevision()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setOriginalRevision ( RevisionRecord $rev)
Parameters
RevisionRecord$rev

Definition at line 121 of file HtmlToContentTransform.php.

◆ setOriginalRevisionId()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setOriginalRevisionId ( int $oldid)
Parameters
int$oldid

Definition at line 136 of file HtmlToContentTransform.php.

◆ setOriginalSchemaVersion()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setOriginalSchemaVersion ( string $originalSchemaVeraion)
Parameters
string$originalSchemaVeraion

Definition at line 214 of file HtmlToContentTransform.php.

◆ setOriginalText()

MediaWiki\Parser\Parsoid\HtmlToContentTransform::setOriginalText ( string $text)

Sets the original source text (usually wikitext).

Parameters
string$text

Definition at line 163 of file HtmlToContentTransform.php.

Member Data Documentation

◆ $metrics

StatsFactory MediaWiki\Parser\Parsoid\HtmlToContentTransform::$metrics = null
protected

Definition at line 53 of file HtmlToContentTransform.php.


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