28 lines
698 B
Java
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);
|
|
}
|
|
}
|