Members
tokenizer
Actually the regular tokenizer, but we'll use tokenizeTableCellAttributes only.
Actually the regular tokenizer, but we'll use tokenizeTableCellAttributes only.
Methods
collectAttributishContent()
Collect potential attribute content.
We expect this to be text nodes without a pipe character followed by one or more nowiki spans, followed by a template encapsulation with pure-text and nowiki content. Collection stops when encountering other nodes or a pipe character.
reparseTemplatedAttributes()
Handle wikitext like
{|
|{{nom|Bar}}
|}
where nom expands to style="foo" class="bar"|Bar
.
Handle wikitext like
{|
|{{nom|Bar}}
|}
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:
- We assume that attributes don't contain wiki markup (apart from
) and end up in text or nowiki nodes. - Only a single table cell is produced / opened by the template that contains the attributes. This limitation could be lifted with more aggressive re-parsing if really needed in practice.
- There is only a single transclusion in the table cell content. This limitation can be lifted with more advanced data-mw construction.
stripDoubleTDs()
DOM visitor that strips the double td for this test case:
|{{echo|{{!}} Foo}}
.
DOM visitor that strips the double td for this test case:
|{{echo|{{!}} Foo}}