Index: branches/jsgrammar/resources/mediawiki/mediawiki.jqueryMsg.peg |
— | — | @@ -22,11 +22,15 @@ |
23 | 23 | |
24 | 24 | templateContents |
25 | 25 | = twr:templateWithReplacement p:templateParam* { return twr.concat(p) } |
| 26 | + / twr:templateWithOutReplacement p:templateParam* { return twr.concat(p) } |
26 | 27 | / t:templateName p:templateParam* { return p.length ? [ t, p ] : [ t ] } |
27 | 28 | |
28 | 29 | templateWithReplacement |
29 | 30 | = t:templateName ":" r:replacement { return [ t, r ] } |
30 | 31 | |
| 32 | +templateWithOutReplacement |
| 33 | + = t:templateName ":" p:paramExpression { return [ t, p ] } |
| 34 | + |
31 | 35 | templateParam |
32 | 36 | = "|" e:paramExpression* { return e.length > 1 ? [ "CONCAT" ].concat(e) : e[0]; } |
33 | 37 | |
Index: branches/jsgrammar/resources/mediawiki/mediawiki.jqueryMsg.js |
— | — | @@ -407,12 +407,21 @@ |
408 | 408 | return result === null ? null : [ result[0], result[2] ]; |
409 | 409 | } |
410 | 410 | |
| 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 | + |
411 | 420 | var colon = makeStringParser(':'); |
412 | 421 | |
413 | 422 | var templateContents = choice( [ |
414 | 423 | function() { |
415 | 424 | var res = sequence( [ |
416 | | - templateWithReplacement, |
| 425 | + choice( [ templateWithReplacement, templateWithOutReplacement ] ) , |
417 | 426 | nOrMore( 0, templateParam ) |
418 | 427 | ] ); |
419 | 428 | return res === null ? null : res[0].concat( res[1] ); |