writeExampleHeader("demoRawTextCommands");
System.out.println(tofu.newRenderer(DEMO_RAW_TEXT_COMMANDS).setMsgBundle(msgBundle).render());
writeExampleHeader("demoPrint");
System.out.println(tofu.newRenderer(DEMO_PRINT)
.setData(new SoyMapData(DEMO_PRINT.BOO, "Boo!", DEMO_PRINT.TWO, 2))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoPrintDirectives");
System.out.println(tofu.newRenderer(DEMO_PRINT_DIRECTIVES)
.setData(ImmutableMap.of(DEMO_PRINT_DIRECTIVES.LONG_VAR_NAME,
"thisIsSomeRidiculouslyLongVariableName",
DEMO_PRINT_DIRECTIVES.ELEMENT_ID, "my_element_id",
DEMO_PRINT_DIRECTIVES.CSS_CLASS, "my_css_class"))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoAutoescapeTrue");
System.out.println(tofu.newRenderer(DEMO_AUTOESCAPE_TRUE)
.setData(new SoyMapData(DEMO_AUTOESCAPE_TRUE.ITALIC_HTML, "<i>italic</i>"))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoAutoescapeFalse");
System.out.println(tofu.newRenderer(DEMO_AUTOESCAPE_FALSE)
.setData(new SoyMapData(DEMO_AUTOESCAPE_FALSE.ITALIC_HTML, "<i>italic</i>"))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoMsg");
System.out.println(tofu.newRenderer(DEMO_MSG)
.setData(ImmutableMap.of(DEMO_MSG.NAME, "Ed",
DEMO_MSG.LABS_URL, "http://labs.google.com"))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoIf");
System.out.println(tofu.newRenderer(DEMO_IF)
.setData(new SoyMapData("pi", 3.14159)).setMsgBundle(msgBundle).render());
System.out.println(tofu.newRenderer(DEMO_IF)
.setData(new SoyMapData("pi", 2.71828)).setMsgBundle(msgBundle).render());
System.out.println(tofu.newRenderer(DEMO_IF)
.setData(new SoyMapData("pi", 1.61803)).setMsgBundle(msgBundle).render());
writeExampleHeader("demoSwitch");
System.out.println(tofu.newRenderer(DEMO_SWITCH)
.setData(ImmutableMap.of("name", "Fay")).setMsgBundle(msgBundle).render());
System.out.println(tofu.newRenderer(DEMO_SWITCH)
.setData(ImmutableMap.of("name", "Go")).setMsgBundle(msgBundle).render());
System.out.println(tofu.newRenderer(DEMO_SWITCH)
.setData(ImmutableMap.of("name", "Hal")).setMsgBundle(msgBundle).render());
System.out.println(tofu.newRenderer(DEMO_SWITCH)
.setData(ImmutableMap.of("name", "Ivy")).setMsgBundle(msgBundle).render());
writeExampleHeader("demoForeach");
SoyListData persons = new SoyListData();
persons.add(new SoyMapData("name", "Jen", "numWaffles", 1));
persons.add(new SoyMapData("name", "Kai", "numWaffles", 3));
persons.add(new SoyMapData("name", "Lex", "numWaffles", 1));
persons.add(new SoyMapData("name", "Mel", "numWaffles", 2));
System.out.println(tofu.newRenderer(DEMO_FOREACH)
.setData(new SoyMapData(DEMO_FOREACH.PERSONS, persons))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoFor");
System.out.println(tofu.newRenderer(DEMO_FOR)
.setData(new SoyMapData(DEMO_FOR.NUM_LINES, 3))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoCallWithoutParam");
System.out.println(tofu.newRenderer(DEMO_CALL_WITHOUT_PARAM)
.setData(new SoyMapData(
DEMO_CALL_WITHOUT_PARAM.NAME, "Neo",
DEMO_CALL_WITHOUT_PARAM.TRIP_INFO,
new SoyMapData("name", "Neo", "destination", "The Matrix")))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoCallWithParam");
System.out.println(tofu.newRenderer(DEMO_CALL_WITH_PARAM)
.setData(ImmutableMap.of(
DEMO_CALL_WITH_PARAM.NAME, "Oz",
DEMO_CALL_WITH_PARAM.COMPANION_NAME, "Pip",
DEMO_CALL_WITH_PARAM.DESTINATIONS,
ImmutableList.of("Gillikin Country", "Munchkin Country",
"Quadling Country", "Winkie Country")))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoCallWithParamBlock");
System.out.println(tofu.newRenderer(DEMO_CALL_WITH_PARAM_BLOCK)
.setData(new SoyMapData(DEMO_CALL_WITH_PARAM_BLOCK.NAME, "Quo"))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoExpressions");
SoyListData students = new SoyListData();
students.add(new SoyMapData("name", "Rob", "major", "Physics", "year", 1999));
students.add(new SoyMapData("name", "Sha", "major", "Finance", "year", 1980));
students.add(new SoyMapData("name", "Tim", "major", "Engineering", "year", 2005));
students.add(new SoyMapData("name", "Uma", "major", "Biology", "year", 1972));
System.out.println(tofu.newRenderer(DEMO_EXPRESSIONS)
.setData(new SoyMapData(DEMO_EXPRESSIONS.STUDENTS, students,
DEMO_EXPRESSIONS.CURRENT_YEAR, 2008))
.setMsgBundle(msgBundle)
.render());
writeExampleHeader("demoDoubleBraces");