Closed oformaniuk closed 3 years ago
@zjklee This is only for normal helpers, not for block-helpers? Correct?
@zjklee This is only for normal helpers, not for block-helpers? Correct?
Unfortunately this is true also for block helpers.
I assume that a lot of users rely on this behavior so I consider adding compatibility switch to Handlebars that would allow using helpers as before.
How would this template be used when using a prefix of "String." ?
"{{#StartsWith \"Hello\" \"x\"}}Hi{{else}}Goodbye{{/StartsWith}}"
"{{#String.StartsWith \"Hello\" \"x\"}}Hi{{else}}Goodbye{{/String.StartsWith}}"
does not work?
@StefH Unfortunately it wouldn't work with prefix - take a loot at an example: https://jsfiddle.net/bc89sjmg/2/
As a valid alternative to prefixes separated by .
I may recommend using -
instead, see https://jsfiddle.net/bc89sjmg/3/
In this library, I'll also add a PrefixSeparator
option which can be set to any value, default however will be a dot .
.
The problem
According to
Handlebars helper documentation
:and Identifier definition:
It looks like usage example is not valid:
In order to be rendered correctly it should be:
Simple example of Handlebarsjs behavior using suggested syntax: https://jsfiddle.net/bc89sjmg/1/
AAA
- printed twiceBBB
- printed onceAAA
- printed onceBBB
- printed onceIn Handlerbars.CSharp I've followed the same approach to be as close to Handlebarsjs as possible. Changes related to the topic were made in zjklee/Handlebars.CSharp/pull/20 and zjklee/Handlebars.CSharp/pull/21