public void testEachLoopWithIterableMap() { Dictionary <string, string> users = new Dictionary <string, string>(); users.Add("bob", "Robert Smith"); users.Add("alex", "Alex Supertramp"); Dictionary <String, Object> root = new Dictionary <String, Object>(); root.Add("users", users); JadeModel model = new JadeModel(root); JadeTemplate temp = cfg.getTemplate(getResourcePath("each_loop")); StringWriter outStream = new StringWriter(); try { temp.process(model, outStream); } catch (JadeCompilerException e) { Trace.WriteLine(e); Assert.Fail(); } outStream.Flush(); Assert.AreEqual("<ul><li>Robert Smith</li><li>Alex Supertramp</li></ul>", outStream.ToString()); }
public static void render(String filename, Dictionary <String, Object> model, TextWriter writer, bool pretty) // throws IOException,JadeCompilerException { JadeTemplate template = getTemplate(filename); template.setPrettyPrint(pretty); template.process(new JadeModel(model), writer); }
private static String templateToString(JadeTemplate template, Dictionary <String, Object> model) // throws JadeCompilerException { JadeModel jadeModel = new JadeModel(model); StringWriter writer = new StringWriter(); template.process(jadeModel, writer); return(writer.ToString()); }
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); }
public void testFullRun() { Dictionary <String, Object> root = new Dictionary <String, Object>(); root.Add("hello", "world"); root.Add("hallo", null); JadeModel model = new JadeModel(root); JadeTemplate temp = cfg.getTemplate(getResourcePath("fullrun")); StringWriter outStream = new StringWriter(); try { temp.process(model, outStream); } catch (JadeCompilerException e) { Trace.WriteLine(e); Assert.Fail(); } outStream.Flush(); Assert.AreEqual("<div><div>Hi everybody</div></div>", outStream.ToString()); }
// throws JadeCompilerException public static void render(JadeTemplate template, Dictionary<String, Object> model, TextWriter writer, bool pretty) { template.setPrettyPrint(pretty); template.process(new JadeModel(model), writer); }
// throws JadeCompilerException private static String templateToString(JadeTemplate template, Dictionary<String, Object> model) { JadeModel jadeModel = new JadeModel(model); StringWriter writer = new StringWriter(); template.process(jadeModel, writer); return writer.ToString(); }
//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); }