Page MenuHomePhabricator

Generated TOC does not match the hierarchy of sections created by <h1> tags
Closed, ResolvedPublic

Description

When a Header is created with a code like
<h1>Header 1</h1>
it shows correctly, but the same doesn't happens when we use
<h1>Header 2
</h1>
(with a line break before the closing tag)

See for example this link:
http://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&oldid=359875876#toctitle

Helder


Version: 1.21.x
Severity: normal
URL: http://en.wikipedia.org/w/index.php?title=Wikipedia:Sandbox&oldid=359875876#toctitle

Details

Reference
bz23393

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:06 PM
bzimport set Reference to bz23393.

Still happening. It is actually not displayed in the TOC at all.

This is probably caused by the regex used to match headings in Parser.php:

/<H(?P<level>[1-6])(?P<attrib>.*?'.'>)(?P<header>.*?)<\/H[1-6] *>/i

The dot in '.*?' will match all characters except a newline. It should be changed to [\s\S], or we could add a 's' at the end.

This patch adds an entry to RELEASE-NOTES-1.21 yet is not on the REL1_21 branch. Should it be backported?

(In reply to comment #4)

This patch adds an entry to RELEASE-NOTES-1.21 yet is not on the REL1_21
branch.

Patch for this and other errors in the release notes appreciated. :)

(In reply to comment #5)

(In reply to comment #4)

This patch adds an entry to RELEASE-NOTES-1.21 yet is not on the REL1_21
branch.

Patch for this and other errors in the release notes appreciated. :)

I'll upload a patch for this soon (and will post the link here). I just wanted someone to confirm that it is an error first :)

Related URL: https://gerrit.wikimedia.org/r/59620 (Gerrit Change I6a51e3ee07fe7622b9c708c78563795d7a1118fc)