##// 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 656 def format(text, width=80, indent=0, keep=None, style='plain', section=None):
657 657 """Parse and format the text according to width."""
658 658 blocks, pruned = parse(text, indent, keep or [])
659 parents = []
659 660 if section:
660 661 sections = getsections(blocks)
661 662 blocks = []
662 663 i = 0
663 664 while i < len(sections):
664 665 name, nest, b = sections[i]
666 del parents[nest:]
667 parents.append(name)
665 668 if name == section:
669 b[0]['path'] = parents[3:]
666 670 blocks.extend(b)
667 671
668 672 ## Also show all subnested sections
@@ -674,6 +678,14 b' def format(text, width=80, indent=0, kee'
674 678 if style == 'html':
675 679 text = formathtml(blocks)
676 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 689 text = ''.join(formatblock(b, width) for b in blocks)
678 690 if keep is None:
679 691 return text
@@ -912,6 +912,16 b' Test a help topic'
912 912 working directory is checked out, it is equivalent to null. If an
913 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 925 Test templating help
916 926
917 927 $ hg help templating | egrep '(desc|diffstat|firstline|nonempty) '
General Comments 0
You need to be logged in to leave comments. Login now