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