##// END OF EJS Templates
docchecker: report context line at most once
timeless -
r28810:99343629 default
parent child Browse files
Show More
@@ -10,16 +10,23 b' import sys'
10 import re
10 import re
11
11
12 leadingline = re.compile(r'(^\s*)(\S.*)$')
12 leadingline = re.compile(r'(^\s*)(\S.*)$')
13 hg_backtick = re.compile(r""":hg:`[^`]*'[^`]*`""")
13
14 hg_cramped = re.compile(r'\w:hg:`')
14 checks = [
15 (r""":hg:`[^`]*'[^`]*`""",
16 """warning: please avoid nesting ' in :hg:`...`"""),
17 (r'\w:hg:`',
18 'warning: please have a space before :hg:'),
19 ]
15
20
16 def check(line):
21 def check(line):
17 if hg_backtick.search(line):
22 messages = []
23 for match, msg in checks:
24 if re.search(match, line):
25 messages.append(msg)
26 if messages:
18 print(line)
27 print(line)
19 print("""warning: please avoid nesting ' in :hg:`...`""")
28 for msg in messages:
20 if hg_cramped.search(line):
29 print(msg)
21 print(line)
22 print('warning: please have a space before :hg:')
23
30
24 def work(file):
31 def work(file):
25 (llead, lline) = ('', '')
32 (llead, lline) = ('', '')
General Comments 0
You need to be logged in to leave comments. Login now