<dependency>
<groupId>net.webmacro</groupId>
<artifactId>webmacro</artifactId>
<version>1.0.0</version>
</dependency>
groovy
implementation 'net.webmacro:webmacro:1.0.0'
html
<html>
<head>
<title>Hello WebMacro!</title>
</head>
<body>
<h1>Hello, $name!</h1>
<p>Welcome to WebMacro!</p>
</body>
</html>
import net.webmacro.*;
import net.webmacro.engine.*;
public class WebMacroTutorial {
public static void main(String[] args) {
Engine engine = new Engine();
try {
String templatePath = "path/to/template.wm";
Template template = engine.getTemplate(templatePath);
Context context = new Context();
context.setVariable("name", "John");
String html = template.apply(context);
System.out.println(html);
} catch (Exception e) {
e.printStackTrace();
}
}
}