diff options
author | Georg Brandl <georg@python.org> | 2016-02-25 19:14:10 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2016-02-25 19:14:10 (GMT) |
commit | a575839f25f1d0edafa1e1fad40b344eb28170b3 (patch) | |
tree | 3e9293c1d8f99538b50003d18f4dda55883f48b6 | |
parent | ee7fe38d401e20fed8d0cf5d02e9dc6a21fa2013 (diff) | |
download | cpython-a575839f25f1d0edafa1e1fad40b344eb28170b3.zip cpython-a575839f25f1d0edafa1e1fad40b344eb28170b3.tar.gz cpython-a575839f25f1d0edafa1e1fad40b344eb28170b3.tar.bz2 |
Fix rstlint to also look for indented comments that should be directives.
-rwxr-xr-x | Doc/tools/rstlint.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/tools/rstlint.py b/Doc/tools/rstlint.py index e7afc05..1c84473 100755 --- a/Doc/tools/rstlint.py +++ b/Doc/tools/rstlint.py @@ -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 |