Пример #1
0
 public override IProcessResult Process(string filePath, string content)
 {
     var compiler = new HoganCompiler();
     string renderFunc = compiler.Compile(content);
     string templateName = Path.GetFileName(filePath).Split('.').First();
     var sb = new StringBuilder();
     sb.AppendLine("var JST = JST || {};");
     sb.AppendLine("JST['" + templateName + "'] = new Hogan.Template(" + renderFunc + ",\"" + content.Replace("\"", "\\\"") + "\",Hogan,{});");
     return new ProcessResult(sb.ToString());
 }
Пример #2
0
 public override IProcessResult Process(string filePath, string content)
 {
     var compiler = new HoganCompiler();
     string renderFunc = compiler.Compile(content);
     string templateName = Path.GetFileName(filePath).Split('.').First();
     string templateHtml = string.Join("\\r\"+\"\\n",
                            content.Replace("\"", "\\\"").Split(new[] { Environment.NewLine }, StringSplitOptions.None));
     var sb = new StringBuilder();
     sb.AppendLine("var JST = JST || {};");
     sb.AppendLine("JST['" + templateName + "'] = new Hogan.Template(" + renderFunc + ",\"" + templateHtml + "\",Hogan,{});");
     return new ProcessResult(sb.ToString());
 }