@@ -149,10 +149,9 @@ def run(self):
149149
150150import re
151151import 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
157156class 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 )
0 commit comments