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
f032cdbb
Kaydet (Commit)
f032cdbb
authored
Tem 29, 1999
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Some minor cleanup.
üst
bc2285eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
20 deletions
+18
-20
esis2sgml.py
Doc/tools/sgmlconv/esis2sgml.py
+18
-20
No files found.
Doc/tools/sgmlconv/esis2sgml.py
Dosyayı görüntüle @
f032cdbb
...
@@ -77,7 +77,7 @@ def istoken(s):
...
@@ -77,7 +77,7 @@ def istoken(s):
return
_token_rx
.
match
(
s
)
is
not
None
return
_token_rx
.
match
(
s
)
is
not
None
def
do_
convert
(
ifp
,
ofp
,
xml
=
0
,
autoclose
=
(),
verbatims
=
()):
def
convert
(
ifp
,
ofp
,
xml
=
0
,
autoclose
=
(),
verbatims
=
()):
if
xml
:
if
xml
:
autoclose
=
()
autoclose
=
()
attrs
=
{}
attrs
=
{}
...
@@ -152,26 +152,27 @@ def do_convert(ifp, ofp, xml=0, autoclose=(), verbatims=()):
...
@@ -152,26 +152,27 @@ def do_convert(ifp, ofp, xml=0, autoclose=(), verbatims=()):
def
dump_empty_element_names
(
knownempties
):
def
dump_empty_element_names
(
knownempties
):
d
=
{}
for
gi
in
knownempties
:
d
[
gi
]
=
gi
knownempties
.
append
(
""
)
knownempties
.
append
(
""
)
if
os
.
path
.
isfile
(
EMPTIES_FILENAME
):
if
os
.
path
.
isfile
(
EMPTIES_FILENAME
):
mode
=
"a"
fp
=
open
(
EMPTIES_FILENAME
)
else
:
while
1
:
mode
=
"w"
line
=
fp
.
readline
()
fp
=
open
(
EMPTIES_FILENAME
,
mode
)
if
not
line
:
fp
.
write
(
string
.
join
(
knownempties
,
"
\n
"
))
break
gi
=
string
.
strip
(
line
)
if
gi
:
d
[
gi
]
=
gi
fp
=
open
(
EMPTIES_FILENAME
,
"w"
)
gilist
=
d
.
keys
()
gilist
.
sort
()
fp
.
write
(
string
.
join
(
gilist
,
"
\n
"
))
fp
.
write
(
"
\n
"
)
fp
.
close
()
fp
.
close
()
def
sgml_convert
(
ifp
,
ofp
,
autoclose
,
verbatims
):
return
do_convert
(
ifp
,
ofp
,
xml
=
0
,
autoclose
=
autoclose
,
verbatims
=
verbatims
)
def
xml_convert
(
ifp
,
ofp
,
autoclose
,
verbatims
):
return
do_convert
(
ifp
,
ofp
,
xml
=
1
,
autoclose
=
autoclose
,
verbatims
=
verbatims
)
def
update_gi_map
(
map
,
names
,
fromsgml
=
1
):
def
update_gi_map
(
map
,
names
,
fromsgml
=
1
):
for
name
in
string
.
split
(
names
,
","
):
for
name
in
string
.
split
(
names
,
","
):
if
fromsgml
:
if
fromsgml
:
...
@@ -186,7 +187,6 @@ def main():
...
@@ -186,7 +187,6 @@ def main():
import
sys
import
sys
#
#
autoclose
=
AUTOCLOSE
autoclose
=
AUTOCLOSE
convert
=
xml_convert
xml
=
1
xml
=
1
xmldecl
=
0
xmldecl
=
0
elem_names
=
''
elem_names
=
''
...
@@ -205,10 +205,8 @@ def main():
...
@@ -205,10 +205,8 @@ def main():
LIST_EMPTIES
=
1
LIST_EMPTIES
=
1
elif
opt
in
(
"-s"
,
"--sgml"
):
elif
opt
in
(
"-s"
,
"--sgml"
):
xml
=
0
xml
=
0
convert
=
sgml_convert
elif
opt
in
(
"-x"
,
"--xml"
):
elif
opt
in
(
"-x"
,
"--xml"
):
xml
=
1
xml
=
1
convert
=
xml_convert
elif
opt
in
(
"-a"
,
"--autoclose"
):
elif
opt
in
(
"-a"
,
"--autoclose"
):
autoclose
=
string
.
split
(
arg
,
","
)
autoclose
=
string
.
split
(
arg
,
","
)
elif
opt
==
"--elements-map"
:
elif
opt
==
"--elements-map"
:
...
@@ -252,7 +250,7 @@ def main():
...
@@ -252,7 +250,7 @@ def main():
try
:
try
:
if
xml
and
xmldecl
:
if
xml
and
xmldecl
:
opf
.
write
(
'<?xml version="1.0" encoding="iso8859-1"?>
\n
'
)
opf
.
write
(
'<?xml version="1.0" encoding="iso8859-1"?>
\n
'
)
convert
(
ifp
,
ofp
,
autoclose
,
verbatims
)
convert
(
ifp
,
ofp
,
xml
=
xml
,
autoclose
=
autoclose
,
verbatims
=
verbatims
)
except
IOError
,
(
err
,
msg
):
except
IOError
,
(
err
,
msg
):
if
err
!=
errno
.
EPIPE
:
if
err
!=
errno
.
EPIPE
:
raise
raise
...
...
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