Conflict Between Truncate Helpers Prevents Usage Without Prefix
When registering Handlebars helpers using HandlebarsHelpers.Register with the UseCategoryPrefix option set to false,
HandlebarsHelpers.Register(handlebarsContext, options => { UseCategoryPrefix = false; });
it is not possible to use the Truncate helper without a prefix. This is due to a naming conflict between the Truncate helper in the String category and the Truncate helper in the Humanizer category. As a result, the Truncate helper cannot be resolved unambiguously when prefixes are disabled and in my project, Humanizer always seems to win.
Steps to Reproduce
-
Create a Handlebars context:
var handlebarsContext = Handlebars.Create(); -
Register helpers without category prefixes
HandlebarsHelpers.Register(handlebarsContext, options => { options.UseCategoryPrefix = false; }); -
Attempt to use the string version of the Truncate helper in a Handlebars template:
{{Truncate "This is a long string" 10}}
Expected Result: This is a Actual Result: This is a...
@EmilyThomasPCTY OK. Thanks for reporting.
Only way to solve this is to introduce a small breaking change. The least impact is when I require a prefix for the Humanizer truncate.
https://github.com/Handlebars-Net/Handlebars.Net.Helpers/pull/132