/// <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
                ));
 }
예제 #2
0
 public void RegisterHelper(string helperName, HandlebarsReturnHelper helperFunction)
 {
     Configuration.Helpers[helperName] = new DelegateReturnHelperDescriptor(helperName, helperFunction);
 }
예제 #3
0
 public DelegateReturnHelperDescriptor(PathInfo name, HandlebarsReturnHelper helper) : base(name)
     => _helper = helper;
예제 #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);
 }
예제 #5
0
 public DelegateReturnHelperDescriptor(string name, HandlebarsReturnHelper helper)
 {
     _helper = helper;
     Name    = name;
 }
예제 #6
0
 public void RegisterHelper(string helperName, HandlebarsReturnHelper helperFunction)
 {
     Configuration.ReturnHelpers[helperName] = helperFunction;
 }