@@ -36,14 +36,19 @@ var engine_mustache = {
36
36
findPartialsWithStyleModifiersRE : utilMustache . partialsWithStyleModifiersRE ,
37
37
findPartialsWithPatternParametersRE : utilMustache . partialsWithPatternParametersRE ,
38
38
findListItemsRE : utilMustache . listItemsRE ,
39
- findPartialKeyRE : utilMustache . partialKeyRE ,
39
+ findPartialRE : utilMustache . partialRE ,
40
40
41
41
// render it
42
- renderPattern : function renderPattern ( template , data , partials ) {
43
- if ( partials ) {
44
- return Mustache . render ( template , data , partials ) ;
42
+ renderPattern : function renderPattern ( pattern , data , partials ) {
43
+ try {
44
+ if ( partials ) {
45
+ return Mustache . render ( pattern . extendedTemplate , data , partials ) ;
46
+ }
47
+ return Mustache . render ( pattern . extendedTemplate , data ) ;
48
+ } catch ( e ) {
49
+ debugger ;
50
+ console . log ( "e = " , e ) ;
45
51
}
46
- return Mustache . render ( template , data ) ;
47
52
} ,
48
53
49
54
/**
@@ -88,26 +93,26 @@ var engine_mustache = {
88
93
89
94
// given a pattern, and a partial string, tease out the "pattern key" and
90
95
// return it.
91
- findPartialKey_new : function ( partialString ) {
92
- var partialKey = partialString . replace ( this . findPartialKeyRE , '$1' ) ;
93
- return partialKey ;
96
+ findPartial_new : function ( partialString ) {
97
+ var partial = partialString . replace ( this . findPartialRE , '$1' ) ;
98
+ return partial ;
94
99
} ,
95
100
96
101
// GTP: the old implementation works better. We might not need
97
- // this.findPartialKeyRE anymore if it works in all cases!
98
- findPartialKey : function ( partialString ) {
102
+ // this.findPartialRE anymore if it works in all cases!
103
+ findPartial : function ( partialString ) {
99
104
//strip out the template cruft
100
- var foundPatternKey = partialString . replace ( "{{> " , "" ) . replace ( " }}" , "" ) . replace ( "{{>" , "" ) . replace ( "}}" , "" ) ;
105
+ var foundPatternPartial = partialString . replace ( "{{> " , "" ) . replace ( " }}" , "" ) . replace ( "{{>" , "" ) . replace ( "}}" , "" ) ;
101
106
102
107
// remove any potential pattern parameters. this and the above are rather brutish but I didn't want to do a regex at the time
103
- if ( foundPatternKey . indexOf ( '(' ) > 0 ) {
104
- foundPatternKey = foundPatternKey . substring ( 0 , foundPatternKey . indexOf ( '(' ) ) ;
108
+ if ( foundPatternPartial . indexOf ( '(' ) > 0 ) {
109
+ foundPatternPartial = foundPatternPartial . substring ( 0 , foundPatternPartial . indexOf ( '(' ) ) ;
105
110
}
106
111
107
112
//remove any potential stylemodifiers.
108
- foundPatternKey = foundPatternKey . split ( ':' ) [ 0 ] ;
113
+ foundPatternPartial = foundPatternPartial . split ( ':' ) [ 0 ] ;
109
114
110
- return foundPatternKey ;
115
+ return foundPatternPartial ;
111
116
}
112
117
} ;
113
118
0 commit comments