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

Public Member Functions

 sourceToDom (ParsoidExtensionAPI $extApi, string $txt, array $extArgs)
 Convert an extension tag's content to DOM.
Parameters
ParsoidExtensionAPI$extApi
string$srcExtension tag content
array$extArgsExtension 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

 
 domToWikitext (ParsoidExtensionAPI $extApi, Element $node, bool $wrapperUnmodified)
 Serialize a DOM node created by this extension to wikitext.
Parameters
ParsoidExtensionAPI$extApi
Element$node
bool$wrapperUnmodified
Returns
string|false Return false to use the default serialization.

 
 lintHandler (ParsoidExtensionAPI $extApi, Element $refs, 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 is lint handler would look up the DOM tree and invoke the default lint handler on that tree.FIXME: There is probably no reason for the lint handler to return anything. The caller should simply proceed with the next sibling of $rootNode after the lint handler returns.
Parameters
ParsoidExtensionAPI$extApi
Element$rootNodeExtension content's root node
callable$defaultHandlerDefault lint handler
  • Default lint handler has signature $defaultHandler( Element $elt ): void
Returns
Node|null|false Return false to indicate that this extension has no special lint handler (the default lint handler will be used. Return null to indicate linting should proceed with the next sibling. (Deprecated) A Node can be returned to indicate the point in the tree where linting should resume.

 
 diffHandler (ParsoidExtensionAPI $extApi, callable $domDiff, Element $origNode, Element $editedNode)
 XXX: Experimental.Call $domDiff on corresponding substrees of $origNode and $editedNode
Parameters
ParsoidExtensionAPI$extApi
callable$domDiff
Element$origNode
Element$editedNode
Returns
bool

 
- Public Member Functions inherited from Wikimedia\Parsoid\Ext\ExtensionTagHandler
 modifyArgDict (ParsoidExtensionAPI $extApi, object $argDict)
 Some extensions require the ability to modify the argument dictionary.
 

Static Public Member Functions

static insertMissingReferencesIntoDOM (ParsoidExtensionAPI $extApi, ReferencesData $refsData, Node $node)
 Process <ref>s left behind after the DOM is fully processed.
 
static processRefs (ParsoidExtensionAPI $extApi, ReferencesData $refsData, Node $node)
 
static addEmbeddedErrors (ParsoidExtensionAPI $extApi, ReferencesData $refsData, Node $node)
 Traverse into all the embedded content and mark up the refs in there that have errors that weren't known before the content was serialized.
 

Member Function Documentation

◆ addEmbeddedErrors()

static Wikimedia\Parsoid\Ext\Cite\References::addEmbeddedErrors ( ParsoidExtensionAPI $extApi,
ReferencesData $refsData,
Node $node )
static

Traverse into all the embedded content and mark up the refs in there that have errors that weren't known before the content was serialized.

Some errors are only known at the time when we're inserting the references lists, at which point, embedded content has already been serialized and stored, so we no longer have live access to it. We therefore map about ids to errors for a ref at that time, and then do one final walk of the dom to peak into all the embedded content and mark up the errors where necessary.

Parameters
ParsoidExtensionAPI$extApi
ReferencesData$refsData
Node$node

◆ diffHandler()

Wikimedia\Parsoid\Ext\Cite\References::diffHandler ( ParsoidExtensionAPI $extApi,
callable $domDiff,
Element $origNode,
Element $editedNode )

XXX: Experimental.Call $domDiff on corresponding substrees of $origNode and $editedNode

Parameters
ParsoidExtensionAPI$extApi
callable$domDiff
Element$origNode
Element$editedNode
Returns
bool

Reimplemented from Wikimedia\Parsoid\Ext\ExtensionTagHandler.

◆ domToWikitext()

Wikimedia\Parsoid\Ext\Cite\References::domToWikitext ( ParsoidExtensionAPI $extApi,
Element $node,
bool $wrapperUnmodified )

Serialize a DOM node created by this extension to wikitext.

Parameters
ParsoidExtensionAPI$extApi
Element$node
bool$wrapperUnmodified
Returns
string|false Return false to use the default serialization.

Reimplemented from Wikimedia\Parsoid\Ext\ExtensionTagHandler.

◆ insertMissingReferencesIntoDOM()

static Wikimedia\Parsoid\Ext\Cite\References::insertMissingReferencesIntoDOM ( ParsoidExtensionAPI $extApi,
ReferencesData $refsData,
Node $node )
static

Process <ref>s left behind after the DOM is fully processed.

We process them as if there was an implicit <references /> tag at the end of the DOM.

Parameters
ParsoidExtensionAPI$extApi
ReferencesData$refsData
Node$node

◆ lintHandler()

Wikimedia\Parsoid\Ext\Cite\References::lintHandler ( ParsoidExtensionAPI $extApi,
Element $refs,
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 is lint handler would look up the DOM tree and invoke the default lint handler on that tree.FIXME: There is probably no reason for the lint handler to return anything. The caller should simply proceed with the next sibling of $rootNode after the lint handler returns.

Parameters
ParsoidExtensionAPI$extApi
Element$rootNodeExtension content's root node
callable$defaultHandlerDefault lint handler
  • Default lint handler has signature $defaultHandler( Element $elt ): void
Returns
Node|null|false Return false to indicate that this extension has no special lint handler (the default lint handler will be used. Return null to indicate linting should proceed with the next sibling. (Deprecated) A Node can be returned to indicate the point in the tree where linting should resume.

Reimplemented from Wikimedia\Parsoid\Ext\ExtensionTagHandler.

◆ processRefs()

static Wikimedia\Parsoid\Ext\Cite\References::processRefs ( ParsoidExtensionAPI $extApi,
ReferencesData $refsData,
Node $node )
static
Parameters
ParsoidExtensionAPI$extApi
ReferencesData$refsData
Node$node

◆ sourceToDom()

Wikimedia\Parsoid\Ext\Cite\References::sourceToDom ( ParsoidExtensionAPI $extApi,
string $txt,
array $extArgs )

Convert an extension tag's content to DOM.

Parameters
ParsoidExtensionAPI$extApi
string$srcExtension tag content
array$extArgsExtension 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

Reimplemented from Wikimedia\Parsoid\Ext\ExtensionTagHandler.


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