##// END OF EJS Templates
help: include section heading if section depth changes...
timeless -
r27614:1d7e824a default
parent child Browse files
Show More
@@ -661,12 +661,32 b' def format(text, width=80, indent=0, kee'
661 sections = getsections(blocks)
661 sections = getsections(blocks)
662 blocks = []
662 blocks = []
663 i = 0
663 i = 0
664 lastparents = []
665 synthetic = []
666 collapse = True
664 while i < len(sections):
667 while i < len(sections):
665 name, nest, b = sections[i]
668 name, nest, b = sections[i]
666 del parents[nest:]
669 del parents[nest:]
667 parents.append(name)
670 parents.append(i)
668 if name == section:
671 if name == section:
669 b[0]['path'] = parents[3:]
672 if lastparents != parents:
673 llen = len(lastparents)
674 plen = len(parents)
675 if llen and llen != plen:
676 collapse = False
677 s = []
678 for j in xrange(3, plen - 1):
679 parent = parents[j]
680 if (j >= llen or
681 lastparents[j] != parent):
682 s.append(len(blocks))
683 sec = sections[parent][2]
684 blocks.append(sec[0])
685 blocks.append(sec[-1])
686 if s:
687 synthetic.append(s)
688
689 lastparents = parents[:]
670 blocks.extend(b)
690 blocks.extend(b)
671
691
672 ## Also show all subnested sections
692 ## Also show all subnested sections
@@ -674,18 +694,19 b' def format(text, width=80, indent=0, kee'
674 i += 1
694 i += 1
675 blocks.extend(sections[i][2])
695 blocks.extend(sections[i][2])
676 i += 1
696 i += 1
697 if collapse:
698 synthetic.reverse()
699 for s in synthetic:
700 path = [blocks[i]['lines'][0] for i in s]
701 real = s[-1] + 2
702 realline = blocks[real]['lines']
703 realline[0] = ('"%s"' %
704 '.'.join(path + [realline[0]]).replace('"', ''))
705 del blocks[s[0]:real]
677
706
678 if style == 'html':
707 if style == 'html':
679 text = formathtml(blocks)
708 text = formathtml(blocks)
680 else:
709 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
689 text = ''.join(formatblock(b, width) for b in blocks)
710 text = ''.join(formatblock(b, width) for b in blocks)
690 if keep is None:
711 if keep is None:
691 return text
712 return text
@@ -1162,6 +1162,31 b' Show nested definitions'
1162 $ hg help config.type | egrep '^$'|wc -l
1162 $ hg help config.type | egrep '^$'|wc -l
1163 \s*3 (re)
1163 \s*3 (re)
1164
1164
1165 Separate sections from subsections
1166
1167 $ hg help config.format | egrep '^ ("|-)|^\s*$' | uniq
1168 "format"
1169 --------
1170
1171 "usegeneraldelta"
1172
1173 "dotencode"
1174
1175 "usefncache"
1176
1177 "usestore"
1178
1179 "profiling"
1180 -----------
1181
1182 "format"
1183
1184 "progress"
1185 ----------
1186
1187 "format"
1188
1189
1165 Last item in help config.*:
1190 Last item in help config.*:
1166
1191
1167 $ hg help config.`hg help config|grep '^ "'| \
1192 $ hg help config.`hg help config|grep '^ "'| \
General Comments 0
You need to be logged in to leave comments. Login now