Parsoid
A bidirectional parser between wikitext and HTML5
Loading...
Searching...
No Matches
Wikimedia\Parsoid\Mocks\MockEnv Class Reference
+ Inheritance diagram for Wikimedia\Parsoid\Mocks\MockEnv:
+ Collaboration diagram for Wikimedia\Parsoid\Mocks\MockEnv:

Public Member Functions

 __construct (array $opts)
 
 bumpParserResourceUse (string $resource, int $count=1)
 @suppress PhanEmptyPublicMethod
 
- 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)
 
 getSiteConfig ()
 Get the site config.
 
 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
 

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Mocks\MockEnv::__construct ( array $opts)
Parameters
array$opts
  • log: (bool) Whether the logger should log. Default false.
  • wrapSections: (bool) Whether to wrap sections. Default false.
  • pageConfig: (PageConfig) If given, supplies a custom PageConfig instance to use.
  • siteConfig: (SiteConfig) If given, supplies a custom SiteConfig instance to use.
  • dataAccess: (DataAccess) If given, supplies a custom DataAccess instance to use.
  • pageContent: (PageContent|string) If given and 'pageConfig' is not, this is passed to the MockPageConfig.

Member Function Documentation

◆ bumpParserResourceUse()

Wikimedia\Parsoid\Mocks\MockEnv::bumpParserResourceUse ( string $resource,
int $count = 1 )

@suppress PhanEmptyPublicMethod

Parameters
string$resource
int$count

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