Page MenuHomePhabricator

Unsupported use of multi-cell generating templates within tables
Closed, ResolvedPublic0 Story Points

Description

There are two ways in which Parsoid trips on templates that cause a wikitext construct to be split across top-level-content and templates.

  • In one form, the first part of the construct swallows the other part of the construct into its attributes. But in addition, it also swallows following tokens/content as well. The fix is to separate the two and move that other content out back to the top level. (T48811 is an example of this)
  • In another form, the construct is split between two adjacent tokens. The fix is to bring content together across tokens / DOM nodes (T69857, T69850, T52603, T46498)

Both these forms affect tables. The first form is seen when a template is used in the table-attribute (and possibly table-row-attribute) position. The second form is seen when a template is used in table-cell-attribute position. The reason why we these two different manifestations of the same problem is because of the peculiarities of how the table-opening-tag and table-cell-tags are tokenized and what the tokenizer can assume about transclusions.

The second form is addressed by the code in dom.t.TableFixups.js where the DOM is examined to bring together the split pieces. However, so far, it only supports templates that generates attributes of a table-cell and a single following table cell. But, we now need to generalize this support to support multiple table-cells being generated by these templates to cover the last of the big unsupported scenarios.

Example wikitext for it is:

{|
|{{convert| 400|m|ft|disp=table|sortable=on}}
|}

This affects enwiki:List_of_largest_container_ships (among possibly other pages). Generalizing the code in dom.t.TableFixups.js should probably take care of this.

The longer term fix for both these issues is to start scoping the output of templates to return DOM-representable strings and split some of these monolithic templates into multiple templates, one that generate just the attribute, and another that return just additional content. This also improves WYSIWYG editability of some of these tables.

Event Timeline

ssastry created this task.Feb 4 2015, 12:06 AM
ssastry raised the priority of this task from to Medium.
ssastry updated the task description. (Show Details)
ssastry added a project: Parsoid.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 4 2015, 12:06 AM
ssastry moved this task from Backlog to VE Q3 on the Parsoid board.Feb 4 2015, 12:07 AM
ssastry updated the task description. (Show Details)
ssastry set Security to None.
ssastry claimed this task.Feb 5 2015, 10:04 PM
ssastry updated the task description. (Show Details)Feb 5 2015, 10:29 PM
gerritbot added a subscriber: gerritbot.

Change 189642 had a related patch set uploaded (by Subramanya Sastry):
WIP: T88495: Part 1 of 2: Handle more attribute td-attr scenarios

https://gerrit.wikimedia.org/r/189642

Patch-For-Review

Change 189871 had a related patch set uploaded (by Subramanya Sastry):
WIP: T88495: Part 2 of 2: Handle more templated <td>-attr scenarios

https://gerrit.wikimedia.org/r/189871

Patch-For-Review

Change 189642 merged by jenkins-bot:
T88495: Part 1 of 2: Handle more templated <td>-attr scenarios

https://gerrit.wikimedia.org/r/189642

Change 189871 merged by jenkins-bot:
T88495: Part 2 of 2: Handle more templated <td>-attr scenarios

https://gerrit.wikimedia.org/r/189871

ssastry closed this task as Resolved.Feb 23 2015, 9:21 PM
ssastry removed a project: Patch-For-Review.