liqp.blocks.Unless Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liqp Show documentation
Show all versions of liqp Show documentation
A Java implementation of the Liquid templating engine backed up by an ANTLR grammar.
The newest version!
package liqp.blocks;
import liqp.TemplateContext;
import liqp.nodes.LNode;
public class Unless extends Block {
/*
* Mirror of if statement
*/
@Override
public Object render(TemplateContext context, LNode... nodes) {
for (int i = 0; i < nodes.length - 1; i += 2) {
Object exprNodeValue = nodes[i].render(context);
LNode blockNode = nodes[i + 1];
if (!super.asBoolean(exprNodeValue)) {
return blockNode.render(context);
}
}
return "";
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy