|
1 | 1 | [](https://patreon.com/edgarespina) |
2 | 2 | [](https://travis-ci.org/jknack/handlebars.java) |
3 | 3 | [](https://coveralls.io/r/jknack/handlebars.java?branch=master) |
| 4 | +[](https://codecov.io/gh/jknack/handlebars.java) |
4 | 5 | [](https://maven-badges.herokuapp.com/maven-central/com.github.jknack/handlebars) |
5 | 6 | [](https://javadoc.io/doc/com.github.jknack/handlebars) |
6 | 7 |
|
7 | 8 | Handlebars.java |
8 | 9 | =============== |
9 | 10 | ## Logic-less and semantic Mustache templates with Java |
10 | 11 |
|
| 12 | +```java |
| 13 | +Handlebars handlebars = new Handlebars(); |
| 14 | + |
| 15 | +Template template = handlebars.compileInline("Hello {{this}}!"); |
| 16 | + |
| 17 | +System.out.println(template.apply("Handlebars.java")); |
| 18 | +``` |
| 19 | + |
| 20 | +Output: |
| 21 | +``` |
| 22 | +Hello Handlebars.java! |
| 23 | +``` |
| 24 | + |
11 | 25 | Handlebars.java is a Java port of [handlebars](http://handlebarsjs.com/). |
12 | 26 |
|
13 | 27 | Handlebars provides the power necessary to let you build semantic templates effectively with no frustration. |
@@ -35,21 +49,6 @@ Handlebars provides the power necessary to let you build semantic templates effe |
35 | 49 |
|
36 | 50 | SNAPSHOT versions are NOT synchronized to Central. If you want to use a snapshot version you need to add the https://oss.sonatype.org/content/repositories/snapshots/ repository to your pom.xml. |
37 | 51 |
|
38 | | -## Hello Handlebars.java |
39 | | - |
40 | | -```java |
41 | | -Handlebars handlebars = new Handlebars(); |
42 | | - |
43 | | -Template template = handlebars.compileInline("Hello {{this}}!"); |
44 | | - |
45 | | -System.out.println(template.apply("Handlebars.java")); |
46 | | -``` |
47 | | - |
48 | | -Output: |
49 | | -``` |
50 | | -Hello Handlebars.java! |
51 | | -``` |
52 | | - |
53 | 52 | ### Loading templates |
54 | 53 | Templates are loaded using the ```TemplateLoader``` class. Handlebars.java provides three implementations of a ```TemplateLoader```: |
55 | 54 | * ClassPathTemplateLoader (default) |
@@ -1064,6 +1063,10 @@ Hello {{#child}}{{this.value}}{{/child}} |
1064 | 1063 |
|
1065 | 1064 | [Bugs, Issues and Features](https://github.com/jknack/handlebars.java/issues) |
1066 | 1065 |
|
| 1066 | +## Donate |
| 1067 | + |
| 1068 | +Buy [Edgar](https://patreon.com/edgarespina) a beer! |
| 1069 | + |
1067 | 1070 | ## Related Projects |
1068 | 1071 | * [Handlebars.js](http://handlebarsjs.com/) |
1069 | 1072 | * [Try Handlebars.js](http://tryhandlebarsjs.com/) |
|
0 commit comments