use of org.beetl.core.GroupTemplate in project beetl2.0 by javamonkey.
the class PairDLTest method getGt.
public GroupTemplate getGt() {
ClasspathResourceLoader rs = new ClasspathResourceLoader("/template");
Configuration cfg;
try {
cfg = Configuration.defaultConfiguration();
} catch (IOException e) {
throw new RuntimeException(e);
}
cfg.setStatementEnd("%>");
cfg.setStatementStart("<%");
GroupTemplate gt = new GroupTemplate(rs, cfg);
return gt;
}
use of org.beetl.core.GroupTemplate in project beetl2.0 by javamonkey.
the class PairDLTest method testPair.
@Test
public void testPair() throws Exception {
GroupTemplate newGt = getGt();
Template t = newGt.getTemplate("/text/pair_template.html");
String str = t.render();
AssertJUnit.assertEquals(this.getFileContent("/text/pair_expected.html"), str);
}
use of org.beetl.core.GroupTemplate in project beetl2.0 by javamonkey.
the class MetaCopyTest method main.
public static void main(String[] args) throws Exception {
String home = System.getProperty("user.dir") + File.separator + "template" + File.separator;
Configuration cf = Configuration.defaultConfiguration();
FileResourceLoader rs = new FileResourceLoader(home, cf.getCharset());
GroupTemplate gt = new GroupTemplate(rs, cf);
Template t = gt.getTemplate("/helloworld.html");
Program p = gt.getProgram("/helloworld.html");
ProgramMetaData old = p.metaData;
ProgramMetaData copy = old.copy();
System.out.println("ok");
}
use of org.beetl.core.GroupTemplate in project beetl2.0 by javamonkey.
the class ClasspathRL method main.
public static void main(String[] args) throws Exception {
ClasspathResourceLoader resourceLoader = new ClasspathResourceLoader();
URL url = resourceLoader.getClass().getResource("/org/beetl/sample/s01/hello.txt");
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
Template t = gt.getTemplate("/org/beetl/sample/s01/hello.txt");
String str = t.render();
System.out.println(str);
}
use of org.beetl.core.GroupTemplate in project beetl2.0 by javamonkey.
the class FilePathRL method main.
public static void main(String[] args) throws Exception {
String root = System.getProperty("user.dir") + File.separator + "template";
FileResourceLoader resourceLoader = new FileResourceLoader(root, "utf-8");
Configuration cfg = Configuration.defaultConfiguration();
GroupTemplate gt = new GroupTemplate(resourceLoader, cfg);
Template t = gt.getTemplate("/s01/hello.txt");
String str = t.render();
System.out.println(str);
}
Aggregations