Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
071b0bc9
Kaydet (Commit)
071b0bc9
authored
May 14, 2003
tarafından
Raymond Hettinger
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Forward slash warnings now only occur for potentially valid LaTeX commands.
(Idea contributed by Anthony Baxter.)
üst
aa6b856a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
texcheck.py
Tools/scripts/texcheck.py
+8
-8
No files found.
Tools/scripts/texcheck.py
Dosyayı görüntüle @
071b0bc9
...
...
@@ -16,7 +16,6 @@ Command line usage:
Options:
-m Munge parenthesis and brackets. [0,n) would normally mismatch.
-k keyword: Keyword is a valid LaTeX command. Do not include the backslash.
-f: Forward-slash warnings suppressed.
-d: Delimiter check only (useful for non-LaTeX files).
-h: Help
-s lineno: Start at lineno (useful for skipping complex sections).
...
...
@@ -75,9 +74,8 @@ def checkit(source, opts, morecmds=[]):
Opts is a mapping of options to option values if any:
-m munge parenthesis and brackets
-f forward slash warnings to be skipped
-d delimiters only checking
-v verbose listing o
n
delimiters
-v verbose listing o
f
delimiters
-s lineno: linenumber to start scan (default is 1).
Morecmds is a sequence of LaTeX commands (without backslashes) that
...
...
@@ -85,6 +83,7 @@ def checkit(source, opts, morecmds=[]):
"""
texcmd
=
re
.
compile
(
r'\\[A-Za-z]+'
)
falsetexcmd
=
re
.
compile
(
r'\/([A-Za-z]+)'
)
# Mismarked with forward slash
validcmds
=
sets
.
Set
(
cmdstr
.
split
())
for
cmd
in
morecmds
:
...
...
@@ -114,10 +113,11 @@ def checkit(source, opts, morecmds=[]):
for
lineno
,
line
in
izip
(
count
(
startline
),
islice
(
source
,
startline
-
1
,
None
)):
line
=
line
.
rstrip
()
if
'/'
in
line
and
'-f'
not
in
opts
and
'-d'
not
in
opts
:
# Warn whenever forward slashes encountered
line
=
line
.
rstrip
()
print
'Warning, forward slash on line
%
d:
%
s'
%
(
lineno
,
line
)
if
'/'
in
line
and
'-d'
not
in
opts
:
# Warn whenever forward slashes encountered with a LaTeX command
for
cmd
in
falsetexcmd
.
findall
(
line
):
if
'
\\
'
+
cmd
in
validcmds
:
print
'Warning, forward slash used on line
%
d with cmd: /
%
s'
%
(
lineno
,
cmd
)
if
'-d'
not
in
opts
:
# Validate commands
...
...
@@ -179,7 +179,7 @@ def checkit(source, opts, morecmds=[]):
def
main
(
args
=
None
):
if
args
is
None
:
args
=
sys
.
argv
[
1
:]
optitems
,
arglist
=
getopt
.
getopt
(
args
,
"k:m
f
dhs:v"
)
optitems
,
arglist
=
getopt
.
getopt
(
args
,
"k:mdhs:v"
)
opts
=
dict
(
optitems
)
if
'-h'
in
opts
or
args
==
[]:
print
__doc__
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment