|
23 | 23 | findPartialsWithStyleModifiersRE: /{{>([ ])?([\w\-\.\/~]+)(?!\()(\:[A-Za-z0-9-_|]+)+(?:(| )\(.*)?([ ])?}}/g,
|
24 | 24 | findPartialsWithPatternParametersRE: /{{>([ ])?([\w\-\.\/~]+)(?:\:[A-Za-z0-9-_|]+)?(?:(| )\(.*)+([ ])?}}/g,
|
25 | 25 | findListItemsRE: /({{#( )?)(list(I|i)tems.)(one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty)( )?}}/g,
|
| 26 | + getPartialKeyRE: /{{>([ ])?([\w\-\.\/~]+)(:[A-z-_|]+)?(?:\:[A-Za-z0-9-_]+)?(?:(| )\(.*)?([ ])?}}/g, |
26 | 27 |
|
27 | 28 | // render it
|
28 | 29 | renderPattern: function renderPattern(template, data, partials) {
|
|
37 | 38 | var matches = pattern.template.match(this.findPartialsRE);
|
38 | 39 | return matches;
|
39 | 40 | },
|
40 |
| - findPartialsWithStyleModifiers: function(pattern){ |
| 41 | + findPartialsWithStyleModifiers: function(pattern) { |
41 | 42 | var matches = pattern.template.match(this.findPartialsWithStyleModifiersRE);
|
42 | 43 | return matches;
|
43 | 44 | },
|
44 |
| - // returns any patterns that match {{> value(foo:"bar") }} or {{> value:mod(foo:"bar") }} within the pattern |
45 |
| - findPartialsWithPatternParameters: function(pattern){ |
| 45 | + // returns any patterns that match {{> value(foo:"bar") }} or {{> |
| 46 | + // value:mod(foo:"bar") }} within the pattern |
| 47 | + findPartialsWithPatternParameters: function(pattern) { |
46 | 48 | var matches = pattern.template.match(this.findPartialsWithPatternParametersRE);
|
47 | 49 | return matches;
|
48 | 50 | },
|
49 |
| - findListItems: function(pattern){ |
| 51 | + findListItems: function(pattern) { |
50 | 52 | var matches = pattern.template.match(this.findListItemsRE);
|
51 | 53 | return matches;
|
| 54 | + }, |
| 55 | + // given a pattern, and a partial string, tease out the "pattern key" and |
| 56 | + // return it. |
| 57 | + getPartialKey: function(pattern, partialString) { |
| 58 | + var partialKey = partialString.replace(this.getPartialKeyRE, '$2'); |
| 59 | + return partialKey; |
52 | 60 | }
|
53 | 61 | };
|
54 | 62 |
|
|
0 commit comments