Page MenuHomePhabricator

JqueryMsg parser should support templates without replacements
Closed, ResolvedPublic

Description

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


Version: 1.20.x
Severity: normal

Attached:

Details

Reference
bz33653

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:06 AM
bzimport set Reference to bz33653.

r111629 merged this patch to jsgrammar branch

jsgrammar branch was merged sometime back. closing this bug.