Skip to content

Implement MissingHelper feature#21

Merged
probot-auto-merge[bot] merged 5 commits intomasterfrom
feature/missingHelper
Jun 12, 2020
Merged

Implement MissingHelper feature#21
probot-auto-merge[bot] merged 5 commits intomasterfrom
feature/missingHelper

Conversation

@oformaniuk
Copy link
Owner

@oformaniuk oformaniuk commented Jun 1, 2020

Implementation for a missing feature mentioned in Handlebars-Net/issues/350.

The are two options to configure the feature:

Handlebars.RegisterHelper("helperMissing", (writer, context, arguments) =>
{
    var helperName = arguments.Last().ToString();
    writer.WriteSafeString($"Helper missing: {helperName}");
});

Or

Handlebars.RegisterHelper("helperMissing", (context, arguments) =>
{
    var helperName = arguments.Last().ToString();
    return $"Helper missing: {helperName}";
});
Handlebars.RegisterHelper("blockHelperMissing", (writer, options, context, arguments) =>
{
    var helperName = options.GetValue<string>("name");
    writer.WriteSafeString($"Helper missing: {helperName}");
});
  • Registering via feature:
Handlebars.Configuration.RegisterMissingHelperHook(
    helperMissing: (context, arguments) =>
    {
        var name = arguments.Last().ToString();
        return string.Format(format, name.Trim('[', ']'));
    },
    blockHelperMissing: (writer, options, context, arguments) =>
    {
        var helperName = options.GetValue<string>("name");
        writer.WriteSafeString($"Helper missing: {helperName}");
    }
);

@oformaniuk oformaniuk force-pushed the feature/late-bind-helper-priority branch from 1b3dbfc to a73fb5f Compare June 1, 2020 22:30
@oformaniuk oformaniuk force-pushed the feature/missingHelper branch from b87fad4 to 0e8f9bb Compare June 1, 2020 22:30
@oformaniuk
Copy link
Owner Author

TODO: implement blockHelperMissing properly

@oformaniuk
Copy link
Owner Author

oformaniuk commented Jun 2, 2020

Issue Handlebars-Net/issues/354 discovered. However the problem does not reproduce in current version.

@oformaniuk oformaniuk changed the base branch from feature/late-bind-helper-priority to master June 2, 2020 23:03
@oformaniuk oformaniuk force-pushed the feature/missingHelper branch from 0e8f9bb to a99cd5e Compare June 12, 2020 22:43
@oformaniuk oformaniuk added the merge Marks PR for auto-merge label Jun 12, 2020
@oformaniuk oformaniuk force-pushed the feature/missingHelper branch from 3c232ab to 371010d Compare June 12, 2020 23:26
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 3 Code Smells

72.3% 72.3% Coverage
0.7% 0.7% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request merge Marks PR for auto-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant