Page MenuHomePhabricator

Entering a single '-' character in a table results in a new row
Closed, ResolvedPublic0 Estimated Story Points

Description

Entering the character - in a table cell results in the sequence |- which makes a new row, visible after saving (dirty round trip)

Event Timeline

Martijn_Hoekstra raised the priority of this task from to Needs Triage.
Martijn_Hoekstra updated the task description. (Show Details)
Martijn_Hoekstra subscribed.
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Can you provide an example where this happens? A test page or a diff?

https://en.wikipedia.org/w/index.php?title=User%3ASSastry_%28WMF%29%2FVE_Test&diff=645371170&oldid=645370967 shows that Parsoid does the right thing.

my edit went from empty to - maybe that makes a difference?

ssastry triaged this task as Medium priority.Feb 4 2015, 12:16 AM
ssastry set Security to None.

Thank you. We should be able to reproduce this with a test case and fix this now.

See T88148, for an instance of the opposite problem.

We should really emit | - (note the space) when <td> contents start with a dash.

Reproduced the bug with https://en.wikipedia.org/w/index.php?title=User%3ACscott%2Ftask88318&diff=649898905&oldid=649898024
But it only applies to the first instance of - in the table cell, which is weird.

Ah ha!

$ echo '<table><tr><td>-</td><td>- </td><td>-<p></p></td><td><p>-</p></td><tr><p>- </p></td></tr></table>' | tests/parse.js --html2wt
{|
|<nowiki>-</nowiki>
|<nowiki>- </nowiki>
|<nowiki>-</nowiki>
|-
|-
|}

If you type "-" followed by space you get <p>- </p> -- I think you can get the <p>-</p> (no space) by typing a trailing space and then deleting it.

In any case, the <p>-wrapped - is what's causing the bug here.

Change 194541 had a related patch set uploaded (by Cscott):
WIP: T88318: Fix serialization of <p>-wrapped dash within <td>.

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

Change 194541 merged by jenkins-bot:
T88318: Fix serialization of <p>-wrapped dash within <td>.

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

Yes, once @cscott fixes the regression i found for him :)

Looks like there was a regression:
http://parsoid-tests.wikimedia.org/resultFlagNew/eaa9d1984b407ff2919669ec955af42600ad89e0/ab1a78ceba524c354208940ce49f33d7fa15c6a2/jawiki/%E3%83%8B%E3%82%B3%E3%83%BB%E3%83%AD%E3%82%BA%E3%83%99%E3%83%AB%E3%82%B0

| [[2015年オーストラリアグランプリ|AUS]]<br /><small>-</small>

went to

| [[2015年オーストラリアグランプリ|AUS]]<br /><small><nowiki>-</nowiki></small>

Looks like the "first child" test isn't strong enough/working.

[subbu@earth tests] echo "<table><td><small>-</small></td></table>" | node parse --html2wt
{|
|<small><nowiki>-</nowiki></small>
|}

From subbu:

subbu: same with http://parsoid-tests.wikimedia.org/resultFlagNew/eaa9d1984b407ff2919669ec955af42600ad89e0/ab1a78ceba524c354208940ce49f33d7fa15c6a2/plwiki/Petric%C4%83_Hogiu
subbu: you need to tweak the nowiki fix .. 
subbu: [subbu@earth tests] echo "<table><td><small>-</small></td></table>" | node parse --html2wt
subbu: {|
subbu: |<small><nowiki>-</nowiki></small>
subbu: |}

Change 195816 had a related patch set uploaded (by Cscott):
T88318: Fix regression in <nowiki> behavior with nested - in <td>.

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

Change 195816 merged by jenkins-bot:
T88318: Fix regression in <nowiki> behavior with nested - in <td>.

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