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

Public Member Functions

 __construct (TokenTransformManager $manager, array $options)
 
Parameters
TokenTransformManager$managerThe manager for this stage of the parse.
array$optionsAny options for the expander.

 
 onTag (Token $token)
 This handler is called for tokens that are not EOFTk or NLTk tokens.The handler may choose to process only specific kinds of tokens. For example, a list handler may only process 'listitem' TagTk tokens.
Parameters
Token$tokenToken to be processed
Returns
TokenHandlerResult|null A TokenHandlerResult, or null to efficiently indicate that the input token is unchanged.

 
- Public Member Functions inherited from Wikimedia\Parsoid\Wt2Html\TT\TokenHandler
 setPipelineId (int $id)
 
 resetState (array $options)
 Resets any internal state for this token handler.
 
 isDisabled ()
 Is this transformer disabled?
 
 onEnd (EOFTk $token)
 This handler is called for EOF tokens only.
 
 onNewline (NlTk $token)
 This handler is called for newline tokens only.
 
 onAny ( $token)
 This handler is called for all tokens in the token stream except if (a) The more specific handlers above modified the token (b) the more specific handlers (onTag, onEnd, onNewline) have set the skip flag in their return values.
 
 process ( $tokens)
 Push an input array of tokens through the transformer and return the transformed tokens.
 

Static Public Member Functions

static bailTokens (TokenTransformManager $manager, Token $token)
 
static buildLinkAttrs (array $attrs, bool $getLinkText, ?string $rdfaType, ?array $linkAttrs)
 

Additional Inherited Members

- Protected Attributes inherited from Wikimedia\Parsoid\Wt2Html\TT\TokenHandler
 $env
 
 $manager
 
 $pipelineId
 
 $options
 
bool $disabled = false
 This is set if the token handler is disabled for the entire pipeline.
 
bool $onAnyEnabled = true
 This is set/reset by the token handlers at various points in the token stream based on what is encountered.
 
 $atTopLevel = false
 

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Parsoid\Wt2Html\TT\WikiLinkHandler::__construct ( TokenTransformManager $manager,
array $options )

Parameters
TokenTransformManager$managerThe manager for this stage of the parse.
array$optionsAny options for the expander.

Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenHandler.

Member Function Documentation

◆ buildLinkAttrs()

static Wikimedia\Parsoid\Wt2Html\TT\WikiLinkHandler::buildLinkAttrs ( array $attrs,
bool $getLinkText,
?string $rdfaType,
?array $linkAttrs )
static

This (overloaded) function does three different things:

  • Extracts link text from attrs (when k === "mw:maybeContent"). As a performance micro-opt, only does if asked to (getLinkText)
  • Updates existing rdfa type with an additional rdf-type, if one is provided (rdfaType)
  • Collates about, typeof, and linkAttrs into a new attr. array
Parameters
array$attrs
bool$getLinkText
?string$rdfaType
?array$linkAttrs
Returns
array

◆ onTag()

Wikimedia\Parsoid\Wt2Html\TT\WikiLinkHandler::onTag ( Token $token)

This handler is called for tokens that are not EOFTk or NLTk tokens.The handler may choose to process only specific kinds of tokens. For example, a list handler may only process 'listitem' TagTk tokens.

Parameters
Token$tokenToken to be processed
Returns
TokenHandlerResult|null A TokenHandlerResult, or null to efficiently indicate that the input token is unchanged.

Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenHandler.


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