Page MenuHomePhabricator

Please add an error if italic is used outside and inside of an external link
Open, LowPublic

Description

Often you see wikicode like the following line:

Some text ''[http://example.com more text ''quoted text'']'' text after

This ends up in the link being splitted into two links, as you can see in https://de.wikipedia.beta.wmflabs.org/wiki/Splitted_Link

I think this is an errorness use of the wikisyntax and should cause a linter-error

Event Timeline

Arlolra moved this task from Backlog to New Linters on the MediaWiki-extensions-Linter board.
Arlolra subscribed.

The legacy parser's output,

> echo "Some text ''[http://example.com more text ''quoted text'']'' text after" | php maintenance/parse.php 
<p>Some text <i><a rel="nofollow" class="external text" href="http://example.com">more text </a></i><a rel="nofollow" class="external text" href="http://example.com">quoted text<i></i></a> text after
</p>

vs Parsoid,

> echo "Some text ''[http://example.com more text ''quoted text'']'' text after" | php bin/parse.php
<p data-parsoid='{"dsr":[0,71,0,0]}'>Some text <i data-parsoid='{"dsr":[10,60,2,2]}'><a rel="mw:ExtLink nofollow" href="http://example.com" class="external text" data-parsoid='{"dsr":[12,58,20,1]}'>more text <i data-parsoid='{"dsr":[42,57,2,2]}'>quoted text</i></a></i> text after</p>

because Parsoid parses the link content as an independent dom fragment. As long as the link content is phrasing content, this isn't html spec violation.

But the additional markup is redundant.

This might be difficult to find, since the italics on either side of the URL may be marking up text that is outside of the link.

In any event, it looks like this markup is not invalid, so this task should probably be closed. We could use something like CheckWiki to look for instances of this redundant markup.