mercurial/help.py
branchstable
changeset 12820 0edc0aa7432d
parent 12818 019b8e1e0402
child 12828 af1006d2f970
--- a/mercurial/help.py	Sat Oct 23 17:30:08 2010 +0200
+++ b/mercurial/help.py	Sat Oct 23 19:21:49 2010 +0200
@@ -79,7 +79,11 @@
                 break
 
         path = os.path.join(docdir, topic + ".txt")
-        return gettext(open(path).read())
+        doc = gettext(open(path).read())
+        for rewriter in helphooks.get(topic, []):
+            doc = rewriter(topic, doc)
+        return doc
+
     return loader
 
 helptable = [
@@ -102,3 +106,11 @@
     (["hgweb"], _("Configuring hgweb"), loaddoc('hgweb')),
     (["glossary"], _("Glossary"), loaddoc('glossary')),
 ]
+
+# Map topics to lists of callable taking the current topic help and
+# returning the updated version
+helphooks = {
+}
+
+def addtopichook(topic, rewriter):
+    helphooks.setdefault(topic, []).append(rewriter)