summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/help.py
diff options
context:
space:
mode:
authorTerry Jan Reedy <tjreedy@udel.edu>2018-10-28 05:21:36 (GMT)
committerGitHub <noreply@github.com>2018-10-28 05:21:36 (GMT)
commitdb40cb50eb823b8ef9040b1c9bf31a7475d94d39 (patch)
tree5bb86d57b5f0707a028536d860a3cfd8ac5b400c /Lib/idlelib/help.py
parentaeb1be5868623c9cd9cf6d7de3015a43fb005815 (diff)
downloadcpython-db40cb50eb823b8ef9040b1c9bf31a7475d94d39.zip
cpython-db40cb50eb823b8ef9040b1c9bf31a7475d94d39.tar.gz
cpython-db40cb50eb823b8ef9040b1c9bf31a7475d94d39.tar.bz2
bpo-35087: Update idlelib help files for the current doc build. (GH-10162)
There is only one trivial change to idle.rst. Nearly all the changes to help.html are the elimination of chapter and section numbers on headers due to changes in the build system. help.py no longer requires header numbering.
Diffstat (limited to 'Lib/idlelib/help.py')
-rw-r--r--Lib/idlelib/help.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/Lib/idlelib/help.py b/Lib/idlelib/help.py
index 21b5ea5..ae991ee 100644
--- a/Lib/idlelib/help.py
+++ b/Lib/idlelib/help.py
@@ -126,7 +126,10 @@ class HelpParser(HTMLParser):
if tag in ['h1', 'h2', 'h3']:
self.indent(0) # clear tag, reset indent
if self.show:
- self.toc.append((self.header, self.text.index('insert')))
+ indent = (' ' if tag == 'h3' else
+ ' ' if tag == 'h2' else
+ '')
+ self.toc.append((indent+self.header, self.text.index('insert')))
elif tag in ['span', 'em']:
self.chartags = ''
elif tag == 'a':
@@ -142,11 +145,15 @@ class HelpParser(HTMLParser):
if self.show and not self.hdrlink:
d = data if self.pre else data.replace('\n', ' ')
if self.tags == 'h1':
- self.hprefix = d[0:d.index(' ')]
- if self.tags in ['h1', 'h2', 'h3'] and self.hprefix != '':
- if d[0:len(self.hprefix)] == self.hprefix:
- d = d[len(self.hprefix):].strip()
- self.header += d
+ try:
+ self.hprefix = d[0:d.index(' ')]
+ except ValueError:
+ self.hprefix = ''
+ if self.tags in ['h1', 'h2', 'h3']:
+ if (self.hprefix != '' and
+ d[0:len(self.hprefix)] == self.hprefix):
+ d = d[len(self.hprefix):]
+ self.header += d.strip()
self.text.insert('end', d, (self.tags, self.chartags))