Parsoid
A bidirectional parser between wikitext and HTML5
|
DOM normalization. More...
Public Member Functions | |
__construct (SerializerState $state) | |
addDiffMarks (Node $node, string $mark, bool $dontRecurse=false) | |
merge (Element $a, Element $b) | |
Transfer all of b's children to a and delete b. | |
swap (Element $a, Element $b) | |
b is a's sole non-deleted child. | |
hoistLinks (Element $node, bool $rtl) | |
stripIfEmpty (Element $node) | |
moveTrailingSpacesOut (Node $node) | |
stripBRs (Element $node) | |
stripBidiCharsAroundCategories (Node $node) | |
FIXME see https://gerrit.wikimedia.org/r/#/c/mediawiki/services/parsoid/+/500975/7/src/Html2Wt/DOMNormalizer.php@423. | |
moveFormatTagOutsideATag (Element $node) | |
When an A tag is encountered, if there are format tags inside, move them outside Also merge a single sibling A tag that is mergable The link href and text must match for this normalization to take effect. | |
normalizeNode (Node $node) | |
Wikitext normalizations implemented right now: | |
normalizeSiblingPair (Node $a, Node $b) | |
processSubtree (Node $node, bool $recurse) | |
processNode (Node $node, bool $recurse) | |
normalize (Node $node) | |
DOM normalization.
DOM normalizations are performed after DOMDiff is run. So, normalization routines should update diff markers appropriately.
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::__construct | ( | SerializerState | $state | ) |
SerializerState | $state |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::addDiffMarks | ( | Node | $node, |
string | $mark, | ||
bool | $dontRecurse = false ) |
Node | $node | |
string | $mark | |
bool | $dontRecurse |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::hoistLinks | ( | Element | $node, |
bool | $rtl ) |
Element | $node | |
bool | $rtl |
Transfer all of b's children to a and delete b.
Element | $a | |
Element | $b |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::moveFormatTagOutsideATag | ( | Element | $node | ) |
When an A tag is encountered, if there are format tags inside, move them outside Also merge a single sibling A tag that is mergable The link href and text must match for this normalization to take effect.
Element | $node |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::moveTrailingSpacesOut | ( | Node | $node | ) |
Node | $node |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::normalize | ( | Node | $node | ) |
Element | DocumentFragment | $node |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::normalizeNode | ( | Node | $node | ) |
Wikitext normalizations implemented right now:
The return value from this function should respect the following contract:
Node | $node |
Node | $a | |
Node | $b |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::processNode | ( | Node | $node, |
bool | $recurse ) |
Node | $node | |
bool | $recurse |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::processSubtree | ( | Node | $node, |
bool | $recurse ) |
Node | $node | |
bool | $recurse |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::stripBidiCharsAroundCategories | ( | Node | $node | ) |
Node | $node |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::stripBRs | ( | Element | $node | ) |
Element | $node |
Wikimedia\Parsoid\Html2Wt\DOMNormalizer::stripIfEmpty | ( | Element | $node | ) |
Element | $node |
b is a's sole non-deleted child.
Switch them around.
Element | $a | |
Element | $b |