public string Render(string name, string template, string json) { if (string.IsNullOrEmpty(json)) { json = "{}"; } return((string)_context.Evaluate("Handlebars.compile('" + HandlebarsUtilities.ToJavaScriptString(template) + "')(" + json + ");")); }
public void Compile(string name, string template) { template = HandlebarsUtilities.ToJavaScriptString(template); _context.Execute("raw['" + name + "'] = '" + template + "';\n" + "Handlebars.templates['" + name + "'] = Handlebars.compile('" + template + "');"); }
public string Render(string name, string template, object context) { string json = context is string?(string)context : HandlebarsUtilities.ToJson(context); return(Render(name, template, json)); }
public string Render(string name, object context) { var json = context is string?(string)context : HandlebarsUtilities.ToJson(context); return((string)_context.Evaluate("Handlebars.templates['" + name + "'](" + json + ");")); }
public void PartialCompile(string name, string template) { template = HandlebarsUtilities.ToJavaScriptString(template); _context.Execute("raw['" + name + "'] = '" + template + "';\n" + "Handlebars.registerPartial('" + name + "','" + template + "');"); }
public string Render(string name, string template, object context) { return(Render(name, template, HandlebarsUtilities.ToJson(context))); }