##// END OF EJS Templates
docchecker: use indentation of 4 spaces...
FUJIWARA Katsunori -
r28049:c00f67c1 default
parent child Browse files
Show More
@@ -14,41 +14,41 b' hg_backtick = re.compile(r""":hg:`[^`]*\''
14 hg_cramped = re.compile(r'\w:hg:`')
14 hg_cramped = re.compile(r'\w:hg:`')
15
15
16 def check(line):
16 def check(line):
17 if hg_backtick.search(line):
17 if hg_backtick.search(line):
18 print(line)
18 print(line)
19 print("""warning: please avoid nesting ' in :hg:`...`""")
19 print("""warning: please avoid nesting ' in :hg:`...`""")
20 if hg_cramped.search(line):
20 if hg_cramped.search(line):
21 print(line)
21 print(line)
22 print('warning: please have a space before :hg:')
22 print('warning: please have a space before :hg:')
23
23
24 def work(file):
24 def work(file):
25 (llead, lline) = ('', '')
25 (llead, lline) = ('', '')
26
26
27 for line in file:
27 for line in file:
28 # this section unwraps lines
28 # this section unwraps lines
29 match = leadingline.match(line)
29 match = leadingline.match(line)
30 if not match:
30 if not match:
31 check(lline)
31 check(lline)
32 (llead, lline) = ('', '')
32 (llead, lline) = ('', '')
33 continue
33 continue
34
34
35 lead, line = match.group(1), match.group(2)
35 lead, line = match.group(1), match.group(2)
36 if (lead == llead):
36 if (lead == llead):
37 if (lline != ''):
37 if (lline != ''):
38 lline += ' ' + line
38 lline += ' ' + line
39 else:
39 else:
40 lline = line
40 lline = line
41 else:
41 else:
42 check(lline)
42 check(lline)
43 (llead, lline) = (lead, line)
43 (llead, lline) = (lead, line)
44 check(lline)
44 check(lline)
45
45
46 def main():
46 def main():
47 for f in sys.argv[1:]:
47 for f in sys.argv[1:]:
48 try:
48 try:
49 with open(f) as file:
49 with open(f) as file:
50 work(file)
50 work(file)
51 except BaseException as e:
51 except BaseException as e:
52 print("failed to process %s: %s" % (f, e))
52 print("failed to process %s: %s" % (f, e))
53
53
54 main()
54 main()
General Comments 0
You need to be logged in to leave comments. Login now