Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ef90a1

Browse files
committed
merge with 3.3
2 parents 50de850 + 2cac28b commit 7ef90a1

5 files changed

Lines changed: 83 additions & 3 deletions

File tree

Doc/tools/sphinxext/layout.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@
88
{% block extrahead %}
99
<link rel="shortcut icon" type="image/png" href="{{ pathto('_static/py.png', 1) }}" />
1010
{% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>{% endif %}
11+
{% if pagename == 'whatsnew/news' %}
12+
<script type="text/javascript">
13+
function dofilter() {
14+
var el = document.getElementById('searchbox');
15+
var string = el.value.toLowerCase();
16+
var litags = document.getElementsByTagName('li')
17+
for (var idx = 0; idx < litags.length; idx++) {
18+
var li = litags[idx];
19+
if (li.innerHTML.toLowerCase().indexOf(string) >= 0) {
20+
li.style.display = '';
21+
} else {
22+
li.style.display = 'none';
23+
}
24+
}
25+
}
26+
</script>
27+
{% endif %}
1128
{{ super() }}
1229
{% endblock %}
1330
{% block footer %}

Doc/tools/sphinxext/pyspecific.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,45 @@ def run(self):
145145
return ret
146146

147147

148+
# Support for including Misc/NEWS
149+
150+
import re
151+
import codecs
152+
from docutils.statemachine import string2lines
153+
from sphinx.util.nodes import nested_parse_with_titles
154+
155+
issue_re = re.compile('Issue #([0-9]+)')
156+
157+
class MiscNews(Directive):
158+
has_content = False
159+
required_arguments = 1
160+
optional_arguments = 0
161+
final_argument_whitespace = False
162+
option_spec = {}
163+
164+
def run(self):
165+
fname = self.arguments[0]
166+
source = self.state_machine.input_lines.source(
167+
self.lineno - self.state_machine.input_offset - 1)
168+
source_dir = path.dirname(path.abspath(source))
169+
try:
170+
fp = codecs.open(path.join(source_dir, fname), encoding='utf-8')
171+
try:
172+
content = fp.read()
173+
finally:
174+
fp.close()
175+
except Exception:
176+
text = 'The NEWS file is not available.'
177+
node = nodes.strong(text, text)
178+
return [node]
179+
content = issue_re.sub(r'`Issue #\1 <http://bugs.python.org/\1>`__',
180+
content)
181+
# remove first 3 lines as they are the main heading
182+
lines = content.splitlines()[3:]
183+
self.state_machine.insert_input(lines, fname)
184+
return []
185+
186+
148187
# Support for building "topic help" for pydoc
149188

150189
pydoc_topic_labels = [
@@ -276,3 +315,4 @@ def setup(app):
276315
app.add_description_unit('2to3fixer', '2to3fixer', '%s (2to3 fixer)')
277316
app.add_directive_to_domain('py', 'decorator', PyDecoratorFunction)
278317
app.add_directive_to_domain('py', 'decoratormethod', PyDecoratorMethod)
318+
app.add_directive('miscnews', MiscNews)

Doc/whatsnew/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@ anyone wishing to stay up-to-date after a new release.
2424
2.2.rst
2525
2.1.rst
2626
2.0.rst
27+
28+
The "Python News" is a HTML version of the file :source:`Misc/NEWS` which
29+
contains *all* nontrivial changes to Python.
30+
31+
.. toctree::
32+
:maxdepth: 1
33+
34+
news.rst

Doc/whatsnew/news.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
+++++++++++
2+
Python News
3+
+++++++++++
4+
5+
.. raw:: html
6+
7+
<p>
8+
Filter entries by content:
9+
<input type="text" value="" id="searchbox" style="width: 50%" onchange="dofilter()">
10+
<input type="submit" value="Filter" onclick="dofilter()">
11+
</p>
12+
13+
.. miscnews:: ../../Misc/NEWS
14+

Misc/NEWS

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,10 @@ Tools/Demos
674674
- Issue #12605: The gdb hooks for debugging CPython (within Tools/gdb) have been
675675
enhanced to show information on more C frames relevant to CPython within the
676676
"py-bt" and "py-bt-full" commands:
677-
* C frames that are waiting on the GIL
678-
* C frames that are garbage-collecting
679-
* C frames that are due to the invocation of a PyCFunction
677+
678+
* C frames that are waiting on the GIL
679+
* C frames that are garbage-collecting
680+
* C frames that are due to the invocation of a PyCFunction
680681

681682
Documentation
682683
-------------

0 commit comments

Comments
 (0)