Skip to content
/ wit Public

This is a template engine, all written in Java

License

Notifications You must be signed in to change notification settings

febit/wit

Repository files navigation

Febit Wit

BSD License Build Status

This is a script wit, all written in Java, support Java 17+.

How to use

  • Maven:
<dependency>
    <groupId>org.febit.wit</groupId>
    <artifactId>wit-core</artifactId>
    <version>3.0.0-SNAPSHOT</version>
</dependency>
  • or Gradle
implementation 'org.febit.wit:wit-core:3.0.0-SNAPSHOT'
  • Config Wit engine, load script and eval:
Wit wit = Wit.builder()
    .loader(Loaders.fileSystem() ... )
    .build();
Script script = wit.script("/demo.wit");
script.eval(params, out);

Hello Wit

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"
    }
}
%>

More examples

License

Febit Wit is released under the BSD License. See the bundled LICENSE file for details.

Third-party Licenses

Bug report

github-issue

About

This is a template engine, all written in Java

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •