Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Config\Api\Env Class Reference

An Env accessing MediaWiki via its Action API. More...

+ Inheritance diagram for Wikimedia\Parsoid\Config\Api\Env:
+ Collaboration diagram for Wikimedia\Parsoid\Config\Api\Env:

Public Member Functions

 __construct (array $opts)
 
 getSiteConfig ()
 
- Public Member Functions inherited from Wikimedia\Parsoid\Config\Env
 __construct (SiteConfig $siteConfig, PageConfig $pageConfig, DataAccess $dataAccess, ContentMetadataCollector $metadata, ?array $options=null)
 
 profiling ()
 Is profiling enabled?
 
 getCurrentProfile ()
 Get the profile at the top of the stack.
 
 pushNewProfile ()
 New pipeline started.
 
 popProfile ()
 Pipeline ended.
 
 hasTraceFlags ()
 
 hasTraceFlag (string $flag)
 Test which trace information to log.
 
 hasDumpFlags ()
 
 hasDumpFlag (string $flag)
 Test which state to dump.
 
 writeDump (string $str)
 Write out a string (because it was requested by dumpFlags)
 
 getPageConfig ()
 Get the page config.
 
 getDataAccess ()
 Get the data access object.
 
 getMetadata ()
 Return the ContentMetadataCollector.
 
 getTOCData ()
 Return the Table of Contents information for the article.
 
 nativeTemplateExpansionEnabled ()
 
 getUID ()
 Get the current uid counter value.
 
 getFID ()
 Get the current fragment id counter value.
 
 getWrapSections ()
 Whether <section> wrappers should be added.
 
 getPipelineFactory ()
 Get the pipeline factory.
 
 getRequestOffsetType ()
 Return the external format of character offsets in source ranges.
 
 getCurrentOffsetType ()
 Return the current format of character offsets in source ranges.
 
 setCurrentOffsetType (string $offsetType)
 Update the current offset type.
 
 getContextTitle ()
 Return the title from the PageConfig, as a Parsoid title.
 
 resolveTitle (string $str, bool $resolveOnly=false)
 Resolve strings that are page-fragments or subpage references with respect to the current page name.
 
 normalizedTitleKey (string $str, bool $noExceptions=false, bool $ignoreFragment=false)
 Get normalized title key for a title string.
 
 makeTitleFromText (string $str, ?int $defaultNs=null, bool $noExceptions=false)
 Create a Title object.
 
 makeTitleFromURLDecodedStr (string $str, ?int $defaultNs=null, bool $noExceptions=false)
 Create a Title object.
 
 makeLink (Title $title)
 Make a link to a Title.
 
 isValidLinkTarget ( $href)
 Test if an href attribute value could be a valid link target.
 
 generateUID ()
 Generate a new uid.
 
 newObjectId ()
 Generate a new object id.
 
 generateAnnotationUID ()
 Generate a new annotation uid.
 
 newAnnotationId ()
 Generate a new annotation id.
 
 newAboutId ()
 Generate a new about id.
 
 setDOMDiff ( $doc)
 Store reference to DOM diff document.
 
 getDOMDiff ()
 Return reference to DOM diff document.
 
 newFragmentId ()
 Generate a new fragment id.
 
 setupTopLevelDoc (?Document $topLevelDoc=null)
 When an environment is constructed, we initialize a document (and RemexPipeline) to be used throughout the parse.
 
 fetchRemexPipeline (bool $atTopLevel)
 
 setVariable (string $variable, $state)
 BehaviorSwitchHandler support function that adds a property named by $variable and sets it to $state.
 
 setBehaviorSwitch (string $switch, $state)
 Record a behavior switch.
 
 getBehaviorSwitch (string $switch, $default=null)
 Fetch the state of a previously-recorded behavior switch.
 
 getDOMFragmentMap ()
 
 getDOMFragment (string $id)
 
 setDOMFragment (string $id, DocumentFragment $forest)
 
 removeDOMFragment (string $id)
 
 recordLint (string $type, array $lintData)
 Record a lint.
 
 getLints ()
 Retrieve recorded lints.
 
 setLints (array $lints)
 Init lints to the passed array.
 
 log (string $prefix,... $args)
 
 bumpWt2HtmlResourceUse (string $resource, int $count=1)
 Bump usage of some limited parser resource (ex: tokens, # transclusions, # list items, etc.)
 
 compareWt2HtmlLimit (string $resource, int $n)
 
 bumpHtml2WtResourceUse (string $resource, int $count=1)
 Bump usage of some limited serializer resource (ex: html size)
 
 getContentHandler (?string &$contentmodel=null)
 Get an appropriate content handler, given a contentmodel.
 
 langConverterEnabled ()
 Is the language converter enabled on this page?
 
 getInputContentVersion ()
 The HTML content version of the input document (for html2wt and html2html conversions).
 
 getOutputContentVersion ()
 The HTML content version of the input document (for html2wt and html2html conversions).
 
 getHtmlVariantLanguageBcp47 ()
 If non-null, the language variant used for Parsoid HTML; we convert to this if wt2html, or from this (if html2wt).
 
 getWtVariantLanguageBcp47 ()
 If non-null, the language variant to be used for wikitext.
 
 getSkipLanguageConversionPass ()
 
 htmlVary ()
 Determine appropriate vary headers for the HTML form of this page.
 
 htmlContentLanguageBcp47 ()
 Determine an appropriate content-language for the HTML form of this page.
 
 getExternalLinkAttribs (string $url)
 Get an array of attributes to apply to an anchor linking to $url.
 
 getLinterConfig ()
 
 linting (?string $type=null)
 Whether to enable linter Backend.
 

Additional Inherited Members

- Public Attributes inherited from Wikimedia\Parsoid\Config\Env
 $topFrame
 
 $logLinterData = false
 
 $styleTagKeys = []
 
 $pageBundle
 
 $discardDataParsoid = false
 
 $hasAnnotations
 
 $pageCache = []
 
 $transclusionCache = []
 
 $mediaCache = []
 
 $extensionCache = []
 
 $topLevelDoc
 

Detailed Description

An Env accessing MediaWiki via its Action API.

Note this is intended for testing, not performance.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Config\Api\Env::__construct ( array $opts)
Parameters
array$optsIn addition to those from the parent class,
  • log: (bool) If true, write log data to stderr.
  • apiEndpoint: (string) URL for api.php. Required.
  • title: (string) Page being parsed. Required.
  • apiTimeout: (int) Timeout, in sections. Default 60.
  • userAgent: (string) User agent prefix.

Member Function Documentation

◆ getSiteConfig()

Wikimedia\Parsoid\Config\Api\Env::getSiteConfig ( )
Returns
SiteConfig

Reimplemented from Wikimedia\Parsoid\Config\Env.


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