Parsoid
A bidirectional parser between wikitext and HTML5
|
Provides DOMTraverser visitors that fix template-induced interrupted table cell parsing by recombining table cells and/or reparsing table cell content as attributes. More...
Public Member Functions | |
__construct (Env $env) | |
stripDoubleTDs (Element $node, Frame $frame) | |
DOM visitor that strips the double td for this test case: | |
reparseTemplatedAttributes (Frame $frame, Element $cell, ?Element $templateWrapper) | |
T46498, second part of T52603. | |
Provides DOMTraverser visitors that fix template-induced interrupted table cell parsing by recombining table cells and/or reparsing table cell content as attributes.
Wikimedia\Parsoid\Wt2Html\PP\Handlers\TableFixups::__construct | ( | Env | $env | ) |
Set up some helper objects for reparseTemplatedAttributes
Actually the regular tokenizer, but we'll use tokenizeTableCellAttributes only.
Wikimedia\Parsoid\Wt2Html\PP\Handlers\TableFixups::reparseTemplatedAttributes | ( | Frame | $frame, |
Element | $cell, | ||
?Element | $templateWrapper ) |
T46498, second part of T52603.
Handle wikitext like
where nom expands to style="foo" class="bar"|Bar
. The attributes are tokenized and stripped from the table contents.
This method works well for the templates documented in https://en.wikipedia.org/wiki/Template:Table_cell_templates/doc
Nevertheless, there are some limitations:
Frame | $frame | |
Element | $cell | known to be |
/
?Element | $templateWrapper |
FIXME: These checks are insufficient. Previous rounds of table fixups might have created this cell without any templated content (the while loop in handleTableCellTemplates). Till we figure out a reliable test for this, we'll reparse attributes always.
// This DOM pass is trying to bridge broken parses across // template boundaries. so, if templates aren't involved, // no reason to reparse. if ( count( $attributishContent['transclusions'] ) === 0 && !WTUtils::fromEncapsulatedContent( $cell ) ) { return; }
DOM visitor that strips the double td for this test case:
Element | $node | |
Frame | $frame |