plint

French poetry validator (local mirror of https://gitlab.com/a3nm/plint)
git clone https://a3nm.net/git/plint/
Log | Files | Refs | README

commit 756cabf98118fc022983d07a828594cf2a76b52d
parent bb6393b827ad1856f1c471cba20f6679e8ee5d41
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Wed, 10 Aug 2011 09:27:58 -0400

ignore inital symbols

Diffstat:
TODO | 10++++------
boilint.py | 10++++++----
2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/TODO b/TODO @@ -3,10 +3,8 @@ standalone letters make line reporting optional On était déjà coupable d'avoir failli <- wtf align? -01:15 < NeK> a3nm: lorsque la ligne commence par une parenthèse lint -considère ça - comme un vers ? il devrait vérifier le deuxième caractère, - voir si - c'est une majuscule...) - TODO update environment only if successful, remove back() + +TODO alignements +TODO undo + diff --git a/boilint.py b/boilint.py @@ -25,9 +25,6 @@ def manage(line, silent=False): if normalize(text.strip()) == '': return True # no text first = [a for a in l[1:] if a != ''][0] - # TODO ignore leading symbols except '...' and '/me' - if first[-1] == ':' or first[0].upper() != first[0]: - return True # ignore non-poem lines if first == '/me': # always accept actions if len(lbuf) > 0: @@ -38,10 +35,13 @@ def manage(line, silent=False): f.flush() return True if first[0] == '/': - return True # ignore other commands + return False # ignore other commands 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 errors = template.check(text) if len(errors) > 0 and text.rstrip().endswith("..."): # it might be a call @@ -78,6 +78,7 @@ template.reject_errors = True f = open(sys.argv[2], 'r') for line in f.readlines(): + print("Read: %s" % line, file=sys.stderr) if not manage(line, True): print("Existing poem is wrong!", file=sys.stderr) sys.exit(2) @@ -91,6 +92,7 @@ def run(): line = sys.stdin.readline() if not line: break + print("Seen: %s" % line, file=sys.stderr) manage(' '.join(line.split(' ')[1:])) run()