##// END OF EJS Templates
help: consolidate topic hooks in help.py...
Matt Mackall -
r14318:1f46be46 default
parent child Browse files
Show More
@@ -13,7 +13,7 b' import hg, scmutil, util, revlog, extens'
13 13 import patch, help, url, encoding, templatekw, discovery
14 14 import archival, changegroup, cmdutil, sshserver, hbisect, hgweb, hgweb.server
15 15 import merge as mergemod
16 import minirst, revset, templatefilters
16 import minirst, revset
17 17 import dagparser, context, simplemerge
18 18 import random, setdiscovery, treediscovery, dagutil
19 19
@@ -2758,10 +2758,6 b' def help_(ui, name=None, with_version=Fa'
2758 2758 ui.write(_('use "hg help extensions" for information on enabling '
2759 2759 'extensions\n'))
2760 2760
2761 help.addtopichook('revsets', revset.makedoc)
2762 help.addtopichook('templates', templatekw.makedoc)
2763 help.addtopichook('templates', templatefilters.makedoc)
2764
2765 2761 if name and name != 'shortlist':
2766 2762 i = None
2767 2763 if unknowncmd:
@@ -248,7 +248,7 b' def _disabledhelp(path):'
248 248 except IOError:
249 249 return
250 250 else:
251 doc = moduledoc(file)
251 doc = _moduledoc(file)
252 252 file.close()
253 253
254 254 if doc: # extracting localized synopsis
@@ -7,7 +7,7 b''
7 7
8 8 from i18n import gettext, _
9 9 import sys, os
10 import extensions
10 import extensions, revset, templatekw, templatefilters
11 11 import util
12 12
13 13 def listexts(header, exts, indent=1):
@@ -76,8 +76,7 b' helptable = sorted(['
76 76
77 77 # Map topics to lists of callable taking the current topic help and
78 78 # returning the updated version
79 helphooks = {
80 }
79 helphooks = {}
81 80
82 81 def addtopichook(topic, rewriter):
83 82 helphooks.setdefault(topic, []).append(rewriter)
@@ -97,3 +96,12 b' def makeitemsdoc(topic, doc, marker, ite'
97 96 entries.append('\n'.join(lines))
98 97 entries = '\n\n'.join(entries)
99 98 return doc.replace(marker, entries)
99
100 def addtopicsymbols(topic, marker, symbols):
101 def add(topic, doc):
102 return makeitemsdoc(topic, doc, marker, symbols)
103 addtopichook(topic, add)
104
105 addtopicsymbols('revsets', '.. predicatesmarker', revset.symbols)
106 addtopicsymbols('templates', '.. keywordsmarker', templatekw.keywords)
107 addtopicsymbols('templates', '.. filtersmarker', templatefilters.filters)
@@ -6,7 +6,7 b''
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 import re
9 import parser, util, error, discovery, help, hbisect
9 import parser, util, error, discovery, hbisect
10 10 import bookmarks as bookmarksmod
11 11 import match as matchmod
12 12 from i18n import _
@@ -981,8 +981,5 b' def match(ui, spec):'
981 981 return getset(repo, subset, tree)
982 982 return mfunc
983 983
984 def makedoc(topic, doc):
985 return help.makeitemsdoc(topic, doc, '.. predicatesmarker', symbols)
986
987 984 # tell hggettext to extract docstrings from these functions:
988 985 i18nfunctions = symbols.values()
@@ -6,7 +6,7 b''
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 import cgi, re, os, time, urllib
9 import encoding, node, util, help
9 import encoding, node, util
10 10
11 11 def addbreaks(text):
12 12 """:addbreaks: Any text. Add an XHTML "<br />" tag before the end of
@@ -358,8 +358,5 b' filters = {'
358 358 "xmlescape": xmlescape,
359 359 }
360 360
361 def makedoc(topic, doc):
362 return help.makeitemsdoc(topic, doc, '.. filtersmarker', filters)
363
364 361 # tell hggettext to extract docstrings from these functions:
365 362 i18nfunctions = filters.values()
@@ -6,7 +6,7 b''
6 6 # GNU General Public License version 2 or any later version.
7 7
8 8 from node import hex
9 import patch, util, error, help
9 import patch, util, error
10 10
11 11 def showlist(name, values, plural=None, **args):
12 12 '''expand set of values.
@@ -313,8 +313,5 b' keywords = {'
313 313 'tags': showtags,
314 314 }
315 315
316 def makedoc(topic, doc):
317 return help.makeitemsdoc(topic, doc, '.. keywordsmarker', keywords)
318
319 316 # tell hggettext to extract docstrings from these functions:
320 317 i18nfunctions = keywords.values()
General Comments 0
You need to be logged in to leave comments. Login now