MediaWiki
1.28.0
|
The list of active formatting elements, which is used to handle mis-nested formatting element tags in the HTML5 tree builder specification. More...
Public Member Functions | |
__destruct () | |
__toString () | |
Get a string representation of the AFE list, for debugging. More... | |
clearToMarker () | |
Follow the steps required when the spec asks us to "clear the list of
active formatting elements up to the last marker". More... | |
findElementByTag ($tag) | |
Find and return the last element with the specified tag between the end of the list and the last marker on the list. More... | |
insertAfter (BalanceElement $a, BalanceElement $b) | |
Find $a in the list and insert $b after it. More... | |
insertMarker () | |
isInList (BalanceElement $elt) | |
Determine whether an element is in the list of formatting elements. More... | |
push (BalanceElement $elt) | |
Follow the steps required when the spec requires us to "push onto the
list of active formatting elements". More... | |
reconstruct ($stack) | |
Reconstruct the active formatting elements. More... | |
remove (BalanceElement $elt) | |
Find the element $elt in the list and remove it. More... | |
replace (BalanceElement $a, BalanceElement $b) | |
Find element $a in the list and replace it with element $b. More... | |
Private Member Functions | |
addToNoahList (BalanceElement $elt) | |
removeFromNoahList (BalanceElement $elt) | |
Private Attributes | |
$head | |
The first (least recent) element in the list. More... | |
$noahTableStack = [ [] ] | |
An array of arrays representing the population of elements in each bucket according to the Noah's Ark clause. More... | |
$tail | |
The last (most recent) element in the list. More... | |
The list of active formatting elements, which is used to handle mis-nested formatting element tags in the HTML5 tree builder specification.
Definition at line 1385 of file Balancer.php.
MediaWiki\Tidy\BalanceActiveFormattingElements::__destruct | ( | ) |
Definition at line 1412 of file Balancer.php.
MediaWiki\Tidy\BalanceActiveFormattingElements::__toString | ( | ) |
Get a string representation of the AFE list, for debugging.
Definition at line 1715 of file Balancer.php.
References $s.
|
private |
Definition at line 1566 of file Balancer.php.
References MediaWiki\Tidy\BalanceActiveFormattingElements\$tail, and MediaWiki\Tidy\BalanceElement\getNoahKey().
Referenced by MediaWiki\Tidy\BalanceActiveFormattingElements\insertAfter(), and MediaWiki\Tidy\BalanceActiveFormattingElements\replace().
MediaWiki\Tidy\BalanceActiveFormattingElements::clearToMarker | ( | ) |
Follow the steps required when the spec asks us to "clear the list of active formatting elements up to the last marker".
Definition at line 1477 of file Balancer.php.
References MediaWiki\Tidy\BalanceActiveFormattingElements\$tail.
MediaWiki\Tidy\BalanceActiveFormattingElements::findElementByTag | ( | $tag | ) |
Find and return the last element with the specified tag between the end of the list and the last marker on the list.
Used when parsing <a> "in body mode".
Definition at line 1514 of file Balancer.php.
References $tag, and MediaWiki\Tidy\BalanceActiveFormattingElements\$tail.
MediaWiki\Tidy\BalanceActiveFormattingElements::insertAfter | ( | BalanceElement | $a, |
BalanceElement | $b | ||
) |
Find $a in the list and insert $b after it.
BalanceElement | $a | |
BalanceElement | $b |
Definition at line 1645 of file Balancer.php.
References MediaWiki\Tidy\BalanceActiveFormattingElements\addToNoahList().
MediaWiki\Tidy\BalanceActiveFormattingElements::insertMarker | ( | ) |
Definition at line 1420 of file Balancer.php.
References MediaWiki\Tidy\BalanceActiveFormattingElements\$tail.
MediaWiki\Tidy\BalanceActiveFormattingElements::isInList | ( | BalanceElement | $elt | ) |
Determine whether an element is in the list of formatting elements.
BalanceElement | $elt |
Definition at line 1530 of file Balancer.php.
MediaWiki\Tidy\BalanceActiveFormattingElements::push | ( | BalanceElement | $elt | ) |
Follow the steps required when the spec requires us to "push onto the list of active formatting elements".
BalanceElement | $elt |
Definition at line 1437 of file Balancer.php.
References $count, MediaWiki\Tidy\BalanceActiveFormattingElements\$head, MediaWiki\Tidy\BalanceActiveFormattingElements\$tail, and MediaWiki\Tidy\BalanceElement\getNoahKey().
MediaWiki\Tidy\BalanceActiveFormattingElements::reconstruct | ( | $stack | ) |
Reconstruct the active formatting elements.
BalanceStack | $stack | The open elements stack |
Definition at line 1669 of file Balancer.php.
References MediaWiki\Tidy\BalanceActiveFormattingElements\$tail, and MediaWiki\Tidy\BalanceActiveFormattingElements\replace().
MediaWiki\Tidy\BalanceActiveFormattingElements::remove | ( | BalanceElement | $elt | ) |
Find the element $elt in the list and remove it.
Used when parsing <a> in body mode.
BalanceElement | $elt |
Definition at line 1540 of file Balancer.php.
References MediaWiki\Tidy\BalanceActiveFormattingElements\removeFromNoahList().
|
private |
Definition at line 1580 of file Balancer.php.
References MediaWiki\Tidy\BalanceElement\getNoahKey().
Referenced by MediaWiki\Tidy\BalanceActiveFormattingElements\remove(), and MediaWiki\Tidy\BalanceActiveFormattingElements\replace().
MediaWiki\Tidy\BalanceActiveFormattingElements::replace | ( | BalanceElement | $a, |
BalanceElement | $b | ||
) |
Find element $a in the list and replace it with element $b.
BalanceElement | $a | |
BalanceElement | $b |
Definition at line 1611 of file Balancer.php.
References MediaWiki\Tidy\BalanceActiveFormattingElements\addToNoahList(), and MediaWiki\Tidy\BalanceActiveFormattingElements\removeFromNoahList().
Referenced by MediaWiki\Tidy\BalanceActiveFormattingElements\reconstruct().
|
private |
The first (least recent) element in the list.
Definition at line 1390 of file Balancer.php.
Referenced by MediaWiki\Tidy\BalanceActiveFormattingElements\push().
|
private |
An array of arrays representing the population of elements in each bucket according to the Noah's Ark clause.
The outer array is stack-like, with each integer-indexed element representing a segment of the list, bounded by markers. The first element represents the segment of the list before the first marker.
The inner arrays are indexed by "Noah key", which is a string which uniquely identifies each bucket according to the rules in the spec. The value in the inner array is the first (least recently inserted) element in the bucket, and subsequent members of the bucket can be found by iterating through the singly-linked list via $node->nextNoah.
This is optimised for the most common case of inserting into a bucket with zero members, and deleting a bucket containing one member. In the worst case, iteration through the list is still O(1) in the document size, since each bucket can have at most 3 members.
Definition at line 1410 of file Balancer.php.
|
private |
The last (most recent) element in the list.
Definition at line 1387 of file Balancer.php.
Referenced by MediaWiki\Tidy\BalanceActiveFormattingElements\addToNoahList(), MediaWiki\Tidy\BalanceActiveFormattingElements\clearToMarker(), MediaWiki\Tidy\BalanceActiveFormattingElements\findElementByTag(), MediaWiki\Tidy\BalanceActiveFormattingElements\insertMarker(), MediaWiki\Tidy\BalanceActiveFormattingElements\push(), and MediaWiki\Tidy\BalanceActiveFormattingElements\reconstruct().