This is a template engine, all written in Java
This is a template engine, all written in Java, support Java 8+.
<dependency>
<groupId>org.febit.wit</groupId>
<artifactId>wit-core</artifactId>
<version>2.6.0</version>
</dependency>
compile 'org.febit.wit:wit-core:2.6.0'
Engine engine = Engine.create();
Template template = engine.getTemplate("/demo.wit");
template.merge(params, out);
Hello Wit!
<%
var books
{
for(book : books){
%>
${for.iter.index}.《${book.name}》 ¥${book.price}
<%
}
}
{
var func = function(a, b){
return a + b + arguments[3]
}
echo func("a", "b", "c")
}
{
var map = {
books,
1: 1,
"key2": "value2",
3: 2 + 1
}
map[5] = 2 + 3
map.~put("6", 2*3)
for(key, value : map){
echo key + ":" +value + "\n"
}
}
%>
Febit Wit is released under the BSD License. See the bundled LICENSE file for
details.