Page MenuHomePhabricator

Parser should trim the text of internal links
Open, Needs TriagePublic


An internal link coded as [[link ]] will produce an HTML <a> tag that has a trailing space in its output. This is undesirable especially when link text is followed by a non-space character, such as [[link ]], foobar which will have an unnecessary space between the link and the comma. See for demonstration.

For the href part of the <a> tag, Parser correctly trims the input (and doesn't try to link to a page titled link_ in the example above) but for the text of the links, i.e the part that comes between the <a> and </a>, the trailing space is not trimmed.

Of note, if the space is in the beginning (e.g. [[ link]]) parser correctly ignores it both in the href and the text of the link.

Event Timeline

Huji created this task.Sat, Nov 21, 11:19 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSat, Nov 21, 11:19 PM

I am new to use Phabricator. Can you please share the link to the source code of MediaWiki-Parser.

@Nirmos Thank you.

The code is not modularized enough.
6000+ lines of code in a single Parser.php file.

@Niteshyadav585: Hi and welcome, and thanks for your interest! That might be correct, however we'd recommend general high-level discussions to first take place on mailing lists/dedicated tickets instead. This task should be about the parser to trim the text of internal links. Thanks for your understanding! :)