Invertable -> invertible. Other minor tidying.
This commit is contained in:
@@ -224,7 +224,8 @@ public class Mustache
|
||||
void execute (Template.Fragment frag, Writer out) throws IOException;
|
||||
}
|
||||
|
||||
public interface InvertableLambda extends Lambda
|
||||
/** Handles lambdas that are also invoked for inverse sections.. */
|
||||
public interface InvertibleLambda extends Lambda
|
||||
{
|
||||
/** Executes this lambda on the supplied template fragment, when the lambda is used in an
|
||||
* inverse section. The lambda should write its results to {@code out}.
|
||||
@@ -784,9 +785,9 @@ public class Mustache
|
||||
if (!(Boolean)value) {
|
||||
executeSegs(tmpl, ctx, out);
|
||||
}
|
||||
} else if (value instanceof InvertableLambda) {
|
||||
} else if (value instanceof InvertibleLambda) {
|
||||
try {
|
||||
((InvertableLambda)value).executeInverse(tmpl.createFragment(_segs, ctx), out);
|
||||
((InvertibleLambda)value).executeInverse(tmpl.createFragment(_segs, ctx), out);
|
||||
} catch (IOException ioe) {
|
||||
throw new MustacheException(ioe);
|
||||
}
|
||||
|
||||
@@ -629,30 +629,24 @@ public class MustacheTest
|
||||
}));
|
||||
}
|
||||
|
||||
@Test public void testInvertableLambda () {
|
||||
@Test public void testInvertibleLambda () {
|
||||
test("positive = positive, negative = negative, simple lambdas do still work",
|
||||
"{{#invertable}}positive{{/invertable}}, {{^invertable}}negative{{/invertable}}, simple lambdas do {{^simple}}NOT {{/simple}}still work",
|
||||
context("invertable", new Mustache.InvertableLambda() {
|
||||
@Override
|
||||
public void execute(Template.Fragment frag, Writer out)
|
||||
throws IOException {
|
||||
out.write("positive = ");
|
||||
frag.execute(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeInverse(Template.Fragment frag, Writer out)
|
||||
throws IOException {
|
||||
out.write("negative = ");
|
||||
frag.execute(out);
|
||||
}
|
||||
}, "simple", new Mustache.Lambda() {
|
||||
@Override
|
||||
public void execute(Template.Fragment frag, Writer out)
|
||||
throws IOException {
|
||||
frag.execute(out);
|
||||
}
|
||||
}));
|
||||
"{{#invertible}}positive{{/invertible}}, {{^invertible}}negative{{/invertible}}, " +
|
||||
"simple lambdas do {{^simple}}NOT {{/simple}}still work",
|
||||
context("invertible", new Mustache.InvertibleLambda() {
|
||||
public void execute (Template.Fragment frag, Writer out) throws IOException {
|
||||
out.write("positive = ");
|
||||
frag.execute(out);
|
||||
}
|
||||
public void executeInverse (Template.Fragment frag, Writer out) throws IOException {
|
||||
out.write("negative = ");
|
||||
frag.execute(out);
|
||||
}
|
||||
}, "simple", new Mustache.Lambda() {
|
||||
public void execute (Template.Fragment frag, Writer out) throws IOException {
|
||||
frag.execute(out);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
@Test public void testNonStandardDefaultDelims () {
|
||||
|
||||
Reference in New Issue
Block a user