mediawiki.jqueryMsg: Support arbitrary expressions in plural forms
authorSanthosh Thottingal <santhosh.thottingal@gmail.com>
Sun, 28 Sep 2014 09:01:46 +0000 (14:31 +0530)
committerSanthosh Thottingal <santhosh.thottingal@gmail.com>
Wed, 1 Oct 2014 04:00:58 +0000 (09:30 +0530)
commitfd6ec11a54e622b0631d530d8289ee0789e993c9
treecd5ea310ca7cc348d1ae281ddb07b0b7a5d7f70b
parent132b00a604408206005230fa7847e7ddebdaa652
mediawiki.jqueryMsg: Support arbitrary expressions in plural forms

In I15c167f245 mw.jqueryMsg.htmlEmitter#plural was modified to
convert the plural params to flat html. This caused extlink params
as plural forms expanded as text node and escaped.

This patch improves the plural support by:
* Allowing valid parser expressions as plural form parameters. They wont
  be converted to html, parsed nodes will be preserved in plural
  calculation
* For explicit plural forms like n=expression, the expression can be any
  valid parser expression. They also will not be coverted to html,
  nodes will be preserved
* Move the splitting by equal sign logic for explicit plural forms to
  jqueryMsg, avoiding mediawiki.language#convertPlural to do
  parsing logc. Explicit plural forms, if any, are passed as a parameter
  to mediawiki.language#convertPlural

Includes test cases for all combinations of the above cases.

mediawiki.jqueryMsg.peg can be improved to support digit=expression as an
additional form for templateParam to better handle this. But it looks
it can potentially disturb other parser functions. Not attempted.

Bug: 70617
Change-Id: I3c3cbb6d3676903941c40b658032b4c543556e06
resources/src/mediawiki.language/mediawiki.language.js
resources/src/mediawiki/mediawiki.jqueryMsg.js
tests/qunit/suites/resources/mediawiki/mediawiki.jqueryMsg.test.js