]> 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 7dccf72f99cb56627fd8940374a3db7ad1f31e94..de78041f77c9ee1853e0793a8e7f48e1074ae0c8 100755 (executable)
@@ -43,7 +43,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+:')
 
@@ -83,7 +83,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