MediaWiki master
MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper Class Reference

REST helper for converting HTML to page content source (e.g. More...

Public Member Functions

 __construct (StatsdDataFactoryInterface $statsDataFactory, HtmlTransformFactory $htmlTransformFactory, ParsoidOutputStash $parsoidOutputStash, ParsoidOutputAccess $parsoidOutputAccess, array $envOptions=[])
 
 getContent ()
 
 getParamSettings ()
 
 getTransform ()
 Return HTMLTransform object, so additional context can be provided by calling setters on it.
 
 init (PageIdentity $page, $body, array $parameters, ?RevisionRecord $originalRevision=null, ?Bcp47Code $pageLanguage=null)
 
 putContent (ResponseInterface $response)
 Creates a response containing the content derived from the input HTML.
 
 setMetrics (StatsdDataFactoryInterface $stats)
 Set metrics sink.
 
 setOriginal ( $rev, $originalRendering)
 Supply information about the revision and rendering that was the original basis of the input HTML.
 

Detailed Description

REST helper for converting HTML to page content source (e.g.

wikitext).

Since
1.40
Stability: unstable
Pending consolidation of the Parsoid extension with core code.

Definition at line 60 of file HtmlInputTransformHelper.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper::__construct ( StatsdDataFactoryInterface $statsDataFactory,
HtmlTransformFactory $htmlTransformFactory,
ParsoidOutputStash $parsoidOutputStash,
ParsoidOutputAccess $parsoidOutputAccess,
array $envOptions = [] )
Parameters
StatsdDataFactoryInterface$statsDataFactory
HtmlTransformFactory$htmlTransformFactory
ParsoidOutputStash$parsoidOutputStash
ParsoidOutputAccess$parsoidOutputAccess
array$envOptions

Definition at line 105 of file HtmlInputTransformHelper.php.

Member Function Documentation

◆ getContent()

MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper::getContent ( )
Returns
Content the content derived from the input HTML.
Exceptions
HttpException

Definition at line 526 of file HtmlInputTransformHelper.php.

◆ getParamSettings()

MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper::getParamSettings ( )
Returns
array

Definition at line 125 of file HtmlInputTransformHelper.php.

◆ getTransform()

MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper::getTransform ( )

Return HTMLTransform object, so additional context can be provided by calling setters on it.

Returns
HtmlToContentTransform

Definition at line 386 of file HtmlInputTransformHelper.php.

◆ init()

MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper::init ( PageIdentity $page,
$body,
array $parameters,
?RevisionRecord $originalRevision = null,
?Bcp47Code $pageLanguage = null )
Parameters
PageIdentity$page
array | string$bodyBody structure, or an HTML string
array$parameters
RevisionRecord | null$originalRevision
Bcp47Code | null$pageLanguage
Exceptions
HttpException

Definition at line 287 of file HtmlInputTransformHelper.php.

◆ putContent()

MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper::putContent ( ResponseInterface $response)

Creates a response containing the content derived from the input HTML.

This will set the appropriate Content-Type header.

Parameters
ResponseInterface$response

Definition at line 555 of file HtmlInputTransformHelper.php.

References MediaWiki\Rest\ResponseInterface\getBody(), and MediaWiki\Rest\ResponseInterface\setHeader().

◆ setMetrics()

MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper::setMetrics ( StatsdDataFactoryInterface $stats)

Set metrics sink.

Parameters
StatsdDataFactoryInterface$stats

Definition at line 395 of file HtmlInputTransformHelper.php.

◆ setOriginal()

MediaWiki\Rest\Handler\Helper\HtmlInputTransformHelper::setOriginal ( $rev,
$originalRendering )

Supply information about the revision and rendering that was the original basis of the input HTML.

This is used to apply selective serialization (selser), if possible.

Parameters
RevisionRecord | int | null$rev
ParsoidRenderID | PageBundle | ParserOutput | null$originalRendering

Definition at line 410 of file HtmlInputTransformHelper.php.


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