MediaWiki  master
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. More...
 
 getHtml ()
 
 getLastModified ()
 Returns the time at which the HTML was rendered. More...
 
 init (PageRecord $page, ?RevisionRecord $revision=null)
 

Private Member Functions

 assertParsoidInstalled ()
 Assert that Parsoid services are available. More...
 
 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 49 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 76 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 140 of file ParsoidHTMLHelper.php.

References MediaWiki\MediaWikiServices\getInstance(), and Wikimedia\Message\MessageValue\new().

Referenced by MediaWiki\Rest\Handler\ParsoidHTMLHelper\createPageConfig(), and MediaWiki\Rest\Handler\ParsoidHTMLHelper\createParsoid().

◆ createPageConfig()

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

◆ createParsoid()

◆ getETag()

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

Returns an ETag uniquely identifying the HTML output.

Returns
string|null

Definition at line 239 of file ParsoidHTMLHelper.php.

References MediaWiki\Rest\Handler\ParsoidHTMLHelper\getHtml(), and MediaWiki\Rest\Handler\ParsoidHTMLHelper\getLastModified().

◆ getHtml()

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

◆ getLastModified()

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

Returns the time at which the HTML was rendered.

Returns
string|null

Definition at line 254 of file ParsoidHTMLHelper.php.

References MediaWiki\Rest\Handler\ParsoidHTMLHelper\getHtml().

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

◆ init()

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

Definition at line 90 of file ParsoidHTMLHelper.php.

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

◆ parse()

Member Data Documentation

◆ $globalIdGenerator

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

◆ $page

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

Definition at line 63 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

◆ $revision

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

Definition at line 69 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 51 of file ParsoidHTMLHelper.php.


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