Handlebars.Net icon indicating copy to clipboard operation
Handlebars.Net copied to clipboard

RegisterHelper with title "json" results in "Reached end of template..." error

Open alittlerabbi opened this issue 10 years ago • 3 comments

With the following template and helper,

<div>
{{json AnyDataFromContext}}
</div>
Handlebars.RegisterHelper("json", ( writer, context, arguments ) =>
{
    writer.Write("This will functionally break.");
});

the response will end in with the error: "Reached end of template before block expression was closed"

However, if i change both into the following (notice that the helper is no longer titled "json")

<div>
{{jsonXYZ AnyDataFromContext}}
</div>
Handlebars.RegisterHelper("jsonXYZ", ( writer, context, arguments ) =>
{
    writer.Write("This functionally works.");
});

the result is

<div>
This functionally works.
</div>

alittlerabbi avatar May 18 '16 17:05 alittlerabbi

I set up the test scenario you described above and it works for me as expected. Can you confirm the following so we can better troubleshoot:

  • Is this is the exact template and helper you're using?
  • What version of Handlebars.Net are you using?
  • What platform/OS are you using?

rexm avatar May 18 '16 17:05 rexm

Cannot replicate the issue anymore. Closing this issue.

alittlerabbi avatar May 18 '16 17:05 alittlerabbi

An old issue, but I did have the same problem with a helper named "Math.Add".

Using Windows10, .NET Framework 4.5.1 and Handlebars.Net version 1.9.0.

StefH avatar Apr 19 '20 09:04 StefH