ILIAS
eassessment Revision 61809
|
Injector that auto paragraphs text in the root node based on double-spacing. More...
Public Member Functions | |
handleText (&$token) | |
Handler that is called when a text token is processed. | |
handleElement (&$token) | |
Handler that is called when a start or empty token is processed. | |
Public Member Functions inherited from HTMLPurifier_Injector | |
rewind ($index) | |
Rewind to a spot to re-perform processing. | |
getRewind () | |
Retrieves rewind, and then unsets it. | |
prepare ($config, $context) | |
Prepares the injector by giving it the config and context objects: this allows references to important variables to be made within the injector. | |
checkNeeded ($config) | |
This function checks if the HTML environment will work with the Injector: if p tags are not allowed, the Auto-Paragraphing injector should not be enabled. | |
allowsElement ($name) | |
Tests if the context node allows a certain element. | |
handleEnd (&$token) | |
Handler that is called when an end token is processed. | |
notifyEnd ($token) | |
Notifier that is called when an end token is processed. |
Data Fields | |
$name = 'AutoParagraph' | |
$needed = array('p') | |
Data Fields inherited from HTMLPurifier_Injector | |
$name | |
Advisory name of injector, this is for friendly error messages. | |
$needed = array() | |
Array of elements and attributes this injector creates and therefore need to be allowed by the definition. |
Private Member Functions | |
_pStart () | |
_splitText ($data, &$result) | |
Splits up a text in paragraph tokens and appends them to the result stream that will replace the original. | |
_isInline ($token) | |
Returns true if passed token is inline (and, ergo, allowed in paragraph tags) | |
_pLookAhead () | |
Looks ahead in the token list and determines whether or not we need to insert a. | |
_checkNeedsP ($current) | |
Determines if a particular token requires an earlier inline token to get a paragraph. |
Additional Inherited Members | |
Protected Member Functions inherited from HTMLPurifier_Injector | |
forward (&$i, &$current) | |
Iterator function, which starts with the next token and continues until you reach the end of the input tokens. | |
forwardUntilEndToken (&$i, &$current, &$nesting) | |
Similar to _forward, but accepts a third parameter $nesting (which should be initialized at 0) and stops when we hit the end tag for the node $this->inputIndex starts in. | |
backward (&$i, &$current) | |
Iterator function, starts with the previous token and continues until you reach the beginning of input tokens. | |
current (&$i, &$current) | |
Initializes the iterator at the current position. | |
Protected Attributes inherited from HTMLPurifier_Injector | |
$htmlDefinition | |
Instance of HTMLPurifier_HTMLDefinition. | |
$currentNesting | |
Reference to CurrentNesting variable in Context. | |
$inputTokens | |
Reference to InputTokens variable in Context. | |
$inputIndex | |
Reference to InputIndex variable in Context. | |
$rewind = false | |
Index of inputTokens to rewind to. |
Injector that auto paragraphs text in the root node based on double-spacing.
Ensure all states are unit tested, including variations as well.
Make a graph of the flow control for this Injector.
Definition at line 9 of file AutoParagraph.php.
|
private |
Determines if a particular token requires an earlier inline token to get a paragraph.
This should be used with _forwardUntilEndToken
Definition at line 317 of file AutoParagraph.php.
References _isInline().
Referenced by _pLookAhead().
|
private |
Returns true if passed token is inline (and, ergo, allowed in paragraph tags)
Definition at line 290 of file AutoParagraph.php.
Referenced by _checkNeedsP(), and handleElement().
|
private |
Looks ahead in the token list and determines whether or not we need to insert a.
tag.
Definition at line 298 of file AutoParagraph.php.
References $ok, _checkNeedsP(), HTMLPurifier_Injector\current(), and HTMLPurifier_Injector\forwardUntilEndToken().
Referenced by handleElement(), and handleText().
|
private |
Definition at line 15 of file AutoParagraph.php.
Referenced by _splitText(), handleElement(), and handleText().
|
private |
Splits up a text in paragraph tokens and appends them to the result stream that will replace the original.
$data | String text data that will be processed into paragraphs |
$result | Reference to array of tokens that the tags will be appended onto |
$config | Instance of HTMLPurifier_Config |
$context | Instance of HTMLPurifier_Context |
Definition at line 206 of file AutoParagraph.php.
References $data, and _pStart().
Referenced by handleText().
HTMLPurifier_Injector_AutoParagraph::handleElement | ( | & | $token | ) |
Handler that is called when a start or empty token is processed.
Reimplemented from HTMLPurifier_Injector.
Definition at line 92 of file AutoParagraph.php.
References _isInline(), _pLookAhead(), _pStart(), HTMLPurifier_Injector\allowsElement(), and HTMLPurifier_Injector\backward().
HTMLPurifier_Injector_AutoParagraph::handleText | ( | & | $token | ) |
Handler that is called when a text token is processed.
Reimplemented from HTMLPurifier_Injector.
Definition at line 21 of file AutoParagraph.php.
References _pLookAhead(), _pStart(), _splitText(), HTMLPurifier_Injector\allowsElement(), and HTMLPurifier_Injector\forwardUntilEndToken().
HTMLPurifier_Injector_AutoParagraph::$name = 'AutoParagraph' |
Definition at line 12 of file AutoParagraph.php.
HTMLPurifier_Injector_AutoParagraph::$needed = array('p') |
Definition at line 13 of file AutoParagraph.php.