public string Render(Scope scope) { StringWriter writer = new StringWriter (CultureInfo.InvariantCulture); this.Render (scope, writer); return writer.ToString (); }
public Value Render(Scope scope, TextWriter writer) { Value result; this.root.Apply (scope, writer, out result); return result; }
private string RenderTemplate(List<Service> services) { using ( StreamReader template = new StreamReader(new FileStream("Resources\\services.cottle", FileMode.Open), Encoding.UTF8)) { try { Document document = new Document(template); Scope scope = new Scope(); CommonFunctions.Assign(scope); scope["services"] = new ReflectionValue(services); return document.Render(scope); } catch (Exception) { Console.WriteLine("Error rendering template"); } } return "Error rendering template"; }