]> granicus.if.org Git - python/commitdiff
Fix rstlint to also look for indented comments that should be directives.
authorGeorg Brandl <georg@python.org>
Thu, 25 Feb 2016 19:14:10 +0000 (20:14 +0100)
committerGeorg Brandl <georg@python.org>
Thu, 25 Feb 2016 19:14:10 +0000 (20:14 +0100)
Doc/tools/rstlint.py

index e7afc0524ccca5e2b326aa39586bcb9238685e87..1c844734790d3d393e80f84a4263e76ed5aac47b 100755 (executable)
@@ -42,7 +42,7 @@ directives = [
 ]
 
 all_directives = '(' + '|'.join(directives) + ')'
-seems_directive_re = re.compile(r'\.\. %s([^a-z:]|:(?!:))' % all_directives)
+seems_directive_re = re.compile(r'(?<!\.)\.\. %s([^a-z:]|:(?!:))' % all_directives)
 default_role_re = re.compile(r'(^| )`\w([^`]*?\w)?`($| )')
 leaked_markup_re = re.compile(r'[a-z]::\s|`|\.\.\s*\w+:')
 
@@ -81,7 +81,7 @@ def check_suspicious_constructs(fn, lines):
     """Check for suspicious reST constructs."""
     inprod = False
     for lno, line in enumerate(lines):
-        if seems_directive_re.match(line):
+        if seems_directive_re.search(line):
             yield lno+1, 'comment seems to be intended as a directive'
         if '.. productionlist::' in line:
             inprod = True