/// <summary>
 /// Allows to intercept calls to missing helpers.
 /// <para>For Handlebarsjs docs see: https://handlebarsjs.com/guide/hooks.html#helpermissing</para>
 /// </summary>
 /// <param name="configuration"></param>
 /// <param name="helperMissing">Delegate that returns interceptor for <see cref="HandlebarsReturnHelper"/> and <see cref="HandlebarsHelper"/></param>
 /// <param name="blockHelperMissing">Delegate that returns interceptor for <see cref="HandlebarsBlockHelper"/></param>
 /// <returns></returns>
 public static HandlebarsConfiguration RegisterMissingHelperHook(
     this HandlebarsConfiguration configuration,
     HandlebarsReturnHelper helperMissing     = null,
     HandlebarsBlockHelper blockHelperMissing = null
     )
 {
     return(configuration.RegisterMissingHelperHook(
                helperMissing != null ? new DelegateReturnHelperDescriptor("helperMissing", helperMissing) : null,
                blockHelperMissing != null ? new DelegateBlockHelperDescriptor("blockHelperMissing", blockHelperMissing) : null
                ));
 }
Exemplo n.º 2
0
 public void RegisterHelper(string helperName, HandlebarsReturnHelper helperFunction)
 {
     Configuration.Helpers[helperName] = new DelegateReturnHelperDescriptor(helperName, helperFunction);
 }
Exemplo n.º 3
0
 public DelegateReturnHelperDescriptor(PathInfo name, HandlebarsReturnHelper helper) : base(name)
     => _helper = helper;
Exemplo n.º 4
0
 /// <summary>
 /// Registers new <see cref="HandlebarsReturnHelper"/>
 /// </summary>
 /// <param name="helperName"></param>
 /// <param name="helperFunction"></param>
 public static void RegisterHelper(string helperName, HandlebarsReturnHelper helperFunction)
 {
     Instance.RegisterHelper(helperName, helperFunction);
 }
Exemplo n.º 5
0
 public DelegateReturnHelperDescriptor(string name, HandlebarsReturnHelper helper)
 {
     _helper = helper;
     Name    = name;
 }
Exemplo n.º 6
0
 public void RegisterHelper(string helperName, HandlebarsReturnHelper helperFunction)
 {
     Configuration.ReturnHelpers[helperName] = helperFunction;
 }