MediaWiki REL1_37
MediaWiki\Rest\Handler\ParsoidHTMLHelper Class Reference

Helper for getting output of a given wikitext page rendered by parsoid. More...

Collaboration diagram for MediaWiki\Rest\Handler\ParsoidHTMLHelper:

Public Member Functions

 __construct (ParserCache $parserCache, RevisionOutputCache $revisionOutputCache, GlobalIdGenerator $globalIdGenerator)
 
 getETag ()
 Returns an ETag uniquely identifying the HTML output.
 
 getHtml ()
 
 getLastModified ()
 Returns the time at which the HTML was rendered.
 
 init (PageRecord $page, ?RevisionRecord $revision=null)
 

Private Member Functions

 assertParsoidInstalled ()
 Assert that Parsoid services are available.
 
 createPageConfig ()
 
 createParsoid ()
 
 parse ()
 

Private Attributes

GlobalIdGenerator $globalIdGenerator
 
PageRecord null $page = null
 
ParserCache $parserCache
 
Parsoid null $parsoid = null
 
RevisionRecord null $revision = null
 
RevisionOutputCache $revisionOutputCache
 
const RENDER_ID_KEY = 'parsoid-render-id'
 

Detailed Description

Helper for getting output of a given wikitext page rendered by parsoid.

Since
1.36
Stability: unstable
Pending consolidation of the Parsoid extension with core code. Part of this class should probably become a service.

Definition at line 48 of file ParsoidHTMLHelper.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::__construct ( ParserCache  $parserCache,
RevisionOutputCache  $revisionOutputCache,
GlobalIdGenerator  $globalIdGenerator 
)
Parameters
ParserCache$parserCache
RevisionOutputCache$revisionOutputCache
GlobalIdGenerator$globalIdGenerator

Definition at line 75 of file ParsoidHTMLHelper.php.

References MediaWiki\Rest\Handler\ParsoidHTMLHelper\$globalIdGenerator, MediaWiki\Rest\Handler\ParsoidHTMLHelper\$parserCache, and MediaWiki\Rest\Handler\ParsoidHTMLHelper\$revisionOutputCache.

Member Function Documentation

◆ assertParsoidInstalled()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::assertParsoidInstalled ( )
private

Assert that Parsoid services are available.

TODO: once parsoid glue services are in core, this will become a no-op and will be removed. See T265518

Exceptions
LocalizedHttpException

Definition at line 130 of file ParsoidHTMLHelper.php.

References MediaWiki\MediaWikiServices\getInstance().

◆ createPageConfig()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::createPageConfig ( )
private
Returns
PageConfig
Exceptions
LocalizedHttpException

Definition at line 169 of file ParsoidHTMLHelper.php.

◆ createParsoid()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::createParsoid ( )
private
Returns
Parsoid
Exceptions
LocalizedHttpException

Definition at line 148 of file ParsoidHTMLHelper.php.

References MediaWiki\MediaWikiServices\getInstance().

◆ getETag()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::getETag ( )

Returns an ETag uniquely identifying the HTML output.

Returns
string|null

Definition at line 229 of file ParsoidHTMLHelper.php.

◆ getHtml()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::getHtml ( )
Returns
ParserOutput a tuple with html and content-type
Exceptions
LocalizedHttpException

Definition at line 189 of file ParsoidHTMLHelper.php.

◆ getLastModified()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::getLastModified ( )

Returns the time at which the HTML was rendered.

Returns
string|null

Definition at line 244 of file ParsoidHTMLHelper.php.

◆ init()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::init ( PageRecord  $page,
?RevisionRecord  $revision = null 
)
Parameters
PageRecord$page
RevisionRecord | null$revision

Definition at line 89 of file ParsoidHTMLHelper.php.

References MediaWiki\Rest\Handler\ParsoidHTMLHelper\$page, and MediaWiki\Rest\Handler\ParsoidHTMLHelper\$revision.

◆ parse()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::parse ( )
private
Returns
ParserOutput
Exceptions
LocalizedHttpException

Definition at line 98 of file ParsoidHTMLHelper.php.

Member Data Documentation

◆ $globalIdGenerator

GlobalIdGenerator MediaWiki\Rest\Handler\ParsoidHTMLHelper::$globalIdGenerator
private

◆ $page

PageRecord null MediaWiki\Rest\Handler\ParsoidHTMLHelper::$page = null
private

Definition at line 62 of file ParsoidHTMLHelper.php.

Referenced by MediaWiki\Rest\Handler\ParsoidHTMLHelper\init().

◆ $parserCache

ParserCache MediaWiki\Rest\Handler\ParsoidHTMLHelper::$parserCache
private

◆ $parsoid

Parsoid null MediaWiki\Rest\Handler\ParsoidHTMLHelper::$parsoid = null
private

Definition at line 65 of file ParsoidHTMLHelper.php.

◆ $revision

RevisionRecord null MediaWiki\Rest\Handler\ParsoidHTMLHelper::$revision = null
private

Definition at line 68 of file ParsoidHTMLHelper.php.

Referenced by MediaWiki\Rest\Handler\ParsoidHTMLHelper\init().

◆ $revisionOutputCache

RevisionOutputCache MediaWiki\Rest\Handler\ParsoidHTMLHelper::$revisionOutputCache
private

◆ RENDER_ID_KEY

const MediaWiki\Rest\Handler\ParsoidHTMLHelper::RENDER_ID_KEY = 'parsoid-render-id'
private

Definition at line 50 of file ParsoidHTMLHelper.php.


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