https://bugzilla.wikimedia.org/show_bug.cgi?id=21054

           Summary: formatnum breaks strip markers and wikilinks
           Product: MediaWiki
           Version: 1.16-svn
          Platform: All
               URL: http://en.wikipedia.org/w/api.php?action=expandtemplates
                    &title=foo&text={{formatnum:%3Cnowiki/%3E}}&format=yamlf
                    m
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: General/Unknown
        AssignedTo: [email protected]
        ReportedBy: [email protected]


This stems from a discussion at [[en:WP:VPT#Strange categories due to
.7B.7Bfact.7D.7D tags]].

It seems from the code comments that the formatnum parser function is only
supposed to apply to numeric input, but as written it will happily reformat any
number anywhere in the text input. This easily mangles strip markers (see the
URL above), and also causes issues if someone winds up with a wikilink in the
formatnum input (e.g. "Category:Foo in 2009" becomes "Category:Foo in 2,009",
possibly from something like "1234{{fact|date=April 2008}}" being passed into a
template parameter that is formatnummed).

Possible fixes off the top of my head:
1. formatnum could insist on its input being numeric, and either return the
input unchanged or return an error if not.
2. formatnum could pull off the leading numeric text, and return anything after
the first non-numeric unaltered. E.g. "1234 foo bar 5678" => "1,234 foo bar
5678".
3. The documentation and comments could be updated to define this as the
expected behavior.

In either the first or third cases, a workaround for the enwiki templates would
be to supply both a numeric and a postscript parameter (e.g. instead of
"{{infobox|pop=1234{{fact}}}}", it could be "{{infobox|pop=1234|pop
ref={{fact}}}}").


-- 
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

Reply via email to