Questions tagged [handlebars.java]

Handlebars.java is a modern and full featured template engine and a java port of [handlebars]. It provides the power necessary to build semantic templates with the same syntax as [mustache]

64 questions
8
votes
4 answers

Escaping curly brackets standing next to expression in handlebars

Can't understand how to escape { or } symbols standing next to expression at handlebars java templating engine. I'm using handlebars templates to generate plain text so I can't use HTML ASCII codes of braces as advised there. I need expression like…
hatesms
  • 750
  • 1
  • 9
  • 27
4
votes
2 answers

Wiremock templating fixedDelayMilliseconds

I am trying to generated a response in wiremock, after a delay, where that delay is derived from the incoming request. e.g the family-name of the user in the request is "delay_10000" then delay by 10000 milliseconds, or delay_20000 then delay by…
4
votes
6 answers

Wiremock Date format

I want to generate date in the format 2019-03-28T15:30:59+12:00 using wiremock. I tried: "currentDateTime": "{{now timezone='Australia/Sydney' format='yyyy-MM-dd'T'HH:mm:ssZ'}}" but, I get…
Rajkishan Swami
  • 3,569
  • 10
  • 48
  • 68
4
votes
2 answers

Comparing 2 strings with Handlebars in Java

I am using Handlebars with Dropwizard in Java. I'd like to compare 2 strings and if the are identically, I'd like to do something. I know there are some Helpers within Javascript, but I don't get how to adapt them to java. I've this code, but…
Christian
  • 6,961
  • 10
  • 54
  • 82
3
votes
1 answer

Spring Boot with Handlebars: could not find helper: 'dateFormat'

I'm trying to get the handlebars dateFormat to work. At the moment I'm getting the error com.github.jknack.handlebars.HandlebarsException: /hbs/doc/docheader.hbs:6:12: could not find helper: 'dateFormat' when I call {{dateFormat doc.documentDate…
AyKarsi
  • 9,435
  • 10
  • 54
  • 92
3
votes
1 answer

How to use Handlebars in Spring MVC?

I have the packages, but I am not sure how to use it. Do I just use them as I would .jsp files? I have tried something like this: test.hbs

{{message}}

in my controller: private static class M { private final String message; public…
zwiebl
  • 685
  • 2
  • 11
  • 24
2
votes
0 answers

Handlebar compile error if template is not well-formed html

I am using handlebar as a templating framework. When the template get compiled, in case it is not well-formed html, there should be exception thrown. Does handlebar have such a feature? For example the following template is not well-formed as the…
A.v
  • 734
  • 5
  • 26
2
votes
0 answers

Java Handlebars : not using helpers but context, is it possible?

I'am using handlebars "com.github.jknack" % "handlebars" % "4.1.2" for templating. What I want is when compiling {{something.foo}} and the result is HW it replaces automatically the code HW by its label Hello World !. HW can be the result of…
bubbles
  • 2,597
  • 1
  • 15
  • 40
2
votes
1 answer

How do I specify options params in Handlebars.java?

As per the Handlebars.java documentation, there is an Options class which has a params object that can be accessed. My question is, how do I write a template + input JSON, which will populate this Options.param object? API Documentation that shows…
Janac Meena
  • 3,203
  • 35
  • 32
2
votes
1 answer

Handlebars if method returns null / empty string

I currently use handlebars in java (com.github.jknack.handlebars) and have a handlebars helper method to get a link (with some logic behind) {{ getLink data.node}} which just render the url /subfolder/link.html In my handlebars template I now only…
RCX
  • 155
  • 3
  • 17
2
votes
1 answer

The meaning of "scope" in Handlebars

I am confused by "scope" in the Handlebars template engine. In its documentation on block helpers, I read "Private variables provided via the data option are available in all descendent scopes. Private variables defined in parent scopes may be …
flow2k
  • 3,999
  • 40
  • 55
2
votes
2 answers

Can I change the default escaping in Handlebars.java?

I have a template with default Handlebars expansion {{thing}}. For various nasty reasons I'd like to use it to render JSON, and so not to do the default HTML escaping that comes with {{. I'd also like to use the template in an HTML context. Can I…
Duncan McGregor
  • 17,665
  • 12
  • 64
  • 118
1
vote
1 answer

Multiple applies on handlebars template

I have helpers that return a string that contains helperbars expressions. What I would like to achieve is that the expressions returned will also be resolved (and so on). It can be done quite easily without handlebars internal support by simply…
yotam hadas
  • 702
  • 3
  • 14
1
vote
0 answers

How to create links or Ids to sections or CTAs on the same page in handlebars.java?

I have come here with a concern. We want a structure of linking for different CTAs on same page of our client's website. Like, if someone opens the link https://www.smansha.com/webinar/#book-a-private-demo/ then it should open with respective pop-up…
1
vote
0 answers

Spring MVC: update handlebars view without restart

I am working on a Spring MVC web application (not spring boot). I develop it locally by building a war package using maven, and then running this application using tomcat. The Spring application uses the…
Joaquim d'Souza
  • 1,416
  • 2
  • 14
  • 25
1
2 3 4 5