Helpers for Handlebars.java
Groovy Shell HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
ghpages
gradle/wrapper
src
.gitignore
.travis.yml
LICENSE
NOTICE
README.md
build.gradle
findbugsExclude.xml
gradle-local.template.properties
gradle.properties
gradlew
gradlew.bat
license-header.txt
travis-build.sh

README.md

License Build Status

Handlebars.java Helpers

This library provides various helpers for adding logic to Handlebars.java. Most of them are basic helpers that can be used as subexpressions in the built-in block helpers of Handlebars.java. This allows writing the template logic in a fluent way.

Example

Given the following YAML model:

birthYear: 1997

and the following template:

{{def 'fifteenYear' (math birthYear '+' 15)}}
{{#ifb (or
          (and
            (compare (math fifteenYear '%' 4) '==' 0)
            (compare (math fifteenYear '%' 100) '!=' 0)
          )
          (compare (math fifteenYear '%' 400) '==' 0)
       )
}}
Your fifteenth anniversary was in a leap year!
{{else}}
Your fifteenth anniversary was in a non-leap year!
{{/ifb}}

The resulting text will be:

Your fifteenth anniversary was in a leap year!

Please read the documentation before using the handlebars-java-helpers library.