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