| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Several helpers which can be used for Handlebars.Net
| Build Azure | |
| Sonar Quality | |
| Coverage |
| Package | Nuget | MyGet ℹ️ |
|---|---|---|
| Handlebars.Net.Helpers | ||
| Handlebars.Net.Helpers.DynamicLinq | ||
| Handlebars.Net.Helpers.Humanizer | ||
| Handlebars.Net.Helpers.Json | ||
| Handlebars.Net.Helpers.Random | ||
| Handlebars.Net.Helpers.Xeger | ||
| Handlebars.Net.Helpers.XPath | ||
| Handlebars.Net.Helpers.Xslt |
Some breaking changes are introduced in this version:
By default, the category Environment is not automatically registered due to potential security issues. You need to allow this via the HandlebarsHelpersOptions.
By default, the category DynamicLinq is not automatically registered due to a CVE in System.Linq.Dynamic.Core DynamicLinq. This means that the NuGet Handlebars.Net.Helpers.DynamicLinq will not be loaded and registered automatically anymore. You need to allow this via the HandlebarsHelpersOptions. In addition, an extra configuration setting is added to allow the use of ToString and Equals on an object.
Example:
var handlebarsContext = HandlebarsDotNet.Handlebars.Create();
HandlebarsHelpers.Register(handlebarsContext, o =>
{
o.DynamicLinqHelperOptions = new HandlebarsDynamicLinqHelperOptions
{
AllowEqualsAndToStringMethodsOnObject = true
};
});var handlebarsContext = HandlebarsDotNet.Handlebars.Create();
HandlebarsHelpers.Register(handlebarsContext);var handlebarsContext = HandlebarsDotNet.Handlebars.Create();
HandlebarsHelpers.Register(handlebarsContext, Category.String);var handlebarsContext = HandlebarsDotNet.Handlebars.Create();
HandlebarsHelpers.Register(handlebarsContext, Category.Math, Category.String);By default you can use the helpers by using a prefix from the category:
If you would like to use the helpers with a custom prefix, you need to register the helpers using this code:
HandlebarsHelpers.Register(handlebarsContext, options => { Prefix = "custom"; });Now you can only access the helpers by using the custom prefix, category prefix and the name like:
By default the dot (.) character is used, use the code below to use a different value:
HandlebarsHelpers.Register(handlebarsContext, options => { PrefixSeparator = "-"; });Now you can only access the helpers by using the - separator like this:
If you would like to use the helpers without a prefix, so just by name, use this code:
HandlebarsHelpers.Register(handlebarsContext, options => { UseCategoryPrefix = false; });Now you can use it like:
Now you can access the helpers by just using the name like:
The following default built-in helpers are available:
And the following additonal helpers are available:
| Back | FazBrowse Home | New Git URL |