forked from janl/mustache.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid requiring partials in global scope.
- Loading branch information
Showing
10 changed files
with
112 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Again, {{again}}! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<h1>{{title}}</h1> | ||
{{<inner_partial}} | ||
{{<partial}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
var template_partial = { | ||
var partial_context = { | ||
title: function() { | ||
return "Welcome"; | ||
} | ||
}, | ||
partial: { | ||
again: "Goodbye" | ||
} | ||
} | ||
|
||
var inner_partial = "Again, {{title}}!"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
<h1>Welcome</h1> | ||
Again, Welcome! | ||
Again, Goodbye! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Hello {{name}} | ||
You have just won ${{value}}! | ||
{{#in_ca}} | ||
Well, ${{ taxed_value }}, after taxes. | ||
{{/in_ca}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<h1>{{greeting}}</h1> | ||
{{<simple}} | ||
{{<partial}} | ||
<h3>{{farewell}}</h3> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,19 @@ | ||
var view_partial = { | ||
var partial_context = { | ||
greeting: function() { | ||
return "Welcome"; | ||
}, | ||
|
||
farewell: function() { | ||
return "Fair enough, right?"; | ||
} | ||
}; | ||
|
||
var simple = { | ||
name: "Chris", | ||
value: 10000, | ||
taxed_value: function() { | ||
return this.value - (this.value * 0.4); | ||
}, | ||
in_ca: true | ||
|
||
partial: { | ||
name: "Chris", | ||
value: 10000, | ||
taxed_value: function() { | ||
return this.value - (this.value * 0.4); | ||
}, | ||
in_ca: true | ||
} | ||
}; | ||
|
||
var simple_template = "Hello {{name}}\n" + | ||
"You have just won ${{value}}!\n" + | ||
"{{#in_ca}}\n" + | ||
"Well, ${{ taxed_value }}, after taxes.\n" + | ||
"{{/in_ca}}\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters