##// END OF EJS Templates
help: distinguish sections when multiple match (issue4802)
timeless@mozdev.org -
r26113:9b70eda7 default
parent child Browse files
Show More
@@ -656,13 +656,17 b' def formatblocks(blocks, width):'
656 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
656 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
657 """Parse and format the text according to width."""
657 """Parse and format the text according to width."""
658 blocks, pruned = parse(text, indent, keep or [])
658 blocks, pruned = parse(text, indent, keep or [])
659 parents = []
659 if section:
660 if section:
660 sections = getsections(blocks)
661 sections = getsections(blocks)
661 blocks = []
662 blocks = []
662 i = 0
663 i = 0
663 while i < len(sections):
664 while i < len(sections):
664 name, nest, b = sections[i]
665 name, nest, b = sections[i]
666 del parents[nest:]
667 parents.append(name)
665 if name == section:
668 if name == section:
669 b[0]['path'] = parents[3:]
666 blocks.extend(b)
670 blocks.extend(b)
667
671
668 ## Also show all subnested sections
672 ## Also show all subnested sections
@@ -674,6 +678,14 b' def format(text, width=80, indent=0, kee'
674 if style == 'html':
678 if style == 'html':
675 text = formathtml(blocks)
679 text = formathtml(blocks)
676 else:
680 else:
681 if len([b for b in blocks if b['type'] == 'definition']) > 1:
682 i = 0
683 while i < len(blocks):
684 if blocks[i]['type'] == 'definition':
685 if 'path' in blocks[i]:
686 blocks[i]['lines'][0] = '"%s"' % '.'.join(
687 blocks[i]['path'])
688 i += 1
677 text = ''.join(formatblock(b, width) for b in blocks)
689 text = ''.join(formatblock(b, width) for b in blocks)
678 if keep is None:
690 if keep is None:
679 return text
691 return text
@@ -912,6 +912,16 b' Test a help topic'
912 working directory is checked out, it is equivalent to null. If an
912 working directory is checked out, it is equivalent to null. If an
913 uncommitted merge is in progress, "." is the revision of the first parent.
913 uncommitted merge is in progress, "." is the revision of the first parent.
914
914
915 Test repeated config section name
916
917 $ hg help config.host
918 "http_proxy.host"
919 Host name and (optional) port of the proxy server, for example
920 "myproxy:8000".
921
922 "smtp.host"
923 Host name of mail server, e.g. "mail.example.com".
924
915 Test templating help
925 Test templating help
916
926
917 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
927 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
General Comments 0
You need to be logged in to leave comments. Login now