Exemplo n.º 1
0
        public static RenderResult RenderTemplate(this ICakeContext ctx, string template, object data)
        {
            ctx = ctx ?? throw new ArgumentNullException(nameof(ctx));
            var compiled = Hbs.Compile(template);

            return(new RenderResult(ctx, compiled(data)));
        }
Exemplo n.º 2
0
 public ITemplate <ViewModelOptions> Compile(string source)
 {
     return(new RenderTemplate {
         Template = HBS.Compile(source)
     });
 }
Exemplo n.º 3
0
 public static Func <object, RenderResult> CompileTemplate(this ICakeContext ctx, string template)
 {
     ctx = ctx ?? throw new ArgumentNullException(nameof(ctx));
     return(RenderResult.FromCompiledTemplate(ctx, Hbs.Compile(template)));
 }