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

            return(Render(name, template, json));
        }
Exemplo n.º 4
0
        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 + ");"));
        }
Exemplo n.º 5
0
 public void PartialCompile(string name, string template)
 {
     template = HandlebarsUtilities.ToJavaScriptString(template);
     _context.Execute("raw['" + name + "'] = '" + template + "';\n" +
                      "Handlebars.registerPartial('" + name + "','" + template + "');");
 }
Exemplo n.º 6
0
 public string Render(string name, string template, object context)
 {
     return(Render(name, template, HandlebarsUtilities.ToJson(context)));
 }