Examples of defineTemplate()


Examples of org.stringtemplate.v4.STGroup.defineTemplate()

    assertEquals(expecting, result);
  }

  @Test public void testIndentedIFWithNewlineBeforeText() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("t", "x",
      "begin"+newline+
      "    <if(x)>\n" +
      "foo\n" // no indent; ignore IF indent
      "    <endif>"+newline+    // ignore indent on if-tags on line by themselves
      "end"+newline);
View Full Code Here

Examples of org.stringtemplate.v4.STGroup.defineTemplate()

    assertEquals(expecting, result);
  }

  @Test public void testIndentedIFWithEndifNextLine() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("t", "x",
      "begin"+newline+
      "    <if(x)>foo\n" +      // use indent and keep newline
      "    <endif>"+newline+    // ignore indent on if-tags on line by themselves
      "end"+newline);
    ST t = group.getInstanceOf("t");
View Full Code Here

Examples of org.stringtemplate.v4.STGroup.defineTemplate()

    assertEquals(expected, result);
  }

    @Test public void testDefineTemplate() throws Exception {
        STGroup group = new STGroup();
        group.defineTemplate("inc", "x", "<x>+1");
        group.defineTemplate("test", "name", "hi <name>!");
        ST st = group.getInstanceOf("test");
        st.add("name", "Ter");
        st.add("name", "Tom");
        st.add("name", "Sumana");
View Full Code Here

Examples of org.stringtemplate.v4.STGroup.defineTemplate()

  }

    @Test public void testDefineTemplate() throws Exception {
        STGroup group = new STGroup();
        group.defineTemplate("inc", "x", "<x>+1");
        group.defineTemplate("test", "name", "hi <name>!");
        ST st = group.getInstanceOf("test");
        st.add("name", "Ter");
        st.add("name", "Tom");
        st.add("name", "Sumana");
        String expected =
View Full Code Here

Examples of org.stringtemplate.v4.STGroup.defineTemplate()

        assertEquals(expected, result);
    }

  @Test public void testMap() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("inc", "x", "[<x>]");
    group.defineTemplate("test", "name", "hi <name:inc()>!");
    ST st = group.getInstanceOf("test");
    st.add("name", "Ter");
    st.add("name", "Tom");
    st.add("name", "Sumana");
View Full Code Here

Examples of org.stringtemplate.v4.STGroup.defineTemplate()

    }

  @Test public void testMap() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("inc", "x", "[<x>]");
    group.defineTemplate("test", "name", "hi <name:inc()>!");
    ST st = group.getInstanceOf("test");
    st.add("name", "Ter");
    st.add("name", "Tom");
    st.add("name", "Sumana");
    String expected =
View Full Code Here

Examples of org.stringtemplate.v4.STGroup.defineTemplate()

    assertEquals(expected, result);
  }

  @Test public void testIndirectMap() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("inc", "x", "[<x>]");
    group.defineTemplate("test", "t,name", "<name:(t)()>!");
    ST st = group.getInstanceOf("test");
    st.add("t", "inc");
    st.add("name", "Ter");
    st.add("name", "Tom");
View Full Code Here

Examples of org.stringtemplate.v4.STGroup.defineTemplate()

  }

  @Test public void testIndirectMap() throws Exception {
    STGroup group = new STGroup();
    group.defineTemplate("inc", "x", "[<x>]");
    group.defineTemplate("test", "t,name", "<name:(t)()>!");
    ST st = group.getInstanceOf("test");
    st.add("t", "inc");
    st.add("name", "Ter");
    st.add("name", "Tom");
    st.add("name", "Sumana");
View Full Code Here

Examples of org.stringtemplate.v4.STGroup.defineTemplate()

        assertEquals(expected, result);
    }

    @Test public void testParallelMap() throws Exception {
        STGroup group = new STGroup();
        group.defineTemplate("test", "names,phones", "hi <names,phones:{n,p | <n>:<p>;}>");
        ST st = group.getInstanceOf("test");
        st.add("names", "Ter");
        st.add("names", "Tom");
        st.add("names", "Sumana");
        st.add("phones", "x5001");
View Full Code Here

Examples of org.stringtemplate.v4.STGroup.defineTemplate()

        assertEquals(expected, result);
    }

    @Test public void testParallelMapWith3Versus2Elements() throws Exception {
        STGroup group = new STGroup();
        group.defineTemplate("test", "names,phones", "hi <names,phones:{n,p | <n>:<p>;}>");
        ST st = group.getInstanceOf("test");
        st.add("names", "Ter");
        st.add("names", "Tom");
        st.add("names", "Sumana");
        st.add("phones", "x5001");
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.