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 (ParsoidOutputStash $parsoidOutputStash, IBufferingStatsdDataFactory $statsDataFactory, ParsoidOutputAccess $parsoidOutputAccess)
 
 getETag (string $suffix='')
 Returns an ETag uniquely identifying the HTML output. More...
 
 getHtml ()
 
 getLastModified ()
 Returns the time at which the HTML was rendered. More...
 
 getParamSettings ()
 
 init (PageRecord $page, array $parameters, User $user, ?RevisionRecord $revision=null)
 

Private Member Functions

 getParserOutput ()
 

Private Attributes

string $flavor = null
 [ 'view', 'stash' ] are the supported flavors for now More...
 
PageRecord null $page = null
 
ParserOutput $parserOutput
 
ParsoidOutputAccess $parsoidOutputAccess
 
ParsoidOutputStash $parsoidOutputStash
 
RevisionRecord null $revision = null
 
bool $stash = false
 
IBufferingStatsdDataFactory $stats
 
User $user
 

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 47 of file ParsoidHTMLHelper.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::__construct ( ParsoidOutputStash  $parsoidOutputStash,
IBufferingStatsdDataFactory  $statsDataFactory,
ParsoidOutputAccess  $parsoidOutputAccess 
)
Parameters
ParsoidOutputStash$parsoidOutputStash
IBufferingStatsdDataFactory$statsDataFactory
ParsoidOutputAccess$parsoidOutputAccess

Definition at line 88 of file ParsoidHTMLHelper.php.

References MediaWiki\Rest\Handler\ParsoidHTMLHelper\$parsoidOutputAccess, and MediaWiki\Rest\Handler\ParsoidHTMLHelper\$parsoidOutputStash.

Member Function Documentation

◆ getETag()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::getETag ( string  $suffix = '')

Returns an ETag uniquely identifying the HTML output.

Parameters
string$suffixA suffix to attach to the etag.
Returns
string|null

Definition at line 162 of file ParsoidHTMLHelper.php.

◆ getHtml()

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

Definition at line 121 of file ParsoidHTMLHelper.php.

References MediaWiki\Rest\Handler\ParsoidHTMLHelper\$parserOutput, and Wikimedia\Message\MessageValue\new().

◆ getLastModified()

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

Returns the time at which the HTML was rendered.

Returns
string|null

Definition at line 181 of file ParsoidHTMLHelper.php.

◆ getParamSettings()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::getParamSettings ( )
Returns
array

Definition at line 188 of file ParsoidHTMLHelper.php.

◆ getParserOutput()

MediaWiki\Rest\Handler\ParsoidHTMLHelper::getParserOutput ( )
private
Returns
ParserOutput

Definition at line 202 of file ParsoidHTMLHelper.php.

References ParserOptions\newFromAnon().

◆ init()

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

Definition at line 104 of file ParsoidHTMLHelper.php.

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

Member Data Documentation

◆ $flavor

string MediaWiki\Rest\Handler\ParsoidHTMLHelper::$flavor = null
private

[ 'view', 'stash' ] are the supported flavors for now

Definition at line 66 of file ParsoidHTMLHelper.php.

◆ $page

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

Definition at line 60 of file ParsoidHTMLHelper.php.

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

◆ $parserOutput

ParserOutput MediaWiki\Rest\Handler\ParsoidHTMLHelper::$parserOutput
private

◆ $parsoidOutputAccess

ParsoidOutputAccess MediaWiki\Rest\Handler\ParsoidHTMLHelper::$parsoidOutputAccess
private

◆ $parsoidOutputStash

ParsoidOutputStash MediaWiki\Rest\Handler\ParsoidHTMLHelper::$parsoidOutputStash
private
Initial value:
=[]
public const CONSTRUCTOR_OPTIONS
const ParsoidCacheConfig
Name constant for the ParsoidCacheConfig setting, for use with Config::get()

Definition at line 57 of file ParsoidHTMLHelper.php.

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

◆ $revision

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

Definition at line 63 of file ParsoidHTMLHelper.php.

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

◆ $stash

bool MediaWiki\Rest\Handler\ParsoidHTMLHelper::$stash = false
private

Definition at line 69 of file ParsoidHTMLHelper.php.

◆ $stats

IBufferingStatsdDataFactory MediaWiki\Rest\Handler\ParsoidHTMLHelper::$stats
private

Definition at line 72 of file ParsoidHTMLHelper.php.

◆ $user

User MediaWiki\Rest\Handler\ParsoidHTMLHelper::$user
private

Definition at line 75 of file ParsoidHTMLHelper.php.

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


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