commit c42382385155f65a73c07b0b493451e8cbd4242a
parent bed9e45249998d768ebd771a456f8caf7caae334
Author: Antoine Amarilli <a3nm@a3nm.net>
Date: Tue, 13 Mar 2012 14:55:13 +0100
improve boilint
Diffstat:
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/boilint.py b/boilint.py
@@ -15,6 +15,16 @@ def output(l):
print(' '.join(l))
print(' '.join(l), file=f)
+def leading_cap(text):
+ for c in text:
+ if c.upper() == c.lower():
+ continue # symbol
+ if c != c.lower():
+ return True
+ if c != c.upper():
+ return False
+ return False
+
def manage(line, silent=False):
"""manage one line, indicate if an error occurred"""
global buf
@@ -39,9 +49,11 @@ def manage(line, silent=False):
if first.lstrip().startswith("..."):
text = buf+text
usebuf = True
- if (first[-1] == ':' or first[0].upper() != first[0]
- or first[0].upper() == first[0].lower()) and not usebuf:
- return False # ignore non-poem lines
+ if not usebuf:
+ if first[-1] == ':':
+ return False
+ if not leading_cap(text):
+ return False
errors = template.check(text)
if len(errors) > 0 and text.rstrip().endswith("..."):
# it might be a call