Last modified: 2013-01-15 01:32:03 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T45429, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 43429 - Removing link trail doesn't affect the output
Removing link trail doesn't affect the output
Status: RESOLVED FIXED
Product: Parsoid
Classification: Unclassified
serializer (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Mark Holmquist
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-12-26 19:55 UTC by Mark Holmquist
Modified: 2013-01-15 01:32 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Mark Holmquist 2012-12-26 19:55:06 UTC
In investigating bug 43089, we found that removing a link trail (i.e. [[Link]]s --> [[Link]]) is impossible in the VisualEditor. This is a Parsoid bug, can be reproduced with this command:

echo "[[Link]]s" | node parse.js | sed 's/Links/blah/;' | node parse.js --html2wt

This is a further result of our steadfast approach of "if the tests aren't broken, it's working" -- we didn't consider changes for a long time, and now that changes are possible, our hacks for roundtripping don't always work....

Suggested solution:

1. First try to find the initial link text (sans trail) in the current link text. If it's there, the new trail is whatever is left.

2. If that failed, try to find the old trail in the current text with a regex like /s$/. If you find it, emit it.

3. If both of those fail, don't emit a link trail. The trail has been modified enough that it's probably just within the text of the link now, and we won't lose meaning by just using the [[link|text]] syntax.
Comment 1 ssastry 2012-12-26 20:29:45 UTC
You can replicate this in VisualEditor in fact by removing the trailing 's' when the linked 's' came via a link-trail in the original wikitext.    

We record information about original wikitext in html-attributes.  Recording source information in attributes and using it is not a hack -- it is necessary to preserve original wikitext when it is unmodified (which is going to be more often than not).  We now need to fix our serialization to detect modifications in cases like this where we are currently not.
Comment 2 Mark Holmquist 2012-12-27 18:56:30 UTC
Change I126116de should fix this.
Comment 3 Gabriel Wicke 2013-01-15 01:32:03 UTC
Finally squashed in https://gerrit.wikimedia.org/r/#/c/43985/.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links