mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00

Still missing is a proper build, we're currently pulling in tailwind from a CDN, which is no bueno in prod. There's also a lot of polish remaining everywhere, dead links, etc.
30 lines
902 B
Java
30 lines
902 B
Java
package nu.marginalia.search;
|
|
|
|
import gg.jte.CodeResolver;
|
|
import gg.jte.ContentType;
|
|
import gg.jte.TemplateEngine;
|
|
import gg.jte.output.StringOutput;
|
|
import gg.jte.resolve.ResourceCodeResolver;
|
|
import jakarta.inject.Singleton;
|
|
|
|
import java.util.Map;
|
|
|
|
@Singleton
|
|
public class JteRenderer {
|
|
private final CodeResolver codeResolver = new ResourceCodeResolver("jte");
|
|
private final TemplateEngine templateEngine = TemplateEngine.create(codeResolver, ContentType.Html);
|
|
|
|
public String render(String template, Object model) {
|
|
StringOutput output = new StringOutput();
|
|
templateEngine.render(template, model, output);
|
|
return output.toString();
|
|
}
|
|
|
|
public String render(String template, Map<String, Object> models) {
|
|
StringOutput output = new StringOutput();
|
|
templateEngine.render(template, models, output);
|
|
return output.toString();
|
|
}
|
|
|
|
}
|