##// END OF EJS Templates
help: use new function for getting first line of string...
Martin von Zweigbergk -
r49888:7bd5f862 default
parent child Browse files
Show More
@@ -37,6 +37,7 b' from .hgweb import webcommands'
37 37 from .utils import (
38 38 compression,
39 39 resourceutil,
40 stringutil,
40 41 )
41 42
42 43 _exclkeywords = {
@@ -289,9 +290,8 b' def topicmatch(ui, commands, kw):'
289 290 func = entry[0]
290 291 docs = _(pycompat.getdoc(func)) or b''
291 292 if kw in cmd or lowercontains(summary) or lowercontains(docs):
292 doclines = docs.splitlines()
293 if doclines:
294 summary = doclines[0]
293 if docs:
294 summary = stringutil.firstline(docs)
295 295 cmdname = cmdutil.parsealiases(cmd)[0]
296 296 if filtercmd(ui, cmdname, func, kw, docs):
297 297 continue
@@ -305,7 +305,7 b' def topicmatch(ui, commands, kw):'
305 305 name = name.rpartition(b'.')[-1]
306 306 if lowercontains(name) or lowercontains(docs):
307 307 # extension docs are already translated
308 results[b'extensions'].append((name, docs.splitlines()[0]))
308 results[b'extensions'].append((name, stringutil.firstline(docs)))
309 309 try:
310 310 mod = extensions.load(ui, name, b'')
311 311 except ImportError:
@@ -317,7 +317,7 b' def topicmatch(ui, commands, kw):'
317 317 func = entry[0]
318 318 cmddoc = pycompat.getdoc(func)
319 319 if cmddoc:
320 cmddoc = gettext(cmddoc).splitlines()[0]
320 cmddoc = stringutil.firstline(gettext(cmddoc))
321 321 else:
322 322 cmddoc = _(b'(no help text available)')
323 323 if filtercmd(ui, cmdname, func, kw, cmddoc):
@@ -607,7 +607,7 b' def makeitemsdoc(ui, topic, doc, marker,'
607 607 # Abuse latin1 to use textwrap.dedent() on bytes.
608 608 text = textwrap.dedent(text.decode('latin1')).encode('latin1')
609 609 lines = text.splitlines()
610 doclines = [(lines[0])]
610 doclines = [lines[0]]
611 611 for l in lines[1:]:
612 612 # Stop once we find some Python doctest
613 613 if l.strip().startswith(b'>>>'):
@@ -677,7 +677,7 b' def _getcategorizedhelpcmds(ui, cmdtable'
677 677 doc = gettext(doc)
678 678 if not doc:
679 679 doc = _(b"(no help text available)")
680 h[f] = doc.splitlines()[0].rstrip()
680 h[f] = stringutil.firstline(doc).rstrip()
681 681
682 682 cat = getattr(func, 'helpcategory', None) or (
683 683 registrar.command.CATEGORY_NONE
@@ -1043,7 +1043,7 b' def help_('
1043 1043 cmd, ext, doc = extensions.disabledcmd(
1044 1044 ui, name, ui.configbool(b'ui', b'strict')
1045 1045 )
1046 doc = doc.splitlines()[0]
1046 doc = stringutil.firstline(doc)
1047 1047
1048 1048 rst = listexts(
1049 1049 _(b"'%s' is provided by the following extension:") % cmd,
General Comments 0
You need to be logged in to leave comments. Login now