]> granicus.if.org Git - python/commitdiff
Several improvements to the HTML NEWS version:
authorGeorg Brandl <georg@python.org>
Mon, 1 Oct 2012 17:08:50 +0000 (19:08 +0200)
committerGeorg Brandl <georg@python.org>
Mon, 1 Oct 2012 17:08:50 +0000 (19:08 +0200)
* rename to "Changelog"
* recognize more issue links
* add NEWS as a dependency for Sphinx

Doc/tools/sphinxext/pyspecific.py
Doc/whatsnew/changelog.rst [moved from Doc/whatsnew/news.rst with 87% similarity]
Doc/whatsnew/index.rst
Misc/NEWS

index 93044618cec629adef51e2301f13a74e66048cf7..1808e2833a3a8d25c7f23a80c9c3c8d56c315870 100644 (file)
@@ -149,10 +149,9 @@ class DeprecatedRemoved(Directive):
 
 import re
 import codecs
-from docutils.statemachine import string2lines
-from sphinx.util.nodes import nested_parse_with_titles
 
-issue_re = re.compile('Issue #([0-9]+)')
+issue_re = re.compile('([Ii])ssue #([0-9]+)')
+whatsnew_re = re.compile(r"(?im)^what's new in (.*?)\??$")
 
 class MiscNews(Directive):
     has_content = False
@@ -166,8 +165,10 @@ class MiscNews(Directive):
         source = self.state_machine.input_lines.source(
             self.lineno - self.state_machine.input_offset - 1)
         source_dir = path.dirname(path.abspath(source))
+        fpath = path.join(source_dir, fname)
+        self.state.document.settings.record_dependencies.add(fpath)
         try:
-            fp = codecs.open(path.join(source_dir, fname), encoding='utf-8')
+            fp = codecs.open(fpath, encoding='utf-8')
             try:
                 content = fp.read()
             finally:
@@ -176,8 +177,9 @@ class MiscNews(Directive):
             text = 'The NEWS file is not available.'
             node = nodes.strong(text, text)
             return [node]
-        content = issue_re.sub(r'`Issue #\1 <http://bugs.python.org/\1>`__',
+        content = issue_re.sub(r'`\1ssue #\2 <http://bugs.python.org/\2>`__',
                                content)
+        content = whatsnew_re.sub(r'\1', content)
         # remove first 3 lines as they are the main heading
         lines = content.splitlines()[3:]
         self.state_machine.insert_input(lines, fname)
similarity index 87%
rename from Doc/whatsnew/news.rst
rename to Doc/whatsnew/changelog.rst
index 2f81ed364be566a78e784aadd9ea04dea774621d..680d110e0d59e000d864c5215b946e2fd80fd49a 100644 (file)
@@ -1,6 +1,6 @@
-+++++++++++
-Python News
-+++++++++++
++++++++++
+Changelog
++++++++++
 
 .. raw:: html
 
index a06849b9a8701c0a935b99f4857f9ae1f97484c5..bc1206bb64d93db850bc36200b959325e6f3fa34 100644 (file)
@@ -24,10 +24,10 @@ anyone wishing to stay up-to-date after a new release.
    2.1.rst
    2.0.rst
 
-The "Python News" is a HTML version of the file :source:`Misc/NEWS` which
-contains *all* nontrivial changes to Python.
+The "Changelog" is a HTML version of the file :source:`Misc/NEWS` which
+contains *all* nontrivial changes to Python for the current version.
 
 .. toctree::
-   :maxdepth: 1
+   :maxdepth: 2
 
-   news.rst
+   changelog.rst
index 889f04b6f692597d9455cd464d9602cbcc552b63..b23a0c3aaa51ded8c583075534b1aca645fc4838 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -75,7 +75,7 @@ Library
 - Issue #15509: webbrowser.UnixBrowser no longer passes empty arguments to
   Popen when %action substitutions produce empty strings.
 
-- Issues #12776, #11839: call argparse type function (specified by add_argument)
+- Issue #12776, issue #11839: call argparse type function (specified by add_argument)
   only once. Before, the type function was called twice in the case where the
   default was specified and the argument was given as well.  This was especially
   problematic for the FileType type, as a default file would always be opened,