Exemple #1
0
        public string Render(Scope scope)
        {
            StringWriter    writer = new StringWriter (CultureInfo.InvariantCulture);

            this.Render (scope, writer);

            return writer.ToString ();
        }
Exemple #2
0
        public Value Render(Scope scope, TextWriter writer)
        {
            Value   result;

            this.root.Apply (scope, writer, out result);

            return result;
        }
Exemple #3
0
 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";
 }