Parsoid
A bidirectional parser between wikitext and HTML5
|
Insert paragraph tags where needed – smartly and carefully – there is much fun to be had mimicking "wikitext visual newlines" behavior as implemented by the PHP parser. More...
Public Member Functions | ||||
__construct (TokenTransformManager $manager, array $options) | ||||
Constructor for paragraph wrapper. | ||||
onNewline (NlTk $token) | ||||
This handler is called for newline tokens only.
| ||||
onEnd (EOFTk $token) | ||||
This handler is called for EOF tokens only.
| ||||
processOneNlTk (array &$out, &$offset) | ||||
Append tokens from the newline/whitespace buffer to the output array until a newline is encountered. | ||||
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).
| ||||
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? | ||||
onTag (Token $token) | ||||
This handler is called for tokens that are not EOFTk or NLTk tokens. | ||||
process ( $tokens) | ||||
Push an input array of tokens through the transformer and return the transformed tokens. | ||||
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 | |
Insert paragraph tags where needed – smartly and carefully – there is much fun to be had mimicking "wikitext visual newlines" behavior as implemented by the PHP parser.
Wikimedia\Parsoid\Wt2Html\TT\ParagraphWrapper::__construct | ( | TokenTransformManager | $manager, |
array | $options ) |
Constructor for paragraph wrapper.
TokenTransformManager | $manager | manager enviroment |
array | $options | various configuration options |
Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenHandler.
Wikimedia\Parsoid\Wt2Html\TT\ParagraphWrapper::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).
Token | string | $token | Token to be processed |
Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenHandler.
Wikimedia\Parsoid\Wt2Html\TT\ParagraphWrapper::onEnd | ( | EOFTk | $token | ) |
This handler is called for EOF tokens only.
EOFTk | $token | EOF token to be processed |
Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenHandler.
Wikimedia\Parsoid\Wt2Html\TT\ParagraphWrapper::onNewline | ( | NlTk | $token | ) |
This handler is called for newline tokens only.
NlTk | $token | Newline token to be processed |
Reimplemented from Wikimedia\Parsoid\Wt2Html\TT\TokenHandler.
Wikimedia\Parsoid\Wt2Html\TT\ParagraphWrapper::processOneNlTk | ( | array & | $out, |
& | $offset ) |
Append tokens from the newline/whitespace buffer to the output array until a newline is encountered.
Increment the offset reference. Return the newline token.
array | &$out | array to append to |
int | &$offset | The offset reference to update |