r111629 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111628‎ | r111629 | r111630 >
Date:09:30, 16 February 2012
Author:santhosh
Status:deferred (Comments)
Tags:i18nreview 
Comment:
Add support for templates without replacements in mediawiki.jqueryMsg
Ref: Bug 33653
Modified paths:
  • /branches/jsgrammar/resources/mediawiki/mediawiki.jqueryMsg.js (modified) (history)
  • /branches/jsgrammar/resources/mediawiki/mediawiki.jqueryMsg.peg (modified) (history)

Diff [purge]

Index: branches/jsgrammar/resources/mediawiki/mediawiki.jqueryMsg.peg
@@ -22,11 +22,15 @@
2323
2424 templateContents
2525 = twr:templateWithReplacement p:templateParam* { return twr.concat(p) }
 26+ / twr:templateWithOutReplacement p:templateParam* { return twr.concat(p) }
2627 / t:templateName p:templateParam* { return p.length ? [ t, p ] : [ t ] }
2728
2829 templateWithReplacement
2930 = t:templateName ":" r:replacement { return [ t, r ] }
3031
 32+templateWithOutReplacement
 33+ = t:templateName ":" p:paramExpression { return [ t, p ] }
 34+
3135 templateParam
3236 = "|" e:paramExpression* { return e.length > 1 ? [ "CONCAT" ].concat(e) : e[0]; }
3337
Index: branches/jsgrammar/resources/mediawiki/mediawiki.jqueryMsg.js
@@ -407,12 +407,21 @@
408408 return result === null ? null : [ result[0], result[2] ];
409409 }
410410
 411+ function templateWithOutReplacement() {
 412+ var result = sequence( [
 413+ templateName,
 414+ colon,
 415+ paramExpression
 416+ ] );
 417+ return result === null ? null : [ result[0], result[2] ];
 418+ }
 419+
411420 var colon = makeStringParser(':');
412421
413422 var templateContents = choice( [
414423 function() {
415424 var res = sequence( [
416 - templateWithReplacement,
 425+ choice( [ templateWithReplacement, templateWithOutReplacement ] ) ,
417426 nOrMore( 0, templateParam )
418427 ] );
419428 return res === null ? null : res[0].concat( res[1] );

Sign-offs

UserFlagDate
Nikerabbitinspected17:43, 16 February 2012
Nikerabbittested13:42, 20 February 2012

Follow-up revisions

RevisionCommit summaryAuthorDate
r112669Added a comment to make the choice operation clear....santhosh06:40, 29 February 2012

Comments

#Comment by Santhosh.thottingal (talk | contribs)   09:35, 16 February 2012

to test:

mw.loader.using('mediawiki.jqueryMsg');
mw.messages.set('msgtest', '{{plural:2|one|two}}');
mw.msg('msgtest')
#Comment by Nikerabbit (talk | contribs)   13:42, 20 February 2012

I don't really understand what is the difference between with and without replacement.

#Comment by Santhosh.thottingal (talk | contribs)   14:18, 20 February 2012

It is explained in the bug report. Bug 33653

#Comment by Nikerabbit (talk | contribs)   14:22, 20 February 2012

Good, can we add that to code documentation?

#Comment by Siebrand (talk | contribs)   23:44, 26 February 2012

Has this comment been addressed?

#Comment by Santhosh.thottingal (talk | contribs)   12:19, 20 March 2012

Yes, in r112669

Status & tagging log