Invertable -> invertible. Other minor tidying.

This commit is contained in:
Michael Bayne
2014-03-11 07:43:44 -07:00
parent 2251ac1ed2
commit 59e06b24c9
3 changed files with 25 additions and 31 deletions
+4 -5
View File
@@ -428,12 +428,12 @@ inverse section rather than having the section omitted altogether. This allows
for proper conditional substitution when statically translating templates into
other languages or contexts:
String template = "{{#condition}}result if true{{/condition}}\n{{^condition}}result if false{{/condition}}";
String template = "{{#condition}}result if true{{/condition}}\n" +
"{{^condition}}result if false{{/condition}}";
Mustache.compiler().compile(template).execute(new Object() {
Mustache.InvertableLambda condition = new Mustache.InvertableLambda() {
@Override
public void execute(Template.Fragment frag, Writer out)
throws IOException {
public void execute(Template.Fragment frag, Writer out) throws IOException {
// this method is executed when the lambda is referenced in a normal section
out.write("if (condition) {console.log(\"");
out.write(toJavaScriptLiteral(frag.execute()));
@@ -441,8 +441,7 @@ other languages or contexts:
}
@Override
public void executeInverse(Template.Fragment frag, Writer out)
throws IOException {
public void executeInverse(Template.Fragment frag, Writer out) throws IOException {
// this method is executed when the lambda is referenced in an inverse section
out.write("if (!condition) {console.log(\"");
out.write(toJavaScriptLiteral(frag.execute()));