[Python-checkins] python/dist/src/Tools/scripts texcheck.py,1.1,1.2
rhettinger@users.sourceforge.net
rhettinger@users.sourceforge.net
2003年5月10日 00:41:57 -0700
- Previous message: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.130,1.131 libstdtypes.tex,1.124,1.125 liburllib2.tex,1.8,1.9
- Next message: [Python-checkins] python/dist/src/Doc/lib libdis.tex,1.40,1.41 libexcs.tex,1.49,1.50
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Tools/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv18887
Modified Files:
texcheck.py
Log Message:
Add table level validation and made minor fix-ups.
Index: texcheck.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/scripts/texcheck.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** texcheck.py 10 May 2003 03:30:13 -0000 1.1
--- texcheck.py 10 May 2003 07:41:55 -0000 1.2
***************
*** 23,30 ****
"""
- # Todo:
- # Add tableiii/lineiii cross-checking
- # Add braces matching
-
import re
import sets
--- 23,26 ----
***************
*** 54,58 ****
\longprogramopt \infinity \plusminus \shortversion \version
\refmodindex \seerfc \makeindex \makemodindex \renewcommand
! \indexname \appendix
"""
--- 50,55 ----
\longprogramopt \infinity \plusminus \shortversion \version
\refmodindex \seerfc \makeindex \makemodindex \renewcommand
! \indexname \appendix \protect \indexiv \mbox \textasciitilde
! \platform \seeurl \leftmargin \labelwidth \localmoduletable
"""
***************
*** 69,73 ****
def checkit(source, opts, morecmds=[]):
! """Check the LaTex formatting in a sequence of lines.
Opts is a mapping of options to option values if any:
--- 66,70 ----
def checkit(source, opts, morecmds=[]):
! """Check the LaTeX formatting in a sequence of lines.
Opts is a mapping of options to option values if any:
***************
*** 78,82 ****
-s lineno: linenumber to start scan (default is 1).
! Morecmds is a sequence of LaTex commands (without backslashes) that
are to be considered valid in the scan.
"""
--- 75,79 ----
-s lineno: linenumber to start scan (default is 1).
! Morecmds is a sequence of LaTeX commands (without backslashes) that
are to be considered valid in the scan.
"""
***************
*** 98,101 ****
--- 95,104 ----
delimiters = re.compile(r'\\(begin|end){([_a-zA-Z]+)}|([()\[\]])')
+ tablestart = re.compile(r'\\begin{(?:long)?table([iv]+)}')
+ tableline = re.compile(r'\\line([iv]+){')
+ tableend = re.compile(r'\\end{(?:long)?table([iv]+)}')
+ tablelevel = ''
+ tablestartline = 0
+
startline = int(opts.get('-s', '1'))
lineno = 0
***************
*** 135,140 ****
print ' --> ', openers
for lineno, symbol in openers:
! print "Unmatched open delimiter '%s' on line %d", (symbol, lineno)
print 'Done checking %d lines.' % (lineno,)
return 0
--- 138,154 ----
print ' --> ', openers
+ # Check table levels (make sure lineii only inside lineiii)
+ m = tablestart.search(line)
+ if m:
+ tablelevel = m.group(1)
+ tablestartline = lineno
+ m = tableline.search(line)
+ if m and m.group(1) != tablelevel:
+ print r'Warning, \line%s on line %d does not match \table%s on line %d' % (m.group(1), lineno, tablelevel, tablestartline)
+ if tableend.search(line):
+ tablelevel = ''
+
for lineno, symbol in openers:
! print "Unmatched open delimiter '%s' on line %d" % (symbol, lineno)
print 'Done checking %d lines.' % (lineno,)
return 0
- Previous message: [Python-checkins] python/dist/src/Doc/lib libfuncs.tex,1.130,1.131 libstdtypes.tex,1.124,1.125 liburllib2.tex,1.8,1.9
- Next message: [Python-checkins] python/dist/src/Doc/lib libdis.tex,1.40,1.41 libexcs.tex,1.49,1.50
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]