From: Raymond Hettinger Date: Mon, 8 Sep 2003 17:36:11 +0000 (+0000) Subject: Check for \NULL markup errors and doubled words. X-Git-Tag: v2.3.1~71 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2e38e09504b8d7be6c89ad3d37933673fff486f6;p=thirdparty%2FPython%2Fcpython.git Check for \NULL markup errors and doubled words. --- diff --git a/Tools/scripts/texcheck.py b/Tools/scripts/texcheck.py index 6da437061018..a2c890509de6 100644 --- a/Tools/scripts/texcheck.py +++ b/Tools/scripts/texcheck.py @@ -98,6 +98,8 @@ def checkit(source, opts, morecmds=[]): delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])') braces = re.compile(r'({)|(})') + doubledwords = re.compile(r'(\b[A-za-z]+\b) \b\1\b') + nullmarkup = re.compile(r'\NULL(?!\{\})') openers = [] # Stack of pending open delimiters bracestack = [] # Stack of pending open braces @@ -150,6 +152,10 @@ def checkit(source, opts, morecmds=[]): if '\\' + cmd in validcmds: print 'Warning, forward slash used on line %d with cmd: /%s' % (lineno, cmd) + # Check for bad markup + if nullmarkup.search(line): + print r'Warning, \NULL should be written as \NULL{} on line %d' % (lineno,) + # Validate commands nc = line.find(r'\newcommand') if nc != -1: @@ -175,6 +181,8 @@ def checkit(source, opts, morecmds=[]): if 'e.g.' in line or 'i.e.' in line: print r'Style warning, avoid use of i.e or e.g. on line %d' % (lineno,) + for dw in doubledwords.findall(line): + print r'Doubled word warning. "%s" on line %d' % (dw, lineno) lastline = lineno for lineno, symbol in openers: