Examples of newRenderer()


Examples of com.google.template.soy.tofu.SoyTofu.newRenderer()

    SoyFileSet sfs = (new SoyFileSet.Builder()).add(Resources.getResource("simple.soy")).build();
    SoyTofu tofu = sfs.compileToTofu();

    // Example 1.
    writeExampleHeader();
    System.out.println(tofu.newRenderer("soy.examples.simple.helloWorld").render());

    // Create a namespaced tofu object to make calls more concise.
    SoyTofu simpleTofu = tofu.forNamespace("soy.examples.simple");

    // Example 2.
View Full Code Here

Examples of com.google.template.soy.tofu.SoyTofu.newRenderer()

    // Create a namespaced tofu object to make calls more concise.
    SoyTofu simpleTofu = tofu.forNamespace("soy.examples.simple");

    // Example 2.
    writeExampleHeader();
    System.out.println(simpleTofu.newRenderer(".helloName")
        .setData(new SoyMapData("name", "Ana")).render());

    // Example 3.
    writeExampleHeader();
    System.out.println(simpleTofu.newRenderer(".helloNames")
View Full Code Here

Examples of com.google.template.soy.tofu.SoyTofu.newRenderer()

    System.out.println(simpleTofu.newRenderer(".helloName")
        .setData(new SoyMapData("name", "Ana")).render());

    // Example 3.
    writeExampleHeader();
    System.out.println(simpleTofu.newRenderer(".helloNames")
        .setData(new SoyMapData("names", new SoyListData("Bob", "Cid", "Dee")))
        .render());
  }

View Full Code Here

Examples of com.google.template.soy.tofu.SoyTofu.newRenderer()

    // takes a SoyMapData is more efficient if you need to reuse the same template data object for
    // multiple calls of render() (because the version that takes a Map<String, ?> internally
    // converts it to a new SoyMapData on every call).

    writeExampleHeader("demoComments");
    System.out.println(tofu.newRenderer(DEMO_COMMENTS).setMsgBundle(msgBundle).render());

    writeExampleHeader("demoLineJoining");
    System.out.println(tofu.newRenderer(DEMO_LINE_JOINING).setMsgBundle(msgBundle).render());

    writeExampleHeader("demoRawTextCommands");
View Full Code Here

Examples of com.google.template.soy.tofu.SoyTofu.newRenderer()

    writeExampleHeader("demoComments");
    System.out.println(tofu.newRenderer(DEMO_COMMENTS).setMsgBundle(msgBundle).render());

    writeExampleHeader("demoLineJoining");
    System.out.println(tofu.newRenderer(DEMO_LINE_JOINING).setMsgBundle(msgBundle).render());

    writeExampleHeader("demoRawTextCommands");
    System.out.println(tofu.newRenderer(DEMO_RAW_TEXT_COMMANDS).setMsgBundle(msgBundle).render());

    writeExampleHeader("demoPrint");
View Full Code Here

Examples of com.google.template.soy.tofu.SoyTofu.newRenderer()

    writeExampleHeader("demoLineJoining");
    System.out.println(tofu.newRenderer(DEMO_LINE_JOINING).setMsgBundle(msgBundle).render());

    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)
View Full Code Here

Examples of com.google.template.soy.tofu.SoyTofu.newRenderer()

    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");
View Full Code Here

Examples of com.google.template.soy.tofu.SoyTofu.newRenderer()

        .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)
View Full Code Here

Examples of com.google.template.soy.tofu.SoyTofu.newRenderer()

                                 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");
View Full Code Here

Examples of com.google.template.soy.tofu.SoyTofu.newRenderer()

        .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");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.