Skip to content

Commit 55d0351

Browse files
authored
Syntax highlight IDLE html doc code example. (pythonGH-12981)
The new markup is currently ignored by IDLE's tk doc display.
1 parent 6d13e5b commit 55d0351

File tree

2 files changed

+25
-29
lines changed

2 files changed

+25
-29
lines changed

Doc/library/idle.rst

+2-4
Original file line numberDiff line numberDiff line change
@@ -724,11 +724,9 @@ to begin after the next tab stop. (They occur every 8 'characters'). Newline
724724
characters cause following text to appear on a new line. Other control
725725
characters are ignored or displayed as a space, box, or something else,
726726
depending on the operating system and font. (Moving the text cursor through
727-
such output with arrow keys may exhibit some surprising spacing behavior.)
727+
such output with arrow keys may exhibit some surprising spacing behavior.) ::
728728

729-
.. code-block:: none
730-
731-
>>> s = 'a\tb\a<\x02><\r>\bc\nd'
729+
>>> s = 'a\tb\a<\x02><\r>\bc\nd' # Enter 22 chars.
732730
>>> len(s)
733731
14
734732
>>> s # Display repr(s)

Lib/idlelib/help.html

+23-25
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<head>
77
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
88
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9-
<title>IDLE &#8212; Python 3.8.0a1 documentation</title>
9+
<title>IDLE &#8212; Python 3.8.0a3 documentation</title>
1010
<link rel="stylesheet" href="../_static/pydoctheme.css" type="text/css" />
1111
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
1212

@@ -19,7 +19,7 @@
1919
<script type="text/javascript" src="../_static/sidebar.js"></script>
2020

2121
<link rel="search" type="application/opensearchdescription+xml"
22-
title="Search within Python 3.8.0a1 documentation"
22+
title="Search within Python 3.8.0a3 documentation"
2323
href="../_static/opensearch.xml"/>
2424
<link rel="author" title="About these documents" href="../about.html" />
2525
<link rel="index" title="Index" href="../genindex.html" />
@@ -72,7 +72,7 @@ <h3>Navigation</h3>
7272

7373

7474
<li>
75-
<a href="../index.html">3.8.0a1 Documentation</a> &#187;
75+
<a href="../index.html">3.8.0a3 Documentation</a> &#187;
7676
</li>
7777

7878
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
@@ -372,8 +372,8 @@ <h3>Help menu (Shell and Editor)<a class="headerlink" href="#help-menu-shell-and
372372
<dt>Go to file/line</dt>
373373
<dd>Same as in Debug menu.</dd>
374374
</dl>
375-
<p>The Shell window also has an output squeezing facility explained in the
376-
the <em>Python Shell window</em> subsection below.</p>
375+
<p>The Shell window also has an output squeezing facility explained in the <em>Python
376+
Shell window</em> subsection below.</p>
377377
<dl class="docutils">
378378
<dt>Squeeze</dt>
379379
<dd>If the cursor is over an output line, squeeze all the output between
@@ -673,24 +673,22 @@ <h3>User output in Shell<a class="headerlink" href="#user-output-in-shell" title
673673
In contrast, some system text windows only keep the last n lines of output.
674674
A Windows console, for instance, keeps a user-settable 1 to 9999 lines,
675675
with 300 the default.</p>
676-
<p>A Tk Text widget, and hence IDLE’s Shell, displays characters (codepoints)
677-
in the the BMP (Basic Multilingual Plane) subset of Unicode.
678-
Which characters are displayed with a proper glyph and which with a
679-
replacement box depends on the operating system and installed fonts.
680-
Tab characters cause the following text to begin after
681-
the next tab stop. (They occur every 8 ‘characters’).
682-
Newline characters cause following text to appear on a new line.
683-
Other control characters are ignored or displayed as a space, box, or
684-
something else, depending on the operating system and font.
685-
(Moving the text cursor through such output with arrow keys may exhibit
686-
some surprising spacing behavior.)</p>
687-
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>&gt;&gt;&gt; s = &#39;a\tb\a&lt;\x02&gt;&lt;\r&gt;\bc\nd&#39;
688-
&gt;&gt;&gt; len(s)
689-
14
690-
&gt;&gt;&gt; s # Display repr(s)
691-
&#39;a\tb\x07&lt;\x02&gt;&lt;\r&gt;\x08c\nd&#39;
692-
&gt;&gt;&gt; print(s, end=&#39;&#39;) # Display s as is.
693-
# Result varies by OS and font. Try it.
676+
<p>A Tk Text widget, and hence IDLE’s Shell, displays characters (codepoints) in
677+
the BMP (Basic Multilingual Plane) subset of Unicode. Which characters are
678+
displayed with a proper glyph and which with a replacement box depends on the
679+
operating system and installed fonts. Tab characters cause the following text
680+
to begin after the next tab stop. (They occur every 8 ‘characters’). Newline
681+
characters cause following text to appear on a new line. Other control
682+
characters are ignored or displayed as a space, box, or something else,
683+
depending on the operating system and font. (Moving the text cursor through
684+
such output with arrow keys may exhibit some surprising spacing behavior.)</p>
685+
<div class="highlight-python3 notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="o">=</span> <span class="s1">&#39;a</span><span class="se">\t</span><span class="s1">b</span><span class="se">\a</span><span class="s1">&lt;</span><span class="se">\x02</span><span class="s1">&gt;&lt;</span><span class="se">\r</span><span class="s1">&gt;</span><span class="se">\b</span><span class="s1">c</span><span class="se">\n</span><span class="s1">d&#39;</span> <span class="c1"># Enter 22 chars.</span>
686+
<span class="gp">&gt;&gt;&gt; </span><span class="nb">len</span><span class="p">(</span><span class="n">s</span><span class="p">)</span>
687+
<span class="go">14</span>
688+
<span class="gp">&gt;&gt;&gt; </span><span class="n">s</span> <span class="c1"># Display repr(s)</span>
689+
<span class="go">&#39;a\tb\x07&lt;\x02&gt;&lt;\r&gt;\x08c\nd&#39;</span>
690+
<span class="gp">&gt;&gt;&gt; </span><span class="nb">print</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="n">end</span><span class="o">=</span><span class="s1">&#39;&#39;</span><span class="p">)</span> <span class="c1"># Display s as is.</span>
691+
<span class="go"># Result varies by OS and font. Try it.</span>
694692
</pre></div>
695693
</div>
696694
<p>The <code class="docutils literal notranslate"><span class="pre">repr</span></code> function is used for interactive echo of expression
@@ -912,7 +910,7 @@ <h3>Navigation</h3>
912910

913911

914912
<li>
915-
<a href="../index.html">3.8.0a1 Documentation</a> &#187;
913+
<a href="../index.html">3.8.0a3 Documentation</a> &#187;
916914
</li>
917915

918916
<li class="nav-item nav-item-1"><a href="index.html" >The Python Standard Library</a> &#187;</li>
@@ -943,7 +941,7 @@ <h3>Navigation</h3>
943941
<br />
944942
<br />
945943

946-
Last updated on Feb 23, 2019.
944+
Last updated on Apr 26, 2019.
947945
<a href="https://docs.python.org/3/bugs.html">Found a bug</a>?
948946
<br />
949947

0 commit comments

Comments
 (0)