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

Public Member Functions

 __construct (TokenTransformManager $manager, array $options)
 
 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.
 
 onTag (Token $token)
 This handler is called for tokens that are not EOFTk or NLTk tokens.
 
 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.
 

Protected Attributes

 $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()

Member Function Documentation

◆ isDisabled()

Wikimedia\Parsoid\Wt2Html\TT\TokenHandler::isDisabled ( )

Is this transformer disabled?

Returns
bool

Reimplemented in Wikimedia\Parsoid\Wt2Html\TT\TraceProxy.

◆ onAny()

Wikimedia\Parsoid\Wt2Html\TT\TokenHandler::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.

(c) this handlers 'active' flag is set to false (can be set by any of the handlers).

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

Reimplemented in Wikimedia\Parsoid\Wt2Html\TT\AttributeExpander, Wikimedia\Parsoid\Wt2Html\TT\ListHandler, Wikimedia\Parsoid\Wt2Html\TT\OnlyInclude, Wikimedia\Parsoid\Wt2Html\TT\ParagraphWrapper, Wikimedia\Parsoid\Wt2Html\TT\PreHandler, Wikimedia\Parsoid\Wt2Html\TT\QuoteTransformer, Wikimedia\Parsoid\Wt2Html\TT\SanitizerHandler, Wikimedia\Parsoid\Wt2Html\TT\TokenStreamPatcher, and Wikimedia\Parsoid\Wt2Html\TT\TraceProxy.

◆ onEnd()

Wikimedia\Parsoid\Wt2Html\TT\TokenHandler::onEnd ( EOFTk $token)

This handler is called for EOF tokens only.

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

Reimplemented in Wikimedia\Parsoid\Wt2Html\TT\ListHandler, Wikimedia\Parsoid\Wt2Html\TT\ParagraphWrapper, Wikimedia\Parsoid\Wt2Html\TT\PreHandler, Wikimedia\Parsoid\Wt2Html\TT\QuoteTransformer, Wikimedia\Parsoid\Wt2Html\TT\TokenStreamPatcher, and Wikimedia\Parsoid\Wt2Html\TT\TraceProxy.

◆ onNewline()

Wikimedia\Parsoid\Wt2Html\TT\TokenHandler::onNewline ( NlTk $token)

This handler is called for newline tokens only.

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

Reimplemented in Wikimedia\Parsoid\Wt2Html\TT\ParagraphWrapper, Wikimedia\Parsoid\Wt2Html\TT\PreHandler, Wikimedia\Parsoid\Wt2Html\TT\QuoteTransformer, Wikimedia\Parsoid\Wt2Html\TT\TokenStreamPatcher, and Wikimedia\Parsoid\Wt2Html\TT\TraceProxy.

◆ onTag()

Wikimedia\Parsoid\Wt2Html\TT\TokenHandler::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 in Wikimedia\Parsoid\Wt2Html\TT\BehaviorSwitchHandler, Wikimedia\Parsoid\Wt2Html\TT\DOMFragmentBuilder, Wikimedia\Parsoid\Wt2Html\TT\ExtensionHandler, Wikimedia\Parsoid\Wt2Html\TT\ExternalLinkHandler, Wikimedia\Parsoid\Wt2Html\TT\LanguageVariantHandler, Wikimedia\Parsoid\Wt2Html\TT\ListHandler, Wikimedia\Parsoid\Wt2Html\TT\QuoteTransformer, Wikimedia\Parsoid\Wt2Html\TT\TemplateHandler, Wikimedia\Parsoid\Wt2Html\TT\TraceProxy, and Wikimedia\Parsoid\Wt2Html\TT\WikiLinkHandler.

◆ process()

Wikimedia\Parsoid\Wt2Html\TT\TokenHandler::process ( $tokens)

Push an input array of tokens through the transformer and return the transformed tokens.

Parameters
array$tokens
Returns
array

◆ resetState()

Wikimedia\Parsoid\Wt2Html\TT\TokenHandler::resetState ( array $options)

Resets any internal state for this token handler.

Parameters
array$options

Reimplemented in Wikimedia\Parsoid\Wt2Html\TT\TraceProxy, Wikimedia\Parsoid\Wt2Html\TT\PreHandler, and Wikimedia\Parsoid\Wt2Html\TT\TokenStreamPatcher.

Member Data Documentation

◆ $onAnyEnabled

bool Wikimedia\Parsoid\Wt2Html\TT\TokenHandler::$onAnyEnabled = true
protected

This is set/reset by the token handlers at various points in the token stream based on what is encountered.

This only enables/disables the onAny handler.


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