Parser: Avoid producing <span></span> in the TOC
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 15 Apr 2015 17:44:28 +0000 (13:44 -0400)
committerUmherirrender <umherirrender_de.wp@web.de>
Wed, 8 Jul 2015 17:11:21 +0000 (17:11 +0000)
commit359e77d7c9cb44b46cc712fbdd9cb97460ef3ff8
tree5a399781929d0bd873144293c612e879ff2c72c7
parent7b4e7c1fb503a7f95d58a2aa729a5ef563e1caa8
Parser: Avoid producing <span></span> in the TOC

If someone renames a section but wants old targeted links to still work,
<span id="old-anchor"></span> is the usual solution. And sometimes
people put it inside the section header markup, like

 == <span id="old-anchor"></span>New name ==

since putting it before makes it be considered part of the previous section
while putting it after causes the browser to scroll the section header
off the screen.

But this has the unfortunate side effect that the TOC text for that
section will be "<span></span>New name". We should strip that useless
empty span.

Bug: T96153
Change-Id: I47a33ceb79d48f6d0c38fa3b3814a378feb5e31e
includes/parser/Parser.php
tests/parser/parserTests.txt