Skip to content

Commit 44d0c21

Browse files
committed
Several improvements to the HTML NEWS version:
* rename to "Changelog" * recognize more issue links * add NEWS as a dependency for Sphinx
1 parent 8fc6cb3 commit 44d0c21

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

Doc/tools/sphinxext/pyspecific.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,9 @@ def run(self):
149149

150150
import re
151151
import codecs
152-
from docutils.statemachine import string2lines
153-
from sphinx.util.nodes import nested_parse_with_titles
154152

155-
issue_re = re.compile('Issue #([0-9]+)')
153+
issue_re = re.compile('([Ii])ssue #([0-9]+)')
154+
whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$")
156155

157156
class MiscNews(Directive):
158157
has_content = False
@@ -166,8 +165,10 @@ def run(self):
166165
source = self.state_machine.input_lines.source(
167166
self.lineno - self.state_machine.input_offset - 1)
168167
source_dir = path.dirname(path.abspath(source))
168+
fpath = path.join(source_dir, fname)
169+
self.state.document.settings.record_dependencies.add(fpath)
169170
try:
170-
fp = codecs.open(path.join(source_dir, fname), encoding='utf-8')
171+
fp = codecs.open(fpath, encoding='utf-8')
171172
try:
172173
content = fp.read()
173174
finally:
@@ -176,8 +177,9 @@ def run(self):
176177
text = 'The NEWS file is not available.'
177178
node = nodes.strong(text, text)
178179
return [node]
179-
content = issue_re.sub(r'`Issue #\1 <http://bugs.python.org/\1>`__',
180+
content = issue_re.sub(r'`\1ssue #\2 <http://bugs.python.org/\2>`__',
180181
content)
182+
content = whatsnew_re.sub(r'\1', content)
181183
# remove first 3 lines as they are the main heading
182184
lines = content.splitlines()[3:]
183185
self.state_machine.insert_input(lines, fname)

Doc/whatsnew/news.rst renamed to Doc/whatsnew/changelog.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
+++++++++++
2-
Python News
3-
+++++++++++
1+
+++++++++
2+
Changelog
3+
+++++++++
44

55
.. raw:: html
66

Doc/whatsnew/index.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ anyone wishing to stay up-to-date after a new release.
2424
2.1.rst
2525
2.0.rst
2626

27-
The "Python News" is a HTML version of the file :source:`Misc/NEWS` which
28-
contains *all* nontrivial changes to Python.
27+
The "Changelog" is a HTML version of the file :source:`Misc/NEWS` which
28+
contains *all* nontrivial changes to Python for the current version.
2929

3030
.. toctree::
31-
:maxdepth: 1
31+
:maxdepth: 2
3232

33-
news.rst
33+
changelog.rst

Misc/NEWS

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Library
7575
- Issue #15509: webbrowser.UnixBrowser no longer passes empty arguments to
7676
Popen when %action substitutions produce empty strings.
7777

78-
- Issues #12776, #11839: call argparse type function (specified by add_argument)
78+
- Issue #12776, issue #11839: call argparse type function (specified by add_argument)
7979
only once. Before, the type function was called twice in the case where the
8080
default was specified and the argument was given as well. This was especially
8181
problematic for the FileType type, as a default file would always be opened,

0 commit comments

Comments
 (0)