Last modified: 2012-05-17 05:46:37 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 T35653, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 33653 - JqueryMsg parser should support templates without replacements
JqueryMsg parser should support templates without replacements
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.20.x
All All
: Normal normal (vote)
: ---
Assigned To: Santhosh Thottingal
: i18n, javascript, patch
Depends on:
Blocks: 33658
  Show dependency treegraph
 
Reported: 2012-01-11 08:56 UTC by Santhosh Thottingal
Modified: 2012-05-17 05:46 UTC (History)
3 users (show)

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


Attachments
Add support for templates without replacements in jqueryMsg (1.64 KB, patch)
2012-01-11 08:56 UTC, Santhosh Thottingal
Details

Description Santhosh Thottingal 2012-01-11 08:56:18 UTC
Created attachment 9838 [details]
Add support for templates without replacements in jqueryMsg

The template parser in jqueryMsg expect a replacement after the templatename as per the syntax

templateContents
  = twr:templateWithReplacement p:templateParam* { return twr.concat(p) }
   / t:templateName p:templateParam* { return p.length ? [ t, p ] : [ t ] }

templateWithReplacement
  = t:templateName ":" r:replacement { return [ t, r ] }

replacement
  = '$' digits:digits { return [ 'REPLACE', parseInt( digits, 10 ) - 1 ] }

This fails for {{GRAMMAR:genitive|{{SITENAME}}}} since genitive is not a replacement or not starting with a $. (grammar is yet to be supported by the parser.)

Attached patch resolves this by adding an option to templateContents like this:

templateContents
  = twr:templateWithReplacement p:templateParam* { return twr.concat(p) }
  / twr:templateWithOutReplacement p:templateParam* { return twr.concat(p) }
  / t:templateName p:templateParam* { return p.length ? [ t, p ] : [ t ] }

(Did not commit this code and keeping patch here since core code is in 'slush' )
Comment 1 Santhosh Thottingal 2012-02-17 05:02:16 UTC
r111629 merged this patch to jsgrammar branch
Comment 2 Santhosh Thottingal 2012-05-17 05:46:37 UTC
jsgrammar branch was merged sometime back. closing this bug.

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


Navigation
Links