Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ ID
:
ID_START ID_SUFFIX*
| ID_ESCAPE ID_SUFFIX*
// digit-leading identifiers such as 24Hr, which handlebars.js accepts
| [0-9]+ ID_START ID_SUFFIX*
;

fragment
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Handlebars.java: https://github.com/jknack/handlebars.java
* Apache License Version 2.0 http://www.apache.org/licenses/LICENSE-2.0
* Copyright (c) 2012 Edgar Espina
*/
package com.github.jknack.handlebars.issues;

import java.io.IOException;

import org.junit.jupiter.api.Test;

import com.github.jknack.handlebars.v4Test;

public class Issue1078 extends v4Test {

@Test
public void shouldResolveIdentifiersThatStartWithDigits() throws IOException {
shouldCompileTo(
"<p>{{24HrServicePh}}</p>",
$("hash", $("24HrServicePh", "1-800-000-0000")),
"<p>1-800-000-0000</p>");
}

@Test
public void shouldResolveDigitLeadingIdentifiersInBlocks() throws IOException {
shouldCompileTo(
"{{#if 24Hr}}yes{{/if}}", $("hash", $("24Hr", true)), "yes");
}

@Test
public void shouldStillParseNumericLiteralsAsParameters() throws IOException {
shouldCompileTo(
"{{foo 24}} {{foo 24.5}}",
$("helpers", $("foo", "ok")),
"ok ok");
}
}
Loading