Package com.google.template.soy.soytree

Examples of com.google.template.soy.soytree.SoyFileSetNode


      String outputPathFormat, String inputFilePathPrefix, SoyJsSrcOptions jsSrcOptions,
      List<String> locales, @Nullable String messageFilePathFormat)
      throws SoySyntaxException, IOException {

    boolean doEnforceSyntaxVersionV2 = ! jsSrcOptions.shouldAllowDeprecatedSyntax();
    SoyFileSetNode soyTree = (new SoyFileSetParser(soyFileSuppliers))
        .setDoEnforceSyntaxVersionV2(doEnforceSyntaxVersionV2).parse();
    runMiddleendPasses(soyTree, doEnforceSyntaxVersionV2);

    if (locales.size() == 0) {
      // Not generating localized JS.
      jsSrcMainProvider.get().genJsFiles(
          soyTree, jsSrcOptions, null, null, outputPathFormat, inputFilePathPrefix);

    } else {
      // Generating localized JS.
      for (String locale : locales) {

        SoyFileSetNode soyTreeClone = soyTree.clone();

        String msgFilePath =
            JsSrcUtils.buildFilePath(messageFilePathFormat, locale, null, inputFilePathPrefix);

        SoyMsgBundle msgBundle =
View Full Code Here


        "      {/msg}\n" +
        "    {/foreach}\n" +
        "  {/if}\n" +
        "{/template}\n";

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(testFileContent);

    TemplateNode template = soyTree.getChild(0).getChild(0);
    PrintNode a = (PrintNode) template.getChild(0);
    PrintNode bc = (PrintNode) template.getChild(1);
    IfNode ifNode = (IfNode) template.getChild(2);
    IfCondNode ifCondNode = (IfCondNode) ifNode.getChild(0);
    PrintNode e = (PrintNode) ifCondNode.getChild(0);
View Full Code Here

    for (String soyFileContent : soyFileContents) {
      soyFileSuppliers.add(SoyFileSupplier.Factory.create(
          soyFileContent, SoyFileKind.SRC, "no-path"));
    }

    SoyFileSetNode soyTree =
        (new SoyFileSetParser(soyFileSuppliers))
            .setDoRunInitialParsingPasses(doRunInitialParsingPasses)
            .setDoRunCheckingPasses(false)
            .parse();
    return soyTree;
View Full Code Here

        "/** @param goo */\n" +
        "{template name=\".foo\"}\n" +
        "  Blah{$goo}blah\n" +
        "{/template}\n";

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(testFileContent);
    TemplateNode template = (TemplateNode) SharedTestUtils.getNode(soyTree);
    template.addChild(new RawTextNode(0, "bleh"));
    template.addChild(new RawTextNode(0, "bluh"));

    assertEquals(5, template.numChildren());
View Full Code Here

        "               4 -->\n" +
        "  {$boo}\n" +
        "  <!-- comment 5 -->\n" +
        "{/template}\n";

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(testFileContent);
    TemplateNode template = (TemplateNode) SharedTestUtils.getNode(soyTree);

    // Before.
    assertEquals(7, template.numChildren());
View Full Code Here

        "  {/for}\n" +
        "{ifempty}\n" +
        "  {$boo}{$moo}\n" +
        "{/foreach}\n" +
        "{$boo}{$moo}\n";
    SoyFileSetNode soyTree = SharedTestUtils.parseSoyCode(soyCode);

    DataRefNode boo1 = (DataRefNode)
        ((PrintNode) SharedTestUtils.getNode(soyTree, 0)).getExprUnion().getExpr().getChild(0);
    DataRefNode moo1 = (DataRefNode)
        ((PrintNode) SharedTestUtils.getNode(soyTree, 1)).getExprUnion().getExpr().getChild(0);
View Full Code Here


  private static void runSoyFilesTestHelper(String... soyFileContents)
      throws SoySyntaxException {

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(soyFileContents);

    (new CheckSoyDocVisitor(false)).exec(soyTree);
  }
View Full Code Here

        "/***/\n" +
        "{template .ddd}\n" +
        "  {$ij.boo} {$ij.moo} {round($ij.zoo)}\n" +
        "{/template}\n";

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(fileContent);
    TemplateRegistry templateRegistry = new TemplateRegistry(soyTree);

    TemplateNode aaa = soyTree.getChild(0).getChild(0);
    TemplateNode bbb = soyTree.getChild(0).getChild(1);
    TemplateNode ccc = soyTree.getChild(0).getChild(2);
    TemplateNode ddd = soyTree.getChild(0).getChild(3);

    // Test with exec(aaa).
    // Exercises: processCalleeHelper case 5 with incorporateCalleeVisitInfo case 1 (aaa -> bbb).
    FindIjParamsVisitor fuipv = new FindIjParamsVisitor(templateRegistry);
    fuipv.exec(aaa);
View Full Code Here

        "/***/\n" +
        "{template .ccc}\n" +
        "  {$ij.boo} {$ij.moo + $ij.woo} {call .bbb /}\n" +
        "{/template}\n";

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(fileContent);
    TemplateRegistry templateRegistry = new TemplateRegistry(soyTree);

    TemplateNode aaa = soyTree.getChild(0).getChild(0);
    TemplateNode bbb = soyTree.getChild(0).getChild(1);
    TemplateNode ccc = soyTree.getChild(0).getChild(2);

    // Test with exec(aaa).
    // Exercises: processCalleeHelper case 4 with incorporateCalleeVisitInfo case 1 (ccc -> bbb).
    FindIjParamsVisitor fuipv = new FindIjParamsVisitor(templateRegistry);
    fuipv.exec(aaa);
View Full Code Here

        "/***/\n" +
        "{template .ccc}\n" +
        "  {$ij.boo} {call .bbb /} {$ij.moo}\n" +
        "{/template}\n";

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(fileContent);
    TemplateRegistry templateRegistry = new TemplateRegistry(soyTree);

    TemplateNode aaa = soyTree.getChild(0).getChild(0);
    TemplateNode bbb = soyTree.getChild(0).getChild(1);
    TemplateNode ccc = soyTree.getChild(0).getChild(2);

    // Test with exec(aaa).
    // Exercises: processCalleeHelper case 2 (bbb -> bbb).
    // Exercises: processCalleeHelper case 3 (ccc -> bbb).
    // Exercises: processCalleeHelper case 5 with incorporateCalleeVisitInfo case 2 (bbb -> ccc).
View Full Code Here

TOP

Related Classes of com.google.template.soy.soytree.SoyFileSetNode

Copyright © 2018 www.massapicom. 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.