Skip to content

Commit 1a6bae0

Browse files
committed
feat: stringHelpers (refs #148)
1 parent 9fde4f3 commit 1a6bae0

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

src/main/java/se/bjurr/gitchangelog/api/GitChangelogApi.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import com.github.jknack.handlebars.Handlebars;
1313
import com.github.jknack.handlebars.Helper;
1414
import com.github.jknack.handlebars.Template;
15+
import com.github.jknack.handlebars.helper.StringHelpers;
1516
import com.github.jknack.handlebars.io.FileTemplateLoader;
1617
import java.io.File;
1718
import java.io.FileOutputStream;
@@ -62,6 +63,7 @@ private GitChangelogApi() {
6263
this.settings = new Settings();
6364
this.handlebars = new Handlebars();
6465
this.handlebars.setPrettyPrint(true);
66+
this.handlebars.registerHelpers(StringHelpers.class);
6567
for (final Entry<String, Helper<?>> helper : Helpers.ALL.entrySet()) {
6668
this.handlebars.registerHelper(helper.getKey(), helper.getValue());
6769
}

src/test/java/se/bjurr/gitchangelog/api/helpers/HandlebarsHelperTest.testThatBuiltInHelperMethodsCanBeUsed.approved.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ Has paragraphs: {{hash}}
132132
{{/commits}}
133133

134134

135+
## StringHelpers
136+
137+
{{capitalizeFirst 'hello'}}
135138

136139
---------------------------------------------
137140

@@ -681,6 +684,9 @@ This reverts commit 1edc0d71eccce51abfb5f62fdddfbe73913785f5.
681684

682685

683686

687+
## StringHelpers
688+
689+
Hello
684690

685691
---------------------------------------------
686692

src/test/resources/templatetest/helpers/testThatBuiltInHelperMethodsCanBeUsed.mustache

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,6 @@ Has paragraphs: {{hash}}
130130
{{/commits}}
131131

132132

133+
## StringHelpers
134+
135+
{{capitalizeFirst 'hello'}}

0 commit comments

Comments
 (0)