Package com.google.template.soy.soytree.TemplateNode

Examples of com.google.template.soy.soytree.TemplateNode.SoyFileHeaderInfo


    }

    ImmutableList.Builder<TemplateNode> b = ImmutableList.builder();

    for (TemplateNode tn : lookupTemplates(baseName)) {
      SoyFileHeaderInfo soyFileHeaderInfo = tn.getSoyFileHeaderInfo();

      int cloneId = tn.getNearestAncestor(SoyFileSetNode.class).getNodeIdGenerator().genId();

      // We need to use the unnamespaced name in the command text since we'll be inserting this
      // template into a file node that already has a namespace declaration.
View Full Code Here


    SoyFileSetNode soyTree = new SoyFileSetNode(0, null);

    SoyFileNode soyFile = new SoyFileNode(0, SoyFileKind.SRC, null, "boo", null);
    soyTree.addChild(soyFile);

    SoyFileHeaderInfo testSoyFileHeaderInfo = new SoyFileHeaderInfo("testNs");

    TemplateNode template1 =
        new TemplateBasicNode(0, testSoyFileHeaderInfo, "name=\".foo\"", "/** @param goo */");
    soyFile.addChild(template1);
    template1.addChild(new PrintNode(0, true, "$goo", null));
View Full Code Here


  public void testToSourceString() throws SoySyntaxException {

    TemplateNode tn = new TemplateBasicNode(
        0, new SoyFileHeaderInfo("testNs"), "name=\".boo\"",
        "/**" +
        " * Test template.\n" +
        " *\n" +
        " * @param foo Foo to print.\n" +
        " * @param goo\n" +
View Full Code Here

  }


  public void testInvalidDeclarations() throws SoySyntaxException {

    SoyFileHeaderInfo testSoyFileHeaderInfo = new SoyFileHeaderInfo("testNs");

    try {
      new TemplateBasicNode(0, testSoyFileHeaderInfo, ".boo", "/** @param $foo */");
      fail();
    } catch (SoySyntaxException sse) {
View Full Code Here

  public void testDuplicateParam() throws SoySyntaxException {

    try {
      new TemplateBasicNode(
          0, new SoyFileHeaderInfo("testNs"), ".boo", "/** @param foo @param goo @param? foo */");
      fail();
    } catch (SoySyntaxException sse) {
      assertTrue(sse.getMessage().contains("Duplicate declaration of param in SoyDoc: 'foo'."));
    }
  }
View Full Code Here

  public void testValidStrictTemplates() throws SoySyntaxException {
    TemplateNode node;

    node = new TemplateBasicNode(
        0, new SoyFileHeaderInfo("testNs"),
        ".boo kind=\"text\" autoescape=\"strict\"",
        "/** Strict template. */");
    assertEquals(AutoescapeMode.STRICT, node.getAutoescapeMode());
    assertEquals(ContentKind.TEXT, node.getContentKind());

    node = new TemplateBasicNode(
        0, new SoyFileHeaderInfo("testNs"),
        ".boo autoescape=\"strict\" kind=\"html\"",
        "/** Strict template. */");
    assertEquals(AutoescapeMode.STRICT, node.getAutoescapeMode());
    assertEquals(ContentKind.HTML, node.getContentKind());

    // "kind" is optional, defaults to HTML
    node = new TemplateBasicNode(
        0, new SoyFileHeaderInfo("testNs"),
        ".boo autoescape=\"strict\"",
        "/** Strict template. */");
    assertEquals(AutoescapeMode.STRICT, node.getAutoescapeMode());
    assertEquals(ContentKind.HTML, node.getContentKind());
  }
View Full Code Here


  public void testInvalidStrictTemplates() throws SoySyntaxException {
    try {
      new TemplateBasicNode(
          0, new SoyFileHeaderInfo("testNs"),
          ".boo kind=\"text\"",
          "/** Strict template. */");
      fail("Should be a syntax error");
    } catch (SoySyntaxException sse) {
      assertTrue(sse.getMessage().contains(
View Full Code Here

TOP

Related Classes of com.google.template.soy.soytree.TemplateNode.SoyFileHeaderInfo

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.