mercurial/templatefilters.py
changeset 18627 4e949b8e0930
parent 17772 823a7d79ef82
child 18731 c2d079387b2c
--- a/mercurial/templatefilters.py	Tue Feb 05 14:36:19 2013 -0800
+++ b/mercurial/templatefilters.py	Fri Feb 08 18:05:32 2013 +0100
@@ -391,6 +391,15 @@
     "xmlescape": xmlescape,
 }
 
+def websub(text, websubtable):
+    """:websub: Any text. Only applies to hgweb. Applies the regular
+    expression replacements defined in the websub section.
+    """
+    if websubtable:
+        for regexp, format in websubtable:
+            text = regexp.sub(format, text)
+    return text
+
 def fillfunc(context, mapping, args):
     if not (1 <= len(args) <= 2):
         raise error.ParseError(_("fill expects one or two arguments"))