mercurial/registrar.py
changeset 28692 6b3b958daf03
parent 28538 009f58f1ea75
child 28695 cc103bd0dbf9
--- a/mercurial/registrar.py	Sun Feb 14 20:43:30 2016 +0900
+++ b/mercurial/registrar.py	Wed Mar 30 02:10:44 2016 +0900
@@ -191,3 +191,28 @@
 
     Otherwise, explicit 'templatekw.loadkeyword()' is needed.
     """
+
+class templatefilter(_templateregistrarbase):
+    """Decorator to register template filer
+
+    Usage::
+
+        templatefilter = registrar.templatefilter()
+
+        @templatefilter('myfilter')
+        def myfilterfunc(text):
+            '''Explanation of this template filter ....
+            '''
+            pass
+
+    The first string argument is used also in online help.
+
+    'templatefilter' instance in example above can be used to
+    decorate multiple functions.
+
+    Decorated functions are registered automatically at loading
+    extension, if an instance named as 'templatefilter' is used for
+    decorating in extension.
+
+    Otherwise, explicit 'templatefilters.loadkeyword()' is needed.
+    """