##// END OF EJS Templates
help: pass around ui to rewriter hooks (API)...
Yuya Nishihara -
r26414:c44b507e default
parent child Browse files
Show More
@@ -144,7 +144,7 b' def loaddoc(topic):'
144 path = os.path.join(docdir, topic + ".txt")
144 path = os.path.join(docdir, topic + ".txt")
145 doc = gettext(util.readfile(path))
145 doc = gettext(util.readfile(path))
146 for rewriter in helphooks.get(topic, []):
146 for rewriter in helphooks.get(topic, []):
147 doc = rewriter(topic, doc)
147 doc = rewriter(ui, topic, doc)
148 return doc
148 return doc
149
149
150 return loader
150 return loader
@@ -184,7 +184,7 b' helphooks = {}'
184 def addtopichook(topic, rewriter):
184 def addtopichook(topic, rewriter):
185 helphooks.setdefault(topic, []).append(rewriter)
185 helphooks.setdefault(topic, []).append(rewriter)
186
186
187 def makeitemsdoc(topic, doc, marker, items, dedent=False):
187 def makeitemsdoc(ui, topic, doc, marker, items, dedent=False):
188 """Extract docstring from the items key to function mapping, build a
188 """Extract docstring from the items key to function mapping, build a
189 single documentation block and use it to overwrite the marker in doc.
189 single documentation block and use it to overwrite the marker in doc.
190 """
190 """
@@ -211,8 +211,8 b' def makeitemsdoc(topic, doc, marker, ite'
211 return doc.replace(marker, entries)
211 return doc.replace(marker, entries)
212
212
213 def addtopicsymbols(topic, marker, symbols, dedent=False):
213 def addtopicsymbols(topic, marker, symbols, dedent=False):
214 def add(topic, doc):
214 def add(ui, topic, doc):
215 return makeitemsdoc(topic, doc, marker, symbols, dedent=dedent)
215 return makeitemsdoc(ui, topic, doc, marker, symbols, dedent=dedent)
216 addtopichook(topic, add)
216 addtopichook(topic, add)
217
217
218 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
218 addtopicsymbols('filesets', '.. predicatesmarker', fileset.symbols)
@@ -985,7 +985,7 b' Test help hooks'
985 $ cat > helphook1.py <<EOF
985 $ cat > helphook1.py <<EOF
986 > from mercurial import help
986 > from mercurial import help
987 >
987 >
988 > def rewrite(topic, doc):
988 > def rewrite(ui, topic, doc):
989 > return doc + '\nhelphook1\n'
989 > return doc + '\nhelphook1\n'
990 >
990 >
991 > def extsetup(ui):
991 > def extsetup(ui):
@@ -994,7 +994,7 b' Test help hooks'
994 $ cat > helphook2.py <<EOF
994 $ cat > helphook2.py <<EOF
995 > from mercurial import help
995 > from mercurial import help
996 >
996 >
997 > def rewrite(topic, doc):
997 > def rewrite(ui, topic, doc):
998 > return doc + '\nhelphook2\n'
998 > return doc + '\nhelphook2\n'
999 >
999 >
1000 > def extsetup(ui):
1000 > def extsetup(ui):
General Comments 0
You need to be logged in to leave comments. Login now