comparison mercurial/minirst.py @ 22770:de9424647fe4

help: show all nested subsections of a section with `hg help foo.section` Used to be that `hg help hgrc.paths` would show "paths" ------- Assigns symbolic names to repositories. The left side is the symbolic name, and the right gives the directory or URL that is the location of the repository. Default paths can be declared by setting the following entries. and stop there. Obviously the result seems better as shown in the attached test.
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Mon, 06 Oct 2014 07:35:53 -0400
parents 3f808549d426
children 2a8d8b4097c8
comparison
equal deleted inserted replaced
22769:3f808549d426 22770:de9424647fe4
652 """Parse and format the text according to width.""" 652 """Parse and format the text according to width."""
653 blocks, pruned = parse(text, indent, keep or []) 653 blocks, pruned = parse(text, indent, keep or [])
654 if section: 654 if section:
655 sections = getsections(blocks) 655 sections = getsections(blocks)
656 blocks = [] 656 blocks = []
657 for name, nest, b in sections: 657 i = 0
658 while i < len(sections):
659 name, nest, b = sections[i]
658 if name == section: 660 if name == section:
659 blocks = b 661 blocks.extend(b)
662
663 ## Also show all subnested sections
664 while i + 1 < len(sections) and sections[i + 1][1] > nest:
665 i += 1
666 blocks.extend(sections[i][2])
667 i += 1
668
660 if style == 'html': 669 if style == 'html':
661 text = formathtml(blocks) 670 text = formathtml(blocks)
662 else: 671 else:
663 text = ''.join(formatblock(b, width) for b in blocks) 672 text = ''.join(formatblock(b, width) for b in blocks)
664 if keep is None: 673 if keep is None: