blog-software-java/src/main/java/eu/m724/blog/Renderer.java
2025-01-07 11:41:30 +01:00

28 lines
698 B
Java

package eu.m724.blog;
import com.google.common.io.Resources;
import com.hubspot.jinjava.Jinjava;
import eu.m724.blog.data.Site;
import org.apache.commons.net.nntp.Article;
import java.util.Map;
public class Renderer {
private final
public void renderIndex(Site site, Article... articles) {
}
public void renderArticle(Site site, Article article) {
Jinjava jinjava = new Jinjava();
Map<String, Object> context = Map.of(
"site", site,
"article", article
);
String template = Resources.toString(Resources.getResource("my-template.html"), Charsets.UTF_8);
return jinjava.render(template, context);
}
}