changeset 37223:307ee8883975

hgweb: use registrar to declare "websub" template filter Prepares for adding 'intype' attribute.
author Yuya Nishihara <yuya@tcha.org>
date Mon, 19 Mar 2018 20:39:06 +0900
parents 7f78de1c93aa
children 54355c243042
files mercurial/hgweb/hgweb_mod.py
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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