Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
df85f0b0
Commit
df85f0b0
authored
Oct 16, 2002
by
Fred Drake
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modernization: Use string methods, use str instead of
types.StringType, inherit from list instead of UserList.
parent
071972e4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
Doc/tools/sgmlconv/latex2esis.py
Doc/tools/sgmlconv/latex2esis.py
+14
-17
No files found.
Doc/tools/sgmlconv/latex2esis.py
View file @
df85f0b0
...
...
@@ -19,14 +19,10 @@ import errno
import
getopt
import
os
import
re
import
string
import
sys
import
UserList
import
xml.sax
import
xml.sax.saxutils
from
types
import
ListType
,
StringType
,
TupleType
from
esistools
import
encode
...
...
@@ -74,28 +70,29 @@ def popping(name, point, depth):
dbgmsg
(
"popping </%s> at %s"
%
(
name
,
point
))
class
_Stack
(
UserList
.
UserL
ist
):
class
_Stack
(
l
ist
):
def
append
(
self
,
entry
):
if
type
(
entry
)
is
not
StringType
:
if
not
isinstance
(
entry
,
str
)
:
raise
LaTeXFormatError
(
"cannot push non-string on stack: "
+
`entry`
)
#dbgmsg("%s<%s>" % (" "*len(self.data), entry))
self
.
data
.
append
(
entry
)
list
.
append
(
self
,
entry
)
def
pop
(
self
,
index
=-
1
):
entry
=
self
.
data
[
index
]
del
self
.
data
[
index
]
#dbgmsg("%s</%s>" % (" "
*len(self.data
), entry))
entry
=
self
[
index
]
del
self
[
index
]
#dbgmsg("%s</%s>" % (" "
* len(self
), entry))
def
__delitem__
(
self
,
index
):
entry
=
self
.
data
[
index
]
del
self
.
data
[
index
]
#dbgmsg("%s</%s>" % (" "
*len(self.data
), entry))
entry
=
self
[
index
]
list
.
__delitem__
(
self
,
index
)
#dbgmsg("%s</%s>" % (" "
* len(self
), entry))
def
new_stack
():
if
DEBUG
:
return
_Stack
()
else
:
return
[]
...
...
@@ -106,7 +103,7 @@ class Conversion:
self
.
table
=
table
L
=
[
s
.
rstrip
()
for
s
in
ifp
.
readlines
()]
L
.
append
(
""
)
self
.
line
=
string
.
join
(
L
,
"
\
n
"
)
self
.
line
=
"
\
n
"
.
join
(
L
)
self
.
preamble
=
1
def
convert
(
self
):
...
...
@@ -340,7 +337,7 @@ class Conversion:
break
if stack:
raise LaTeXFormatError("
elements
remain
on
stack
:
"
+
string.join(stack, "
,
"
))
+
"
,
".join(stack
))
# otherwise we just ran out of input here...
# This is a really limited table of combinations, but it will have
...
...
@@ -546,7 +543,7 @@ def main():
opts, args = getopt.getopt(sys.argv[1:], "
D
", ["
debug
"])
for opt, arg in opts:
if opt in ("
-
D
", "
--
debug
"):
DEBUG
= DEBUG +
1
DEBUG
+=
1
if len(args) == 0:
ifp = sys.stdin
ofp = sys.stdout
...
...
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