コード例 #1
0
        private void run(String testName, bool pretty, JadeModel model)
        {
            JadeParser parser = null;

            try
            {
                FileTemplateLoader loader = new FileTemplateLoader(TestFileHelper.getCompilerErrorsResourcePath(""),
                                                                   "UTF-8");
                parser = new JadeParser(testName, loader);
            }
            catch (IOException e)
            {
                Trace.WriteLine(e);
            }
            Node root = parser.parse();

            Jade.Compiler.Compiler compiler = new Jade.Compiler.Compiler(root);
            compiler.setPrettyPrint(pretty);
            String expected = readFile(testName + ".html");

            model.addFilter("markdown", new MarkdownFilter());
            model.addFilter("plain", new PlainFilter());
            String html;

            try
            {
                html = compiler.compileToString(model);
                Assert.AreEqual(expected.Trim(), html.Trim(), testName);
                Assert.Fail();
            }
            catch (JadeCompilerException e)
            {
                Trace.WriteLine(e);
            }
        }
コード例 #2
0
 private void run(String testName, bool pretty, JadeModel model)
 {
     JadeParser parser = null;
     try
     {
         FileTemplateLoader loader = new FileTemplateLoader(TestFileHelper.getCompilerErrorsResourcePath(""),
             "UTF-8");
         parser = new JadeParser(testName, loader);
     }
     catch (IOException e)
     {
         Trace.WriteLine(e);
     }
     Node root = parser.parse();
     Jade.Compiler.Compiler compiler = new Jade.Compiler.Compiler(root);
     compiler.setPrettyPrint(pretty);
     String expected = readFile(testName + ".html");
     model.addFilter("markdown", new MarkdownFilter());
     model.addFilter("plain", new PlainFilter());
     String html;
     try
     {
         html = compiler.compileToString(model);
         Assert.AreEqual(expected.Trim(), html.Trim(), testName);
         Assert.Fail();
     }
     catch (JadeCompilerException e)
     {
         Trace.WriteLine(e);
     }
 }
コード例 #3
0
        public void renderTemplate(JadeTemplate template, Dictionary <String, Object> model, TextWriter writer)
        //throws JadeCompilerException
        {
            JadeModel jadeModel = new JadeModel(sharedVariables);

            foreach (String filterName in filters.Keys)
            {
                jadeModel.addFilter(filterName, filters[filterName]);
            }
            jadeModel.putAll(model);
            template.process(jadeModel, writer);
        }
コード例 #4
0
ファイル: JadeConfiguration.cs プロジェクト: rnrn/Jade4Net
 //throws JadeCompilerException
 public void renderTemplate(JadeTemplate template, Dictionary<String, Object> model, TextWriter writer)
 {
     JadeModel jadeModel = new JadeModel(sharedVariables);
     foreach (String filterName in filters.Keys)
     {
         jadeModel.addFilter(filterName, filters[filterName]);
     }
     jadeModel.putAll(model);
     template.process(jadeModel, writer);
 }