Last modified: 2012-10-21 19:12:42 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 T37167, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 35167 - <span dir="ltr"> in headings is ignored when the heading is shown in table of contents
<span dir="ltr"> in headings is ignored when the heading is shown in table of...
Status: VERIFIED FIXED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Amir E. Aharoni
: i18n
Depends on:
Blocks: rtl
  Show dependency treegraph
 
Reported: 2012-03-12 09:06 UTC by Amir E. Aharoni
Modified: 2012-10-21 19:12 UTC (History)
4 users (show)

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


Attachments

Description Amir E. Aharoni 2012-03-12 09:06:07 UTC
In an RTL Wikipedia a heading like "==<span dir="ltr">C++</span>==" shows correctly as a heading in the text flow, but it is shown as "++C" in the table of contents, because the <span> tag is omitted and an RTL direction is assumed.

Not all HTML is omitted - a heading like "==E = mc<sup>2</sup>==" shows correctly both in the heading and in the table of contents.
Comment 1 Dan Collins 2012-03-14 19:19:44 UTC
Confirmed on 1.19wmf1. From the parser:

    $tocline = preg_replace(
        array( '#<(?!/?(sup|sub|i|b)(?: [^>]*)?>).*?'.'>#', '#<(/?(sup|sub|i|b))(?: .*?)?'.'>#' ),
        array( '',                          '<$1>' ),
        $safeHeadline
    );

Those regexen are rather ugly, but let's see if we can't add a very limited allowance for span:

    $tocline = preg_replace(
        array( '#<(?!/?(sup|sub|i|b|span dir="ltr")(?: [^>]*)?>).*?'.'>#', '#<(/?(sup|sub|i|b|span dir="ltr"))(?: .*?)?'.'>#' ),
        array( '',                          '<$1>' ),
        $safeHeadline
    );

But I have to ask - someone went through the effort of not having a ?> in that regex in two different places, and then left a ?> in another place, and I notice that the world hasn't exploded.
Comment 2 matanya 2012-07-25 13:32:06 UTC
This is still an issue. not critical, but annoying.
Comment 3 Amir E. Aharoni 2012-09-03 09:14:43 UTC
Thank you for the tip, Dan.

Proposed fix submitted in https://gerrit.wikimedia.org/r/#/c/22435/ . I'm working on tests for it.
Comment 4 Amir E. Aharoni 2012-09-04 13:40:21 UTC
Patch improved and tests added. Thank to anybody who can review it.
Comment 5 Amir E. Aharoni 2012-10-21 19:11:25 UTC
Deployed :)

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


Navigation
Links