From: David ‘Bombe’ Roden Date: Fri, 27 Jul 2012 23:37:19 +0000 (+0200) Subject: Add match filter to templates. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=1b616c89a6518af37a55f35123e2252658fa56b2;p=demoscenemusic.git Add match filter to templates. --- diff --git a/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java b/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java index df753f1..a159e8a 100644 --- a/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java +++ b/src/main/java/net/pterodactylus/demoscenemusic/core/TemplateServlet.java @@ -52,6 +52,7 @@ import net.pterodactylus.util.io.StreamCopier; import net.pterodactylus.util.template.ClassPathTemplateProvider; import net.pterodactylus.util.template.CollectionSortFilter; import net.pterodactylus.util.template.HtmlFilter; +import net.pterodactylus.util.template.MatchFilter; import net.pterodactylus.util.template.ReflectionAccessor; import net.pterodactylus.util.template.Template; import net.pterodactylus.util.template.TemplateContextFactory; @@ -68,6 +69,7 @@ import net.pterodactylus.util.web.Response; public class TemplateServlet extends HttpServlet { private Core core; + private final TemplateContextFactory templateContextFactory = new TemplateContextFactory(); private final Map> pages = new HashMap>(); @@ -116,6 +118,7 @@ public class TemplateServlet extends HttpServlet { }); templateContextFactory.addFilter("sort", sortFilter); + templateContextFactory.addFilter("matches", new MatchFilter()); templateContextFactory.addTemplateObject("core", core); templateContextFactory.addTemplateObject("dataManager", core.getDataManager());