hgweb: use registrar to declare "websub" template filter
authorYuya Nishihara <yuya@tcha.org>
Mon, 19 Mar 2018 20:39:06 +0900
changeset 37221 307ee8883975
parent 37220 7f78de1c93aa
child 37222 54355c243042
hgweb: use registrar to declare "websub" template filter Prepares for adding 'intype' attribute.
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Sun Mar 25 12:15:33 2018 +0900
+++ b/mercurial/hgweb/hgweb_mod.py	Mon Mar 19 20:39:06 2018 +0900
@@ -27,6 +27,7 @@
     hook,
     profiling,
     pycompat,
+    registrar,
     repoview,
     templatefilters,
     templater,
@@ -170,6 +171,9 @@
                              or req.apppath
                              or self.repo.root)
 
+        filters = {}
+        templatefilter = registrar.templatefilter(filters)
+        @templatefilter('websub')
         def websubfilter(text):
             return templatefilters.websub(text, self.websubtable)
 
@@ -191,7 +195,7 @@
         }
         tres = formatter.templateresources(self.repo.ui, self.repo)
         tmpl = templater.templater.frommapfile(mapfile,
-                                               filters={'websub': websubfilter},
+                                               filters=filters,
                                                defaults=defaults,
                                                resources=tres)
         return tmpl