public string Generate(TemplateInfo templateInfo)
		{
			var builder = new StringBuilder();
			using (var writer = new StringWriter(builder))
			{
                writer.Write("{0}.register(\"{1}\", {{ render: function(ctx, model) {{ var w = function(v) {{ ctx.write(v); }}; var we = function(v) {{ ctx.writeEscape(v); }};", _templateRepository, templateInfo.Id);
				var clientContext = new JavascriptClientContext(templateInfo.Id, writer);
				var model = new JavascriptClientModel(null, "model");
				_templateGenerator.Generate(templateInfo, clientContext, model);

				writer.Write("}});");	
			}

			return builder.ToString();
		}
Пример #2
0
        public string Generate(TemplateInfo templateInfo)
        {
            var builder = new StringBuilder();

            using (var writer = new StringWriter(builder))
            {
                writer.Write("{0}.register(\"{1}\", {{ render: function(ctx, model) {{ var w = function(v) {{ ctx.write(v); }}; var we = function(v) {{ ctx.writeEscape(v); }};", _templateRepository, templateInfo.Id);
                var clientContext = new JavascriptClientContext(templateInfo.Id, writer);
                var model         = new JavascriptClientModel(null, "model");
                _templateGenerator.Generate(templateInfo, clientContext, model);

                writer.Write("}});");
            }

            return(builder.ToString());
        }