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
29901ff5
Kaydet (Commit)
29901ff5
authored
Agu 09, 1996
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Some improvements by Fred Drake.
üst
eb8d5032
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
174 additions
and
180 deletions
+174
-180
texi2html.py
Doc/texi2html.py
+58
-60
texi2html.py
Doc/tools/texi2html.py
+58
-60
texi2html.py
Tools/scripts/texi2html.py
+58
-60
No files found.
Doc/texi2html.py
Dosyayı görüntüle @
29901ff5
...
@@ -74,8 +74,7 @@ class Node:
...
@@ -74,8 +74,7 @@ class Node:
self
.
cont
=
''
self
.
cont
=
''
def
write
(
self
,
*
lines
):
def
write
(
self
,
*
lines
):
for
line
in
lines
:
map
(
self
.
lines
.
append
,
lines
)
self
.
lines
.
append
(
line
)
def
flush
(
self
):
def
flush
(
self
):
fp
=
open
(
self
.
dirname
+
'/'
+
makefile
(
self
.
name
),
'w'
)
fp
=
open
(
self
.
dirname
+
'/'
+
makefile
(
self
.
name
),
'w'
)
...
@@ -99,7 +98,7 @@ class Node:
...
@@ -99,7 +98,7 @@ class Node:
length
=
len
(
self
.
lines
)
length
=
len
(
self
.
lines
)
self
.
text
=
string
.
joinfields
(
self
.
lines
,
''
)
self
.
text
=
string
.
joinfields
(
self
.
lines
,
''
)
self
.
lines
=
[]
self
.
lines
=
[]
self
.
write
(
'<
BR> <
HR>
\n
'
)
self
.
write
(
'<HR>
\n
'
)
if
self
.
cont
!=
self
.
next
:
if
self
.
cont
!=
self
.
next
:
self
.
link
(
'Cont'
,
self
.
cont
)
self
.
link
(
'Cont'
,
self
.
cont
)
self
.
link
(
'Next'
,
self
.
next
)
self
.
link
(
'Next'
,
self
.
next
)
...
@@ -107,20 +106,19 @@ class Node:
...
@@ -107,20 +106,19 @@ class Node:
self
.
link
(
'Up'
,
self
.
up
)
self
.
link
(
'Up'
,
self
.
up
)
if
self
.
name
<>
self
.
topname
:
if
self
.
name
<>
self
.
topname
:
self
.
link
(
'Top'
,
self
.
topname
)
self
.
link
(
'Top'
,
self
.
topname
)
self
.
write
(
'<
BR> <HR> <P
>
\n
'
)
self
.
write
(
'<
HR
>
\n
'
)
links
=
string
.
joinfields
(
self
.
lines
,
''
)
links
=
string
.
joinfields
(
self
.
lines
,
''
)
self
.
lines
=
[]
self
.
lines
=
[]
self
.
prologue
=
\
self
.
prologue
=
(
'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
\n
'
'<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
\n
'
+
\
'<!-- Converted with texi2html and Python -->
\n
'
'<!- Converted with texi2html and Python>
\n
'
+
\
'<HEAD>
\n
'
'<P>
\n
<HEAD>
\n
'
+
\
' <TITLE>'
+
self
.
title
+
'</TITLE>
\n
'
'<TITLE>'
+
self
.
title
+
'</TITLE>
\n
'
+
\
'</HEAD><BODY>
\n
'
+
\
'</HEAD>
\n
<BODY>
\n
<P>
\n
'
+
\
links
)
links
if
length
>
20
:
if
length
>
20
:
self
.
epilogue
=
links
+
'</BODY>
\n
'
self
.
epilogue
=
'<P>
\n
%
s</BODY>
\n
'
%
links
else
:
else
:
self
.
epilogue
=
'</BODY>
\n
'
self
.
epilogue
=
'</BODY>
\n
'
...
@@ -311,10 +309,10 @@ class TexinfoParser:
...
@@ -311,10 +309,10 @@ class TexinfoParser:
if
nodename
[
0
]
==
':'
:
nodename
=
label
if
nodename
[
0
]
==
':'
:
nodename
=
label
else
:
nodename
=
line
[
e
:
f
]
else
:
nodename
=
line
[
e
:
f
]
punct
=
line
[
g
:
h
]
punct
=
line
[
g
:
h
]
self
.
write
(
'<
DT><A HREF="'
,
\
self
.
write
(
'<
LI><A HREF="'
,
makefile
(
nodename
),
\
makefile
(
nodename
),
'" TYPE=Menu>'
,
nodename
,
\
'">'
,
nodename
,
'</A>'
,
punct
,
'
\n
<DD>
'
)
'</A>'
,
punct
,
'
\n
'
)
self
.
expand
(
line
[
end
:])
self
.
expand
(
line
[
end
:])
else
:
else
:
text
=
string
.
joinfields
(
accu
,
''
)
text
=
string
.
joinfields
(
accu
,
''
)
...
@@ -577,8 +575,8 @@ class TexinfoParser:
...
@@ -577,8 +575,8 @@ class TexinfoParser:
def
open_dfn
(
self
):
self
.
write
(
'<DFN>'
)
def
open_dfn
(
self
):
self
.
write
(
'<DFN>'
)
def
close_dfn
(
self
):
self
.
write
(
'</DFN>'
)
def
close_dfn
(
self
):
self
.
write
(
'</DFN>'
)
def
open_emph
(
self
):
self
.
write
(
'<
I
>'
)
def
open_emph
(
self
):
self
.
write
(
'<
EM
>'
)
def
close_emph
(
self
):
self
.
write
(
'</
I
>'
)
def
close_emph
(
self
):
self
.
write
(
'</
EM
>'
)
open_i
=
open_emph
open_i
=
open_emph
close_i
=
close_emph
close_i
=
close_emph
...
@@ -599,15 +597,16 @@ class TexinfoParser:
...
@@ -599,15 +597,16 @@ class TexinfoParser:
# self.savetext = None
# self.savetext = None
def
writefootnotes
(
self
):
def
writefootnotes
(
self
):
self
.
write
(
'<H2>---------- Footnotes ----------</H2>
\n
'
)
self
.
write
(
'
\n
<HR NOSHADE SIZE=1 WIDTH=200>
\n
'
'<STRONG><EM>Footnotes</EM></STRONG>
\n
<P>'
)
for
id
,
text
in
self
.
footnotes
:
for
id
,
text
in
self
.
footnotes
:
self
.
write
(
'<A NAME="footnotetext'
,
id
,
\
self
.
write
(
'<A NAME="footnotetext'
,
id
,
\
'" HREF="#footnoteref'
,
id
,
'">('
,
\
'" HREF="#footnoteref'
,
id
,
'">('
,
\
id
,
')</A>
\n
'
,
text
,
'<P>
\n
'
)
id
,
')</A>
\n
'
,
text
,
'<P>
\n
'
)
self
.
footnotes
=
[]
self
.
footnotes
=
[]
def
open_file
(
self
):
self
.
write
(
'<
FIL
E>'
)
def
open_file
(
self
):
self
.
write
(
'<
COD
E>'
)
def
close_file
(
self
):
self
.
write
(
'</
FIL
E>'
)
def
close_file
(
self
):
self
.
write
(
'</
COD
E>'
)
def
open_kbd
(
self
):
self
.
write
(
'<KBD>'
)
def
open_kbd
(
self
):
self
.
write
(
'<KBD>'
)
def
close_kbd
(
self
):
self
.
write
(
'</KBD>'
)
def
close_kbd
(
self
):
self
.
write
(
'</KBD>'
)
...
@@ -836,18 +835,6 @@ class TexinfoParser:
...
@@ -836,18 +835,6 @@ class TexinfoParser:
if
not
self
.
topname
:
self
.
topname
=
name
if
not
self
.
topname
:
self
.
topname
=
name
title
=
name
title
=
name
if
self
.
title
:
title
=
title
+
' -- '
+
self
.
title
if
self
.
title
:
title
=
title
+
' -- '
+
self
.
title
# No idea what this means, but this is what latex2html writes
# self.write('<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">\n')
# self.write('<!- Converted with texi2html and Python>\n')
# self.write ('<P>\n<HEAD>\n')
# self.write('<TITLE>', title, '</TITLE>\n')
# self.write ('</HEAD>\n<BODY>\n<P>\n<BR> <HR>\n')
# self.link('Next', next)
# self.link('Prev', prev)
# self.link('Up', up)
# if self.nodename <> self.topname:
# self.link('Top', self.topname)
# self.write ('<BR> <HR> <P>\n')
self
.
node
=
Node
(
self
.
dirname
,
self
.
nodename
,
self
.
topname
,
\
self
.
node
=
Node
(
self
.
dirname
,
self
.
nodename
,
self
.
topname
,
\
title
,
next
,
prev
,
up
)
title
,
next
,
prev
,
up
)
...
@@ -965,14 +952,26 @@ class TexinfoParser:
...
@@ -965,14 +952,26 @@ class TexinfoParser:
do_summarycontents
=
do_shortcontents
do_summarycontents
=
do_shortcontents
def
listcontents
(
self
,
title
,
maxlevel
):
def
listcontents
(
self
,
title
,
maxlevel
):
self
.
write
(
'<H1>'
,
title
,
'</H1>
\n
<UL COMPACT>
\n
'
)
self
.
write
(
'<H1>'
,
title
,
'</H1>
\n
<UL COMPACT PLAIN>
\n
'
)
prevlevels
=
[
0
]
for
level
,
title
,
node
in
self
.
contents
:
for
level
,
title
,
node
in
self
.
contents
:
if
level
<=
maxlevel
:
if
level
>
maxlevel
:
self
.
write
(
'<LI>'
,
'. '
*
level
,
'<A HREF="'
,
\
continue
makefile
(
node
),
'">'
)
if
level
>
prevlevels
[
-
1
]:
self
.
expand
(
title
)
# can only advance one level at a time
self
.
write
(
'</A> '
,
node
,
'
\n
'
)
self
.
write
(
' '
*
prevlevels
[
-
1
],
'<UL PLAIN>
\n
'
)
self
.
write
(
'</UL>
\n
'
)
prevlevels
.
append
(
level
)
elif
level
<
prevlevels
[
-
1
]:
# might drop back multiple levels
while
level
<
prevlevels
[
-
1
]:
del
prevlevels
[
-
1
]
self
.
write
(
' '
*
prevlevels
[
-
1
],
'</UL>
\n
'
)
self
.
write
(
' '
*
level
,
'<LI> <A HREF="'
,
makefile
(
node
),
'">'
)
self
.
expand
(
title
)
self
.
write
(
'</A>
\n
'
)
self
.
write
(
'</UL>
\n
'
*
len
(
prevlevels
))
# --- Page lay-out ---
# --- Page lay-out ---
...
@@ -1229,14 +1228,14 @@ class TexinfoParser:
...
@@ -1229,14 +1228,14 @@ class TexinfoParser:
# --- Enumerations, displays, quotations ---
# --- Enumerations, displays, quotations ---
# XXX Most of these should increase the indentation somehow
# XXX Most of these should increase the indentation somehow
def
bgn_quotation
(
self
,
args
):
self
.
write
(
'<
P
>'
)
def
bgn_quotation
(
self
,
args
):
self
.
write
(
'<
BLOCKQUOTE
>'
)
def
end_quotation
(
self
):
self
.
write
(
'<
P
>
\n
'
)
def
end_quotation
(
self
):
self
.
write
(
'<
/BLOCKQUOTE
>
\n
'
)
def
bgn_example
(
self
,
args
):
def
bgn_example
(
self
,
args
):
self
.
nofill
=
self
.
nofill
+
1
self
.
nofill
=
self
.
nofill
+
1
self
.
write
(
'<PRE>
<CODE>
'
)
self
.
write
(
'<PRE>'
)
def
end_example
(
self
):
def
end_example
(
self
):
self
.
write
(
'</
CODE></
PRE>'
)
self
.
write
(
'</PRE>'
)
self
.
nofill
=
self
.
nofill
-
1
self
.
nofill
=
self
.
nofill
-
1
bgn_lisp
=
bgn_example
# Synonym when contents are executable lisp code
bgn_lisp
=
bgn_example
# Synonym when contents are executable lisp code
...
@@ -1248,19 +1247,11 @@ class TexinfoParser:
...
@@ -1248,19 +1247,11 @@ class TexinfoParser:
bgn_smalllisp
=
bgn_lisp
# Ditto
bgn_smalllisp
=
bgn_lisp
# Ditto
end_smalllisp
=
end_lisp
end_smalllisp
=
end_lisp
def
bgn_display
(
self
,
args
):
bgn_display
=
bgn_example
self
.
nofill
=
self
.
nofill
+
1
end_display
=
end_example
self
.
write
(
'<PRE>
\n
'
)
def
end_display
(
self
):
self
.
write
(
'</PRE>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
def
bgn_format
(
self
,
args
):
bgn_format
=
bgn_display
self
.
nofill
=
self
.
nofill
+
1
end_format
=
end_display
self
.
write
(
'<PRE><CODE>
\n
'
)
def
end_format
(
self
):
self
.
write
(
'</CODE></PRE>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
def
do_exdent
(
self
,
args
):
self
.
expand
(
args
+
'
\n
'
)
def
do_exdent
(
self
,
args
):
self
.
expand
(
args
+
'
\n
'
)
# XXX Should really mess with indentation
# XXX Should really mess with indentation
...
@@ -1279,8 +1270,10 @@ class TexinfoParser:
...
@@ -1279,8 +1270,10 @@ class TexinfoParser:
self
.
write
(
'</ADDRESS>
\n
'
)
self
.
write
(
'</ADDRESS>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
self
.
nofill
=
self
.
nofill
-
1
def
bgn_menu
(
self
,
args
):
self
.
write
(
'<H2>Menu</H2><DL COMPACT>
\n
'
)
def
bgn_menu
(
self
,
args
):
def
end_menu
(
self
):
self
.
write
(
'</DL>
\n
'
)
self
.
write
(
'<DIR>
\n
'
)
self
.
write
(
' <STRONG><EM>Menu</EM></STRONG><P>
\n
'
)
def
end_menu
(
self
):
self
.
write
(
'</DIR>
\n
'
)
def
bgn_cartouche
(
self
,
args
):
pass
def
bgn_cartouche
(
self
,
args
):
pass
def
end_cartouche
(
self
):
pass
def
end_cartouche
(
self
):
pass
...
@@ -1364,13 +1357,18 @@ class TexinfoParser:
...
@@ -1364,13 +1357,18 @@ class TexinfoParser:
del
index
[:]
del
index
[:]
index1
.
sort
()
index1
.
sort
()
self
.
write
(
'<DL COMPACT>
\n
'
)
self
.
write
(
'<DL COMPACT>
\n
'
)
prevkey
=
prevnode
=
None
for
sortkey
,
key
,
node
in
index1
:
for
sortkey
,
key
,
node
in
index1
:
if
(
key
,
node
)
==
(
prevkey
,
prevnode
):
continue
if
self
.
debugging
>
1
:
print
key
,
':'
,
node
if
self
.
debugging
>
1
:
print
key
,
':'
,
node
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
if
iscodeindex
:
key
=
'@code{'
+
key
+
'}'
if
iscodeindex
:
key
=
'@code{'
+
key
+
'}'
self
.
expand
(
key
)
if
key
!=
prevkey
:
self
.
expand
(
key
)
self
.
write
(
'<DD><A HREF="'
,
makefile
(
node
),
\
self
.
write
(
'<DD><A HREF="'
,
makefile
(
node
),
\
'">'
,
node
,
'</A>
\n
'
)
'">'
,
node
,
'</A>
\n
'
)
prevkey
,
prevnode
=
key
,
node
self
.
write
(
'</DL>
\n
'
)
self
.
write
(
'</DL>
\n
'
)
# --- Final error reports ---
# --- Final error reports ---
...
...
Doc/tools/texi2html.py
Dosyayı görüntüle @
29901ff5
...
@@ -74,8 +74,7 @@ class Node:
...
@@ -74,8 +74,7 @@ class Node:
self
.
cont
=
''
self
.
cont
=
''
def
write
(
self
,
*
lines
):
def
write
(
self
,
*
lines
):
for
line
in
lines
:
map
(
self
.
lines
.
append
,
lines
)
self
.
lines
.
append
(
line
)
def
flush
(
self
):
def
flush
(
self
):
fp
=
open
(
self
.
dirname
+
'/'
+
makefile
(
self
.
name
),
'w'
)
fp
=
open
(
self
.
dirname
+
'/'
+
makefile
(
self
.
name
),
'w'
)
...
@@ -99,7 +98,7 @@ class Node:
...
@@ -99,7 +98,7 @@ class Node:
length
=
len
(
self
.
lines
)
length
=
len
(
self
.
lines
)
self
.
text
=
string
.
joinfields
(
self
.
lines
,
''
)
self
.
text
=
string
.
joinfields
(
self
.
lines
,
''
)
self
.
lines
=
[]
self
.
lines
=
[]
self
.
write
(
'<
BR> <
HR>
\n
'
)
self
.
write
(
'<HR>
\n
'
)
if
self
.
cont
!=
self
.
next
:
if
self
.
cont
!=
self
.
next
:
self
.
link
(
'Cont'
,
self
.
cont
)
self
.
link
(
'Cont'
,
self
.
cont
)
self
.
link
(
'Next'
,
self
.
next
)
self
.
link
(
'Next'
,
self
.
next
)
...
@@ -107,20 +106,19 @@ class Node:
...
@@ -107,20 +106,19 @@ class Node:
self
.
link
(
'Up'
,
self
.
up
)
self
.
link
(
'Up'
,
self
.
up
)
if
self
.
name
<>
self
.
topname
:
if
self
.
name
<>
self
.
topname
:
self
.
link
(
'Top'
,
self
.
topname
)
self
.
link
(
'Top'
,
self
.
topname
)
self
.
write
(
'<
BR> <HR> <P
>
\n
'
)
self
.
write
(
'<
HR
>
\n
'
)
links
=
string
.
joinfields
(
self
.
lines
,
''
)
links
=
string
.
joinfields
(
self
.
lines
,
''
)
self
.
lines
=
[]
self
.
lines
=
[]
self
.
prologue
=
\
self
.
prologue
=
(
'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
\n
'
'<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
\n
'
+
\
'<!-- Converted with texi2html and Python -->
\n
'
'<!- Converted with texi2html and Python>
\n
'
+
\
'<HEAD>
\n
'
'<P>
\n
<HEAD>
\n
'
+
\
' <TITLE>'
+
self
.
title
+
'</TITLE>
\n
'
'<TITLE>'
+
self
.
title
+
'</TITLE>
\n
'
+
\
'</HEAD><BODY>
\n
'
+
\
'</HEAD>
\n
<BODY>
\n
<P>
\n
'
+
\
links
)
links
if
length
>
20
:
if
length
>
20
:
self
.
epilogue
=
links
+
'</BODY>
\n
'
self
.
epilogue
=
'<P>
\n
%
s</BODY>
\n
'
%
links
else
:
else
:
self
.
epilogue
=
'</BODY>
\n
'
self
.
epilogue
=
'</BODY>
\n
'
...
@@ -311,10 +309,10 @@ class TexinfoParser:
...
@@ -311,10 +309,10 @@ class TexinfoParser:
if
nodename
[
0
]
==
':'
:
nodename
=
label
if
nodename
[
0
]
==
':'
:
nodename
=
label
else
:
nodename
=
line
[
e
:
f
]
else
:
nodename
=
line
[
e
:
f
]
punct
=
line
[
g
:
h
]
punct
=
line
[
g
:
h
]
self
.
write
(
'<
DT><A HREF="'
,
\
self
.
write
(
'<
LI><A HREF="'
,
makefile
(
nodename
),
\
makefile
(
nodename
),
'" TYPE=Menu>'
,
nodename
,
\
'">'
,
nodename
,
'</A>'
,
punct
,
'
\n
<DD>
'
)
'</A>'
,
punct
,
'
\n
'
)
self
.
expand
(
line
[
end
:])
self
.
expand
(
line
[
end
:])
else
:
else
:
text
=
string
.
joinfields
(
accu
,
''
)
text
=
string
.
joinfields
(
accu
,
''
)
...
@@ -577,8 +575,8 @@ class TexinfoParser:
...
@@ -577,8 +575,8 @@ class TexinfoParser:
def
open_dfn
(
self
):
self
.
write
(
'<DFN>'
)
def
open_dfn
(
self
):
self
.
write
(
'<DFN>'
)
def
close_dfn
(
self
):
self
.
write
(
'</DFN>'
)
def
close_dfn
(
self
):
self
.
write
(
'</DFN>'
)
def
open_emph
(
self
):
self
.
write
(
'<
I
>'
)
def
open_emph
(
self
):
self
.
write
(
'<
EM
>'
)
def
close_emph
(
self
):
self
.
write
(
'</
I
>'
)
def
close_emph
(
self
):
self
.
write
(
'</
EM
>'
)
open_i
=
open_emph
open_i
=
open_emph
close_i
=
close_emph
close_i
=
close_emph
...
@@ -599,15 +597,16 @@ class TexinfoParser:
...
@@ -599,15 +597,16 @@ class TexinfoParser:
# self.savetext = None
# self.savetext = None
def
writefootnotes
(
self
):
def
writefootnotes
(
self
):
self
.
write
(
'<H2>---------- Footnotes ----------</H2>
\n
'
)
self
.
write
(
'
\n
<HR NOSHADE SIZE=1 WIDTH=200>
\n
'
'<STRONG><EM>Footnotes</EM></STRONG>
\n
<P>'
)
for
id
,
text
in
self
.
footnotes
:
for
id
,
text
in
self
.
footnotes
:
self
.
write
(
'<A NAME="footnotetext'
,
id
,
\
self
.
write
(
'<A NAME="footnotetext'
,
id
,
\
'" HREF="#footnoteref'
,
id
,
'">('
,
\
'" HREF="#footnoteref'
,
id
,
'">('
,
\
id
,
')</A>
\n
'
,
text
,
'<P>
\n
'
)
id
,
')</A>
\n
'
,
text
,
'<P>
\n
'
)
self
.
footnotes
=
[]
self
.
footnotes
=
[]
def
open_file
(
self
):
self
.
write
(
'<
FIL
E>'
)
def
open_file
(
self
):
self
.
write
(
'<
COD
E>'
)
def
close_file
(
self
):
self
.
write
(
'</
FIL
E>'
)
def
close_file
(
self
):
self
.
write
(
'</
COD
E>'
)
def
open_kbd
(
self
):
self
.
write
(
'<KBD>'
)
def
open_kbd
(
self
):
self
.
write
(
'<KBD>'
)
def
close_kbd
(
self
):
self
.
write
(
'</KBD>'
)
def
close_kbd
(
self
):
self
.
write
(
'</KBD>'
)
...
@@ -836,18 +835,6 @@ class TexinfoParser:
...
@@ -836,18 +835,6 @@ class TexinfoParser:
if
not
self
.
topname
:
self
.
topname
=
name
if
not
self
.
topname
:
self
.
topname
=
name
title
=
name
title
=
name
if
self
.
title
:
title
=
title
+
' -- '
+
self
.
title
if
self
.
title
:
title
=
title
+
' -- '
+
self
.
title
# No idea what this means, but this is what latex2html writes
# self.write('<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">\n')
# self.write('<!- Converted with texi2html and Python>\n')
# self.write ('<P>\n<HEAD>\n')
# self.write('<TITLE>', title, '</TITLE>\n')
# self.write ('</HEAD>\n<BODY>\n<P>\n<BR> <HR>\n')
# self.link('Next', next)
# self.link('Prev', prev)
# self.link('Up', up)
# if self.nodename <> self.topname:
# self.link('Top', self.topname)
# self.write ('<BR> <HR> <P>\n')
self
.
node
=
Node
(
self
.
dirname
,
self
.
nodename
,
self
.
topname
,
\
self
.
node
=
Node
(
self
.
dirname
,
self
.
nodename
,
self
.
topname
,
\
title
,
next
,
prev
,
up
)
title
,
next
,
prev
,
up
)
...
@@ -965,14 +952,26 @@ class TexinfoParser:
...
@@ -965,14 +952,26 @@ class TexinfoParser:
do_summarycontents
=
do_shortcontents
do_summarycontents
=
do_shortcontents
def
listcontents
(
self
,
title
,
maxlevel
):
def
listcontents
(
self
,
title
,
maxlevel
):
self
.
write
(
'<H1>'
,
title
,
'</H1>
\n
<UL COMPACT>
\n
'
)
self
.
write
(
'<H1>'
,
title
,
'</H1>
\n
<UL COMPACT PLAIN>
\n
'
)
prevlevels
=
[
0
]
for
level
,
title
,
node
in
self
.
contents
:
for
level
,
title
,
node
in
self
.
contents
:
if
level
<=
maxlevel
:
if
level
>
maxlevel
:
self
.
write
(
'<LI>'
,
'. '
*
level
,
'<A HREF="'
,
\
continue
makefile
(
node
),
'">'
)
if
level
>
prevlevels
[
-
1
]:
self
.
expand
(
title
)
# can only advance one level at a time
self
.
write
(
'</A> '
,
node
,
'
\n
'
)
self
.
write
(
' '
*
prevlevels
[
-
1
],
'<UL PLAIN>
\n
'
)
self
.
write
(
'</UL>
\n
'
)
prevlevels
.
append
(
level
)
elif
level
<
prevlevels
[
-
1
]:
# might drop back multiple levels
while
level
<
prevlevels
[
-
1
]:
del
prevlevels
[
-
1
]
self
.
write
(
' '
*
prevlevels
[
-
1
],
'</UL>
\n
'
)
self
.
write
(
' '
*
level
,
'<LI> <A HREF="'
,
makefile
(
node
),
'">'
)
self
.
expand
(
title
)
self
.
write
(
'</A>
\n
'
)
self
.
write
(
'</UL>
\n
'
*
len
(
prevlevels
))
# --- Page lay-out ---
# --- Page lay-out ---
...
@@ -1229,14 +1228,14 @@ class TexinfoParser:
...
@@ -1229,14 +1228,14 @@ class TexinfoParser:
# --- Enumerations, displays, quotations ---
# --- Enumerations, displays, quotations ---
# XXX Most of these should increase the indentation somehow
# XXX Most of these should increase the indentation somehow
def
bgn_quotation
(
self
,
args
):
self
.
write
(
'<
P
>'
)
def
bgn_quotation
(
self
,
args
):
self
.
write
(
'<
BLOCKQUOTE
>'
)
def
end_quotation
(
self
):
self
.
write
(
'<
P
>
\n
'
)
def
end_quotation
(
self
):
self
.
write
(
'<
/BLOCKQUOTE
>
\n
'
)
def
bgn_example
(
self
,
args
):
def
bgn_example
(
self
,
args
):
self
.
nofill
=
self
.
nofill
+
1
self
.
nofill
=
self
.
nofill
+
1
self
.
write
(
'<PRE>
<CODE>
'
)
self
.
write
(
'<PRE>'
)
def
end_example
(
self
):
def
end_example
(
self
):
self
.
write
(
'</
CODE></
PRE>'
)
self
.
write
(
'</PRE>'
)
self
.
nofill
=
self
.
nofill
-
1
self
.
nofill
=
self
.
nofill
-
1
bgn_lisp
=
bgn_example
# Synonym when contents are executable lisp code
bgn_lisp
=
bgn_example
# Synonym when contents are executable lisp code
...
@@ -1248,19 +1247,11 @@ class TexinfoParser:
...
@@ -1248,19 +1247,11 @@ class TexinfoParser:
bgn_smalllisp
=
bgn_lisp
# Ditto
bgn_smalllisp
=
bgn_lisp
# Ditto
end_smalllisp
=
end_lisp
end_smalllisp
=
end_lisp
def
bgn_display
(
self
,
args
):
bgn_display
=
bgn_example
self
.
nofill
=
self
.
nofill
+
1
end_display
=
end_example
self
.
write
(
'<PRE>
\n
'
)
def
end_display
(
self
):
self
.
write
(
'</PRE>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
def
bgn_format
(
self
,
args
):
bgn_format
=
bgn_display
self
.
nofill
=
self
.
nofill
+
1
end_format
=
end_display
self
.
write
(
'<PRE><CODE>
\n
'
)
def
end_format
(
self
):
self
.
write
(
'</CODE></PRE>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
def
do_exdent
(
self
,
args
):
self
.
expand
(
args
+
'
\n
'
)
def
do_exdent
(
self
,
args
):
self
.
expand
(
args
+
'
\n
'
)
# XXX Should really mess with indentation
# XXX Should really mess with indentation
...
@@ -1279,8 +1270,10 @@ class TexinfoParser:
...
@@ -1279,8 +1270,10 @@ class TexinfoParser:
self
.
write
(
'</ADDRESS>
\n
'
)
self
.
write
(
'</ADDRESS>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
self
.
nofill
=
self
.
nofill
-
1
def
bgn_menu
(
self
,
args
):
self
.
write
(
'<H2>Menu</H2><DL COMPACT>
\n
'
)
def
bgn_menu
(
self
,
args
):
def
end_menu
(
self
):
self
.
write
(
'</DL>
\n
'
)
self
.
write
(
'<DIR>
\n
'
)
self
.
write
(
' <STRONG><EM>Menu</EM></STRONG><P>
\n
'
)
def
end_menu
(
self
):
self
.
write
(
'</DIR>
\n
'
)
def
bgn_cartouche
(
self
,
args
):
pass
def
bgn_cartouche
(
self
,
args
):
pass
def
end_cartouche
(
self
):
pass
def
end_cartouche
(
self
):
pass
...
@@ -1364,13 +1357,18 @@ class TexinfoParser:
...
@@ -1364,13 +1357,18 @@ class TexinfoParser:
del
index
[:]
del
index
[:]
index1
.
sort
()
index1
.
sort
()
self
.
write
(
'<DL COMPACT>
\n
'
)
self
.
write
(
'<DL COMPACT>
\n
'
)
prevkey
=
prevnode
=
None
for
sortkey
,
key
,
node
in
index1
:
for
sortkey
,
key
,
node
in
index1
:
if
(
key
,
node
)
==
(
prevkey
,
prevnode
):
continue
if
self
.
debugging
>
1
:
print
key
,
':'
,
node
if
self
.
debugging
>
1
:
print
key
,
':'
,
node
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
if
iscodeindex
:
key
=
'@code{'
+
key
+
'}'
if
iscodeindex
:
key
=
'@code{'
+
key
+
'}'
self
.
expand
(
key
)
if
key
!=
prevkey
:
self
.
expand
(
key
)
self
.
write
(
'<DD><A HREF="'
,
makefile
(
node
),
\
self
.
write
(
'<DD><A HREF="'
,
makefile
(
node
),
\
'">'
,
node
,
'</A>
\n
'
)
'">'
,
node
,
'</A>
\n
'
)
prevkey
,
prevnode
=
key
,
node
self
.
write
(
'</DL>
\n
'
)
self
.
write
(
'</DL>
\n
'
)
# --- Final error reports ---
# --- Final error reports ---
...
...
Tools/scripts/texi2html.py
Dosyayı görüntüle @
29901ff5
...
@@ -74,8 +74,7 @@ class Node:
...
@@ -74,8 +74,7 @@ class Node:
self
.
cont
=
''
self
.
cont
=
''
def
write
(
self
,
*
lines
):
def
write
(
self
,
*
lines
):
for
line
in
lines
:
map
(
self
.
lines
.
append
,
lines
)
self
.
lines
.
append
(
line
)
def
flush
(
self
):
def
flush
(
self
):
fp
=
open
(
self
.
dirname
+
'/'
+
makefile
(
self
.
name
),
'w'
)
fp
=
open
(
self
.
dirname
+
'/'
+
makefile
(
self
.
name
),
'w'
)
...
@@ -99,7 +98,7 @@ class Node:
...
@@ -99,7 +98,7 @@ class Node:
length
=
len
(
self
.
lines
)
length
=
len
(
self
.
lines
)
self
.
text
=
string
.
joinfields
(
self
.
lines
,
''
)
self
.
text
=
string
.
joinfields
(
self
.
lines
,
''
)
self
.
lines
=
[]
self
.
lines
=
[]
self
.
write
(
'<
BR> <
HR>
\n
'
)
self
.
write
(
'<HR>
\n
'
)
if
self
.
cont
!=
self
.
next
:
if
self
.
cont
!=
self
.
next
:
self
.
link
(
'Cont'
,
self
.
cont
)
self
.
link
(
'Cont'
,
self
.
cont
)
self
.
link
(
'Next'
,
self
.
next
)
self
.
link
(
'Next'
,
self
.
next
)
...
@@ -107,20 +106,19 @@ class Node:
...
@@ -107,20 +106,19 @@ class Node:
self
.
link
(
'Up'
,
self
.
up
)
self
.
link
(
'Up'
,
self
.
up
)
if
self
.
name
<>
self
.
topname
:
if
self
.
name
<>
self
.
topname
:
self
.
link
(
'Top'
,
self
.
topname
)
self
.
link
(
'Top'
,
self
.
topname
)
self
.
write
(
'<
BR> <HR> <P
>
\n
'
)
self
.
write
(
'<
HR
>
\n
'
)
links
=
string
.
joinfields
(
self
.
lines
,
''
)
links
=
string
.
joinfields
(
self
.
lines
,
''
)
self
.
lines
=
[]
self
.
lines
=
[]
self
.
prologue
=
\
self
.
prologue
=
(
'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
\n
'
'<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
\n
'
+
\
'<!-- Converted with texi2html and Python -->
\n
'
'<!- Converted with texi2html and Python>
\n
'
+
\
'<HEAD>
\n
'
'<P>
\n
<HEAD>
\n
'
+
\
' <TITLE>'
+
self
.
title
+
'</TITLE>
\n
'
'<TITLE>'
+
self
.
title
+
'</TITLE>
\n
'
+
\
'</HEAD><BODY>
\n
'
+
\
'</HEAD>
\n
<BODY>
\n
<P>
\n
'
+
\
links
)
links
if
length
>
20
:
if
length
>
20
:
self
.
epilogue
=
links
+
'</BODY>
\n
'
self
.
epilogue
=
'<P>
\n
%
s</BODY>
\n
'
%
links
else
:
else
:
self
.
epilogue
=
'</BODY>
\n
'
self
.
epilogue
=
'</BODY>
\n
'
...
@@ -311,10 +309,10 @@ class TexinfoParser:
...
@@ -311,10 +309,10 @@ class TexinfoParser:
if
nodename
[
0
]
==
':'
:
nodename
=
label
if
nodename
[
0
]
==
':'
:
nodename
=
label
else
:
nodename
=
line
[
e
:
f
]
else
:
nodename
=
line
[
e
:
f
]
punct
=
line
[
g
:
h
]
punct
=
line
[
g
:
h
]
self
.
write
(
'<
DT><A HREF="'
,
\
self
.
write
(
'<
LI><A HREF="'
,
makefile
(
nodename
),
\
makefile
(
nodename
),
'" TYPE=Menu>'
,
nodename
,
\
'">'
,
nodename
,
'</A>'
,
punct
,
'
\n
<DD>
'
)
'</A>'
,
punct
,
'
\n
'
)
self
.
expand
(
line
[
end
:])
self
.
expand
(
line
[
end
:])
else
:
else
:
text
=
string
.
joinfields
(
accu
,
''
)
text
=
string
.
joinfields
(
accu
,
''
)
...
@@ -577,8 +575,8 @@ class TexinfoParser:
...
@@ -577,8 +575,8 @@ class TexinfoParser:
def
open_dfn
(
self
):
self
.
write
(
'<DFN>'
)
def
open_dfn
(
self
):
self
.
write
(
'<DFN>'
)
def
close_dfn
(
self
):
self
.
write
(
'</DFN>'
)
def
close_dfn
(
self
):
self
.
write
(
'</DFN>'
)
def
open_emph
(
self
):
self
.
write
(
'<
I
>'
)
def
open_emph
(
self
):
self
.
write
(
'<
EM
>'
)
def
close_emph
(
self
):
self
.
write
(
'</
I
>'
)
def
close_emph
(
self
):
self
.
write
(
'</
EM
>'
)
open_i
=
open_emph
open_i
=
open_emph
close_i
=
close_emph
close_i
=
close_emph
...
@@ -599,15 +597,16 @@ class TexinfoParser:
...
@@ -599,15 +597,16 @@ class TexinfoParser:
# self.savetext = None
# self.savetext = None
def
writefootnotes
(
self
):
def
writefootnotes
(
self
):
self
.
write
(
'<H2>---------- Footnotes ----------</H2>
\n
'
)
self
.
write
(
'
\n
<HR NOSHADE SIZE=1 WIDTH=200>
\n
'
'<STRONG><EM>Footnotes</EM></STRONG>
\n
<P>'
)
for
id
,
text
in
self
.
footnotes
:
for
id
,
text
in
self
.
footnotes
:
self
.
write
(
'<A NAME="footnotetext'
,
id
,
\
self
.
write
(
'<A NAME="footnotetext'
,
id
,
\
'" HREF="#footnoteref'
,
id
,
'">('
,
\
'" HREF="#footnoteref'
,
id
,
'">('
,
\
id
,
')</A>
\n
'
,
text
,
'<P>
\n
'
)
id
,
')</A>
\n
'
,
text
,
'<P>
\n
'
)
self
.
footnotes
=
[]
self
.
footnotes
=
[]
def
open_file
(
self
):
self
.
write
(
'<
FIL
E>'
)
def
open_file
(
self
):
self
.
write
(
'<
COD
E>'
)
def
close_file
(
self
):
self
.
write
(
'</
FIL
E>'
)
def
close_file
(
self
):
self
.
write
(
'</
COD
E>'
)
def
open_kbd
(
self
):
self
.
write
(
'<KBD>'
)
def
open_kbd
(
self
):
self
.
write
(
'<KBD>'
)
def
close_kbd
(
self
):
self
.
write
(
'</KBD>'
)
def
close_kbd
(
self
):
self
.
write
(
'</KBD>'
)
...
@@ -836,18 +835,6 @@ class TexinfoParser:
...
@@ -836,18 +835,6 @@ class TexinfoParser:
if
not
self
.
topname
:
self
.
topname
=
name
if
not
self
.
topname
:
self
.
topname
=
name
title
=
name
title
=
name
if
self
.
title
:
title
=
title
+
' -- '
+
self
.
title
if
self
.
title
:
title
=
title
+
' -- '
+
self
.
title
# No idea what this means, but this is what latex2html writes
# self.write('<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">\n')
# self.write('<!- Converted with texi2html and Python>\n')
# self.write ('<P>\n<HEAD>\n')
# self.write('<TITLE>', title, '</TITLE>\n')
# self.write ('</HEAD>\n<BODY>\n<P>\n<BR> <HR>\n')
# self.link('Next', next)
# self.link('Prev', prev)
# self.link('Up', up)
# if self.nodename <> self.topname:
# self.link('Top', self.topname)
# self.write ('<BR> <HR> <P>\n')
self
.
node
=
Node
(
self
.
dirname
,
self
.
nodename
,
self
.
topname
,
\
self
.
node
=
Node
(
self
.
dirname
,
self
.
nodename
,
self
.
topname
,
\
title
,
next
,
prev
,
up
)
title
,
next
,
prev
,
up
)
...
@@ -965,14 +952,26 @@ class TexinfoParser:
...
@@ -965,14 +952,26 @@ class TexinfoParser:
do_summarycontents
=
do_shortcontents
do_summarycontents
=
do_shortcontents
def
listcontents
(
self
,
title
,
maxlevel
):
def
listcontents
(
self
,
title
,
maxlevel
):
self
.
write
(
'<H1>'
,
title
,
'</H1>
\n
<UL COMPACT>
\n
'
)
self
.
write
(
'<H1>'
,
title
,
'</H1>
\n
<UL COMPACT PLAIN>
\n
'
)
prevlevels
=
[
0
]
for
level
,
title
,
node
in
self
.
contents
:
for
level
,
title
,
node
in
self
.
contents
:
if
level
<=
maxlevel
:
if
level
>
maxlevel
:
self
.
write
(
'<LI>'
,
'. '
*
level
,
'<A HREF="'
,
\
continue
makefile
(
node
),
'">'
)
if
level
>
prevlevels
[
-
1
]:
self
.
expand
(
title
)
# can only advance one level at a time
self
.
write
(
'</A> '
,
node
,
'
\n
'
)
self
.
write
(
' '
*
prevlevels
[
-
1
],
'<UL PLAIN>
\n
'
)
self
.
write
(
'</UL>
\n
'
)
prevlevels
.
append
(
level
)
elif
level
<
prevlevels
[
-
1
]:
# might drop back multiple levels
while
level
<
prevlevels
[
-
1
]:
del
prevlevels
[
-
1
]
self
.
write
(
' '
*
prevlevels
[
-
1
],
'</UL>
\n
'
)
self
.
write
(
' '
*
level
,
'<LI> <A HREF="'
,
makefile
(
node
),
'">'
)
self
.
expand
(
title
)
self
.
write
(
'</A>
\n
'
)
self
.
write
(
'</UL>
\n
'
*
len
(
prevlevels
))
# --- Page lay-out ---
# --- Page lay-out ---
...
@@ -1229,14 +1228,14 @@ class TexinfoParser:
...
@@ -1229,14 +1228,14 @@ class TexinfoParser:
# --- Enumerations, displays, quotations ---
# --- Enumerations, displays, quotations ---
# XXX Most of these should increase the indentation somehow
# XXX Most of these should increase the indentation somehow
def
bgn_quotation
(
self
,
args
):
self
.
write
(
'<
P
>'
)
def
bgn_quotation
(
self
,
args
):
self
.
write
(
'<
BLOCKQUOTE
>'
)
def
end_quotation
(
self
):
self
.
write
(
'<
P
>
\n
'
)
def
end_quotation
(
self
):
self
.
write
(
'<
/BLOCKQUOTE
>
\n
'
)
def
bgn_example
(
self
,
args
):
def
bgn_example
(
self
,
args
):
self
.
nofill
=
self
.
nofill
+
1
self
.
nofill
=
self
.
nofill
+
1
self
.
write
(
'<PRE>
<CODE>
'
)
self
.
write
(
'<PRE>'
)
def
end_example
(
self
):
def
end_example
(
self
):
self
.
write
(
'</
CODE></
PRE>'
)
self
.
write
(
'</PRE>'
)
self
.
nofill
=
self
.
nofill
-
1
self
.
nofill
=
self
.
nofill
-
1
bgn_lisp
=
bgn_example
# Synonym when contents are executable lisp code
bgn_lisp
=
bgn_example
# Synonym when contents are executable lisp code
...
@@ -1248,19 +1247,11 @@ class TexinfoParser:
...
@@ -1248,19 +1247,11 @@ class TexinfoParser:
bgn_smalllisp
=
bgn_lisp
# Ditto
bgn_smalllisp
=
bgn_lisp
# Ditto
end_smalllisp
=
end_lisp
end_smalllisp
=
end_lisp
def
bgn_display
(
self
,
args
):
bgn_display
=
bgn_example
self
.
nofill
=
self
.
nofill
+
1
end_display
=
end_example
self
.
write
(
'<PRE>
\n
'
)
def
end_display
(
self
):
self
.
write
(
'</PRE>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
def
bgn_format
(
self
,
args
):
bgn_format
=
bgn_display
self
.
nofill
=
self
.
nofill
+
1
end_format
=
end_display
self
.
write
(
'<PRE><CODE>
\n
'
)
def
end_format
(
self
):
self
.
write
(
'</CODE></PRE>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
def
do_exdent
(
self
,
args
):
self
.
expand
(
args
+
'
\n
'
)
def
do_exdent
(
self
,
args
):
self
.
expand
(
args
+
'
\n
'
)
# XXX Should really mess with indentation
# XXX Should really mess with indentation
...
@@ -1279,8 +1270,10 @@ class TexinfoParser:
...
@@ -1279,8 +1270,10 @@ class TexinfoParser:
self
.
write
(
'</ADDRESS>
\n
'
)
self
.
write
(
'</ADDRESS>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
self
.
nofill
=
self
.
nofill
-
1
def
bgn_menu
(
self
,
args
):
self
.
write
(
'<H2>Menu</H2><DL COMPACT>
\n
'
)
def
bgn_menu
(
self
,
args
):
def
end_menu
(
self
):
self
.
write
(
'</DL>
\n
'
)
self
.
write
(
'<DIR>
\n
'
)
self
.
write
(
' <STRONG><EM>Menu</EM></STRONG><P>
\n
'
)
def
end_menu
(
self
):
self
.
write
(
'</DIR>
\n
'
)
def
bgn_cartouche
(
self
,
args
):
pass
def
bgn_cartouche
(
self
,
args
):
pass
def
end_cartouche
(
self
):
pass
def
end_cartouche
(
self
):
pass
...
@@ -1364,13 +1357,18 @@ class TexinfoParser:
...
@@ -1364,13 +1357,18 @@ class TexinfoParser:
del
index
[:]
del
index
[:]
index1
.
sort
()
index1
.
sort
()
self
.
write
(
'<DL COMPACT>
\n
'
)
self
.
write
(
'<DL COMPACT>
\n
'
)
prevkey
=
prevnode
=
None
for
sortkey
,
key
,
node
in
index1
:
for
sortkey
,
key
,
node
in
index1
:
if
(
key
,
node
)
==
(
prevkey
,
prevnode
):
continue
if
self
.
debugging
>
1
:
print
key
,
':'
,
node
if
self
.
debugging
>
1
:
print
key
,
':'
,
node
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
if
iscodeindex
:
key
=
'@code{'
+
key
+
'}'
if
iscodeindex
:
key
=
'@code{'
+
key
+
'}'
self
.
expand
(
key
)
if
key
!=
prevkey
:
self
.
expand
(
key
)
self
.
write
(
'<DD><A HREF="'
,
makefile
(
node
),
\
self
.
write
(
'<DD><A HREF="'
,
makefile
(
node
),
\
'">'
,
node
,
'</A>
\n
'
)
'">'
,
node
,
'</A>
\n
'
)
prevkey
,
prevnode
=
key
,
node
self
.
write
(
'</DL>
\n
'
)
self
.
write
(
'</DL>
\n
'
)
# --- Final error reports ---
# --- Final error reports ---
...
...
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