use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testTagline.
@Test
public void testTagline() throws IOException, ParseException {
String srcFile = "tests/tagline.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("tagline.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String code = bt.javaSource;
System.out.println(code);
CompilationUnit cu = JavaSyntaxTool.parse(code);
// System.out.println(cu);
}
use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testTagNamedArgsWithBody.
@Test
public void testTagNamedArgsWithBody() throws IOException, ParseException {
String srcFile = "tests/callTagWithBody.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("tests/callTagWithBody.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
String code = bt.javaSource;
assertTrue("invalid java code", JavaSyntaxTool.isValid(code));
System.out.println(code);
}
use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testInclude.
@Test
public void testInclude() throws IOException, ParseException {
String srcFile = "tests/include.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate(srcFile, src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
System.out.println(bt.javaSource);
assertTrue("invalid java code", JavaSyntaxTool.isValid(bt.javaSource));
}
use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testTemplateWithCallbackTagCalls.
@Test
public void testTemplateWithCallbackTagCalls() throws IOException, ParseException {
String src = readFile("JapidSample/app/japidviews/templates/AllPost.html");
JapidTemplate bt = new JapidTemplate("japidviews/templates/AllPost.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
System.out.println(bt.javaSource);
CompilationUnit cu = JavaSyntaxTool.parse(bt.javaSource);
System.out.println(cu);
// assertTrue("invalid java code", JavaSyntaxValidator.isValid(bt.javaSource));
}
use of cn.bran.japid.compiler.JapidTemplateCompiler in project Japid by branaway.
the class CompilerTests method testLog.
@Test
public void testLog() throws IOException, ParseException {
String srcFile = "JapidSample/app/japidviews/templates/log.html";
String src = readFile(srcFile);
JapidTemplate bt = new JapidTemplate("japidviews/templates/Actions.html", src);
JapidAbstractCompiler cp = new JapidTemplateCompiler();
cp.compile(bt);
CompilationUnit cu = JavaSyntaxTool.parse(bt.javaSource);
System.out.println(cu);
}
Aggregations