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

Public Member Functions

 sourceToDom (ParsoidExtensionAPI $extApi, string $content, array $args)
 Convert an extension tag's content to "prepared and loaded" DOM.
Parameters
ParsoidExtensionAPI$extApi
string$contentExtension tag content
array$argsExtension tag arguments The extension tag arguments should be treated as opaque objects and any necessary inspection should be handled through the API.
Returns
DocumentFragment|false|null DocumentFragment if returning some parsed content false to fallback to the default handler for the content null to drop the instance completely
Exceptions
ExtensionError

 
 lintHandler (ParsoidExtensionAPI $extApi, Element $linterTag, callable $defaultHandler)
 Lint handler for this extension.If the extension has lints it wants to expose, it should use $extApi to register those lints. Alternatively, the extension might simply inspect its DOM and invoke the default lint handler on a DOM tree that it wants inspected. For example, <ref> nodes often only have a pointer (the id attribute) to its content, and its lint handler would look up the DOM tree and invoke the default lint handler on that tree.
Parameters
ParsoidExtensionAPI$extApi
Element$rootNodeExtension content's root node
callable$defaultHandlerDefault lint handler
  • Default lint handler has signature $defaultHandler( Element $elt ): void
Returns
bool Return false to indicate that this extension has no special lint handler (the default lint handler will be used. Return true to indicate linting should proceed with the next sibling.

 
 getConfig ()
 Return information about this extension module.The structure of the return value is enforced by moduleconfig.schema.json, in this directory.
See also
https://www.mediawiki.org/wiki/Parsoid/Internals/Module_Configuration_Schema
Returns
array{name:string}

 
- Public Member Functions inherited from Wikimedia\Parsoid\Ext\ExtensionTagHandler
 processAttributeEmbeddedHTML (ParsoidExtensionAPI $extApi, Element $elt, Closure $proc)
 Extensions might embed HTML in attributes in their own custom representation (whether in data-mw or elsewhere).
 
 processAttributeEmbeddedDom (ParsoidExtensionAPI $extApi, Element $elt, callable $proc)
 Extensions might embed HTML in attributes in their own custom representation (whether in data-mw or elsewhere).
 
 domToWikitext (ParsoidExtensionAPI $extApi, Element $node, bool $wrapperUnmodified)
 Serialize a DOM node created by this extension to wikitext.
 
 diffHandler (ParsoidExtensionAPI $extApi, callable $domDiff, Element $origNode, Element $editedNode)
 XXX: Experimental.
 

Member Function Documentation

◆ getConfig()

Wikimedia\Parsoid\Mocks\LinterTag::getConfig ( )

Return information about this extension module.The structure of the return value is enforced by moduleconfig.schema.json, in this directory.

See also
https://www.mediawiki.org/wiki/Parsoid/Internals/Module_Configuration_Schema
Returns
array{name:string}

Implements Wikimedia\Parsoid\Ext\ExtensionModule.

◆ lintHandler()

Wikimedia\Parsoid\Mocks\LinterTag::lintHandler ( ParsoidExtensionAPI $extApi,
Element $linterTag,
callable $defaultHandler )

Lint handler for this extension.If the extension has lints it wants to expose, it should use $extApi to register those lints. Alternatively, the extension might simply inspect its DOM and invoke the default lint handler on a DOM tree that it wants inspected. For example, <ref> nodes often only have a pointer (the id attribute) to its content, and its lint handler would look up the DOM tree and invoke the default lint handler on that tree.

Parameters
ParsoidExtensionAPI$extApi
Element$rootNodeExtension content's root node
callable$defaultHandlerDefault lint handler
  • Default lint handler has signature $defaultHandler( Element $elt ): void
Returns
bool Return false to indicate that this extension has no special lint handler (the default lint handler will be used. Return true to indicate linting should proceed with the next sibling.

Reimplemented from Wikimedia\Parsoid\Ext\ExtensionTagHandler.

◆ sourceToDom()

Wikimedia\Parsoid\Mocks\LinterTag::sourceToDom ( ParsoidExtensionAPI $extApi,
string $content,
array $args )

Convert an extension tag's content to "prepared and loaded" DOM.

Parameters
ParsoidExtensionAPI$extApi
string$contentExtension tag content
array$argsExtension tag arguments The extension tag arguments should be treated as opaque objects and any necessary inspection should be handled through the API.
Returns
DocumentFragment|false|null DocumentFragment if returning some parsed content false to fallback to the default handler for the content null to drop the instance completely
Exceptions
ExtensionError

Reimplemented from Wikimedia\Parsoid\Ext\ExtensionTagHandler.


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