comparison mercurial/help.py @ 39308:9b800601701c

help: inline minirst.format() I'm going to make minirst.format() always returns a formatted text, not text | (text, pruned).
author Yuya Nishihara <yuya@tcha.org>
date Sun, 05 Aug 2018 12:06:07 +0900
parents 5fa4e29ba3e3
children 0a766cb1092a
comparison
equal deleted inserted replaced
39307:92e9aa38a578 39308:9b800601701c
670 if textwidth <= 0 or termwidth < textwidth: 670 if textwidth <= 0 or termwidth < textwidth:
671 textwidth = termwidth 671 textwidth = termwidth
672 text = help_(ui, commands, name, 672 text = help_(ui, commands, name,
673 subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts) 673 subtopic=subtopic, unknowncmd=unknowncmd, full=full, **opts)
674 674
675 formatted, pruned = minirst.format(text, textwidth, keep=keep, 675 blocks, pruned = minirst.parse(text, keep=keep)
676 section=section) 676 if section:
677 blocks = minirst.filtersections(blocks, section)
678 formatted = minirst.formatplain(blocks, textwidth)
677 679
678 # We could have been given a weird ".foo" section without a name 680 # We could have been given a weird ".foo" section without a name
679 # to look for, or we could have simply failed to found "foo.bar" 681 # to look for, or we could have simply failed to found "foo.bar"
680 # because bar isn't a section of foo 682 # because bar isn't a section of foo
681 if section and not (formatted and name): 683 if section and not (formatted and name):
683 685
684 if 'verbose' in pruned: 686 if 'verbose' in pruned:
685 keep.append('omitted') 687 keep.append('omitted')
686 else: 688 else:
687 keep.append('notomitted') 689 keep.append('notomitted')
688 formatted, pruned = minirst.format(text, textwidth, keep=keep, 690 blocks, pruned = minirst.parse(text, keep=keep)
689 section=section) 691 if section:
690 return formatted 692 blocks = minirst.filtersections(blocks, section)
693 return minirst.formatplain(blocks, textwidth)