https://bugzilla.wikimedia.org/show_bug.cgi?id=21946
Summary: Sorted wikitables do not properly handle minus signs
Product: MediaWiki
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: minor
Priority: Normal
Component: Page rendering
AssignedTo: [email protected]
ReportedBy: [email protected]
Sorted wikitables of type currency do not recognize minus signs. In
wikibits.js, ts_currencyToSortKey could be changed from
return ts_parseFloat(s.replace(/[^0-9.,]/g,''));
to
return ts_parseFloat(s.replace(/[^-0-9.,]/g,''));
and this would half-fix the problem. But it does not fully fix the problem,
because this recognizes the hyphen, -, but not the HTML minus sign, −.
Columns of type numeric do not recognize minus signs, either. An example of the
latter bug can be viewed at:
http://en.wikipedia.org/w/index.php?title=Wikipedia:Arbitration_Committee_Elections_December_2009&diff=prev&oldid=332579916
(Broken sort using minus signs)
ttp://en.wikipedia.org/w/index.php?title=Wikipedia:Arbitration_Committee_Elections_December_2009&diff=next&oldid=332579916
(Working sort using hyphens)
Sorting on minus signs in columns of type numeric could be fixed by going to
ts_parseFloat and changing
num = parseFloat(s.replace(/,/g, ""));
to
num = parseFloat(s.replace(/,/g, "")).replace(/−/gi,
"-").replace(/&(?:minus|#x0*2212|#0*8722);/gi, "-")
which would convert HTML minus signs to hyphens before attempting to parse the
number; but this would not handle minus signs in currency values, because they
would be removed by ts_currencyToSortKey before ts_parseFloat is called.
A more comprehensive solution to this is to substitute characters for entity
references in ts_resortTable before the preprocessor is called (or maybe even
before the preprocessor is chosen). To fix the bugs with minus signs it would
suffice to convert minus sign references as above, but it may be desirable to
convert all entity references.
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l