IDLE — Python editor and shell¶
Source code: Lib/idlelib/
-+
IDLE is Python’s Integrated Development and Learning Environment.
IDLE has the following features:
diff --git a/Doc/library/idle.rst b/Doc/library/idle.rst index 830bc33922d5dd..0aed6f0770dcd0 100644 --- a/Doc/library/idle.rst +++ b/Doc/library/idle.rst @@ -12,6 +12,9 @@ IDLE --- Python editor and shell single: Python Editor single: Integrated Development Environment +.. + Remember to update Lib/idlelib/help.html with idlelib.help.copy_source() when modifying this file. + -------------- IDLE is Python's Integrated Development and Learning Environment. diff --git a/Lib/idlelib/News3.txt b/Lib/idlelib/News3.txt index da001247884b22..74d84b3893125a 100644 --- a/Lib/idlelib/News3.txt +++ b/Lib/idlelib/News3.txt @@ -19,6 +19,9 @@ Released on 2024-10-07 gh-120104: Fix padding in config and search dialog windows in IDLE. +gh-129873: Simplify displaying the IDLE doc by only copying the text +section of idle.html to idlelib/help.html. Patch by Stan Ulbrych. + gh-120083: Add explicit black IDLE Hovertip foreground color needed for recent macOS. Fixes Sonoma showing unreadable white on pale yellow. Patch by John Riggles. diff --git a/Lib/idlelib/help.html b/Lib/idlelib/help.html index 2200bf29abea66..ebff9a309d9081 100644 --- a/Lib/idlelib/help.html +++ b/Lib/idlelib/help.html @@ -1,231 +1,7 @@ - - - -
- - - -Source code: Lib/idlelib/
-IDLE is Python’s Integrated Development and Learning Environment.
IDLE has the following features:
tags after a closed tag. # Avoid extra lines, e.g. after
tags.
lastline = self.text.get('end-1c linestart', 'end-1c')
@@ -112,31 +107,27 @@ def handle_starttag(self, tag, attrs):
s = '\n'
elif tag == 'pre':
self.pre = True
- if self.show:
- self.text.insert('end', '\n\n')
+ self.text.insert('end', '\n\n')
self.tags = 'preblock'
elif tag == 'a' and class_ == 'headerlink':
self.hdrlink = True
elif tag == 'h1':
self.tags = tag
elif tag in ['h2', 'h3']:
- if self.show:
- self.header = ''
- self.text.insert('end', '\n\n')
+ self.header = ''
+ self.text.insert('end', '\n\n')
self.tags = tag
- if self.show:
- self.text.insert('end', s, (self.tags, self.chartags))
+ self.text.insert('end', s, (self.tags, self.chartags))
self.prevtag = (True, tag)
def handle_endtag(self, tag):
"Handle endtags in help.html."
if tag in ['h1', 'h2', 'h3']:
assert self.level == 0
- if self.show:
- indent = (' ' if tag == 'h3' else
- ' ' if tag == 'h2' else
- '')
- self.toc.append((indent+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')))
self.tags = ''
elif tag in ['span', 'em']:
self.chartags = ''
@@ -151,7 +142,7 @@ def handle_endtag(self, tag):
def handle_data(self, data):
"Handle date segments in help.html."
- if self.show and not self.hdrlink:
+ if not self.hdrlink:
d = data if self.pre else data.replace('\n', ' ')
if self.tags == 'h1':
try:
@@ -253,7 +244,7 @@ def __init__(self, parent, filename, title):
def copy_strip(): # pragma: no cover
- """Copy idle.html to idlelib/help.html, stripping trailing whitespace.
+ """Copy the text part of idle.html to idlelib/help.html while stripping trailing whitespace.
Files with trailing whitespace cannot be pushed to the git cpython
repository. For 3.x (on Windows), help.html is generated, after
@@ -265,7 +256,7 @@ def copy_strip(): # pragma: no cover
It can be worthwhile to occasionally generate help.html without
touching idle.rst. Changes to the master version and to the doc
- build system may result in changes that should not changed
+ build system may result in changes that should not change
the displayed text, but might break HelpParser.
As long as master and maintenance versions of idle.rst remain the
@@ -278,10 +269,14 @@ def copy_strip(): # pragma: no cover
src = join(abspath(dirname(dirname(dirname(__file__)))),
'Doc', 'build', 'html', 'library', 'idle.html')
dst = join(abspath(dirname(__file__)), 'help.html')
- with open(src, 'rb') as inn,\
- open(dst, 'wb') as out:
+
+ with open(src, 'r', encoding="utf-8") as inn, open(dst, 'w', encoding="utf-8") as out:
+ copy = False
for line in inn:
- out.write(line.rstrip() + b'\n')
+ if '' in line: copy = True
+ if '' in line: break
+ if copy: out.write(line.strip() + '\n')
+
print(f'{src} copied to {dst}')
diff --git a/Misc/NEWS.d/next/IDLE/2025-02-08-23-42-24.gh-issue-129873.-gofkd.rst b/Misc/NEWS.d/next/IDLE/2025-02-08-23-42-24.gh-issue-129873.-gofkd.rst
new file mode 100644
index 00000000000000..d13f11550fc02d
--- /dev/null
+++ b/Misc/NEWS.d/next/IDLE/2025-02-08-23-42-24.gh-issue-129873.-gofkd.rst
@@ -0,0 +1,2 @@
+Simplify displaying the IDLE doc by only copying the text section of
+idle.html to idlelib/help.html. Patch by Stan Ulbrych.