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
caf9fca3
Kaydet (Commit)
caf9fca3
authored
Eyl 14, 1998
tarafından
Guido van Rossum
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
nannified
üst
e7e632ab
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
885 additions
and
885 deletions
+885
-885
texi2html.py
Tools/scripts/texi2html.py
+885
-885
No files found.
Tools/scripts/texi2html.py
Dosyayı görüntüle @
caf9fca3
...
@@ -25,12 +25,12 @@
...
@@ -25,12 +25,12 @@
# More consistent handling of chapters/sections/etc.
# More consistent handling of chapters/sections/etc.
# Lots of documentation
# Lots of documentation
# Many more options:
# Many more options:
#
-top
designate top node
#
-top
designate top node
#
-links
customize which types of links are included
#
-links
customize which types of links are included
#
-split split at chapters or sections instead of nodes
#
-split split at chapters or sections instead of nodes
#
-name
Allow different types of filename handling. Non unix systems
#
-name
Allow different types of filename handling. Non unix systems
#
will have problems with long node names
#
will have problems with long node names
#
...
#
...
# Support the most recent texinfo version and take a good look at HTML 3.0
# Support the most recent texinfo version and take a good look at HTML 3.0
# More debugging output (customizable) and more fexible error handling
# More debugging output (customizable) and more fexible error handling
# How about icons ?
# How about icons ?
...
@@ -67,81 +67,81 @@ class HTMLNode:
...
@@ -67,81 +67,81 @@ class HTMLNode:
epilogue
=
'</BODY></HTML>
\n
'
epilogue
=
'</BODY></HTML>
\n
'
def
__init__
(
self
,
dir
,
name
,
topname
,
title
,
next
,
prev
,
up
):
def
__init__
(
self
,
dir
,
name
,
topname
,
title
,
next
,
prev
,
up
):
self
.
dirname
=
dir
self
.
dirname
=
dir
self
.
name
=
name
self
.
name
=
name
if
topname
:
if
topname
:
self
.
topname
=
topname
self
.
topname
=
topname
else
:
else
:
self
.
topname
=
name
self
.
topname
=
name
self
.
title
=
title
self
.
title
=
title
self
.
next
=
next
self
.
next
=
next
self
.
prev
=
prev
self
.
prev
=
prev
self
.
up
=
up
self
.
up
=
up
self
.
lines
=
[]
self
.
lines
=
[]
def
write
(
self
,
*
lines
):
def
write
(
self
,
*
lines
):
map
(
self
.
lines
.
append
,
lines
)
map
(
self
.
lines
.
append
,
lines
)
def
flush
(
self
):
def
flush
(
self
):
fp
=
open
(
self
.
dirname
+
'/'
+
makefile
(
self
.
name
),
'w'
)
fp
=
open
(
self
.
dirname
+
'/'
+
makefile
(
self
.
name
),
'w'
)
fp
.
write
(
self
.
prologue
)
fp
.
write
(
self
.
prologue
)
fp
.
write
(
self
.
text
)
fp
.
write
(
self
.
text
)
fp
.
write
(
self
.
epilogue
)
fp
.
write
(
self
.
epilogue
)
fp
.
close
()
fp
.
close
()
def
link
(
self
,
label
,
nodename
,
rel
=
None
,
rev
=
None
):
def
link
(
self
,
label
,
nodename
,
rel
=
None
,
rev
=
None
):
if
nodename
:
if
nodename
:
if
string
.
lower
(
nodename
)
==
'(dir)'
:
if
string
.
lower
(
nodename
)
==
'(dir)'
:
addr
=
'../dir.html'
addr
=
'../dir.html'
title
=
''
title
=
''
else
:
else
:
addr
=
makefile
(
nodename
)
addr
=
makefile
(
nodename
)
title
=
' TITLE="
%
s"'
%
nodename
title
=
' TITLE="
%
s"'
%
nodename
self
.
write
(
label
,
': <A HREF="'
,
addr
,
'"'
,
\
self
.
write
(
label
,
': <A HREF="'
,
addr
,
'"'
,
\
rel
and
(
' REL='
+
rel
)
or
""
,
\
rel
and
(
' REL='
+
rel
)
or
""
,
\
rev
and
(
' REV='
+
rev
)
or
""
,
\
rev
and
(
' REV='
+
rev
)
or
""
,
\
title
,
'>'
,
nodename
,
'</A>
\n
'
)
title
,
'>'
,
nodename
,
'</A>
\n
'
)
def
finalize
(
self
):
def
finalize
(
self
):
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
.
open_links
()
self
.
open_links
()
self
.
output_links
()
self
.
output_links
()
self
.
close_links
()
self
.
close_links
()
links
=
string
.
joinfields
(
self
.
lines
,
''
)
links
=
string
.
joinfields
(
self
.
lines
,
''
)
self
.
lines
=
[]
self
.
lines
=
[]
self
.
prologue
=
(
self
.
prologue
=
(
self
.
DOCTYPE
+
self
.
DOCTYPE
+
'
\n
<HTML><HEAD>
\n
'
'
\n
<HTML><HEAD>
\n
'
' <!-- Converted with texi2html and Python -->
\n
'
' <!-- Converted with texi2html and Python -->
\n
'
' <TITLE>'
+
self
.
title
+
'</TITLE>
\n
'
' <TITLE>'
+
self
.
title
+
'</TITLE>
\n
'
' <LINK REL=Next HREF="'
' <LINK REL=Next HREF="'
+
makefile
(
self
.
next
)
+
'" TITLE="'
+
self
.
next
+
'">
\n
'
+
makefile
(
self
.
next
)
+
'" TITLE="'
+
self
.
next
+
'">
\n
'
' <LINK REL=Previous HREF="'
' <LINK REL=Previous HREF="'
+
makefile
(
self
.
prev
)
+
'" TITLE="'
+
self
.
prev
+
'">
\n
'
+
makefile
(
self
.
prev
)
+
'" TITLE="'
+
self
.
prev
+
'">
\n
'
' <LINK REL=Up HREF="'
' <LINK REL=Up HREF="'
+
makefile
(
self
.
up
)
+
'" TITLE="'
+
self
.
up
+
'">
\n
'
+
makefile
(
self
.
up
)
+
'" TITLE="'
+
self
.
up
+
'">
\n
'
'</HEAD><BODY>
\n
'
+
'</HEAD><BODY>
\n
'
+
links
)
links
)
if
length
>
20
:
if
length
>
20
:
self
.
epilogue
=
'<P>
\n
%
s</BODY></HTML>
\n
'
%
links
self
.
epilogue
=
'<P>
\n
%
s</BODY></HTML>
\n
'
%
links
def
open_links
(
self
):
def
open_links
(
self
):
self
.
write
(
'<HR>
\n
'
)
self
.
write
(
'<HR>
\n
'
)
def
close_links
(
self
):
def
close_links
(
self
):
self
.
write
(
'<HR>
\n
'
)
self
.
write
(
'<HR>
\n
'
)
def
output_links
(
self
):
def
output_links
(
self
):
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
,
rel
=
'Next'
)
self
.
link
(
' Next'
,
self
.
next
,
rel
=
'Next'
)
self
.
link
(
' Prev'
,
self
.
prev
,
rel
=
'Previous'
)
self
.
link
(
' Prev'
,
self
.
prev
,
rel
=
'Previous'
)
self
.
link
(
' Up'
,
self
.
up
,
rel
=
'Up'
)
self
.
link
(
' Up'
,
self
.
up
,
rel
=
'Up'
)
if
self
.
name
<>
self
.
topname
:
if
self
.
name
<>
self
.
topname
:
self
.
link
(
' Top'
,
self
.
topname
)
self
.
link
(
' Top'
,
self
.
topname
)
class
HTML3Node
(
HTMLNode
):
class
HTML3Node
(
HTMLNode
):
...
@@ -149,10 +149,10 @@ class HTML3Node(HTMLNode):
...
@@ -149,10 +149,10 @@ class HTML3Node(HTMLNode):
DOCTYPE
=
'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Level 3//EN//3.0">'
DOCTYPE
=
'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Level 3//EN//3.0">'
def
open_links
(
self
):
def
open_links
(
self
):
self
.
write
(
'<DIV CLASS=Navigation>
\n
<HR>
\n
'
)
self
.
write
(
'<DIV CLASS=Navigation>
\n
<HR>
\n
'
)
def
close_links
(
self
):
def
close_links
(
self
):
self
.
write
(
' <HR>
\n
</DIV>
\n
'
)
self
.
write
(
' <HR>
\n
</DIV>
\n
'
)
class
TexinfoParser
:
class
TexinfoParser
:
...
@@ -160,329 +160,329 @@ class TexinfoParser:
...
@@ -160,329 +160,329 @@ class TexinfoParser:
COPYRIGHT_SYMBOL
=
"©"
COPYRIGHT_SYMBOL
=
"©"
FN_ID_PATTERN
=
"(
%(id)
s)"
FN_ID_PATTERN
=
"(
%(id)
s)"
FN_SOURCE_PATTERN
=
'<A NAME=footnoteref
%(id)
s'
\
FN_SOURCE_PATTERN
=
'<A NAME=footnoteref
%(id)
s'
\
' HREF="#footnotetext
%(id)
s">'
\
' HREF="#footnotetext
%(id)
s">'
\
+
FN_ID_PATTERN
+
'</A>'
+
FN_ID_PATTERN
+
'</A>'
FN_TARGET_PATTERN
=
'<A NAME=footnotetext
%(id)
s'
\
FN_TARGET_PATTERN
=
'<A NAME=footnotetext
%(id)
s'
\
' HREF="#footnoteref
%(id)
s">'
\
' HREF="#footnoteref
%(id)
s">'
\
+
FN_ID_PATTERN
+
'</A>
\n
%(text)
s<P>
\n
'
+
FN_ID_PATTERN
+
'</A>
\n
%(text)
s<P>
\n
'
FN_HEADER
=
'
\n
<P>
\n
<HR NOSHADE SIZE=1 WIDTH=200>
\n
'
\
FN_HEADER
=
'
\n
<P>
\n
<HR NOSHADE SIZE=1 WIDTH=200>
\n
'
\
'<STRONG><EM>Footnotes</EM></STRONG>
\n
<P>'
'<STRONG><EM>Footnotes</EM></STRONG>
\n
<P>'
Node
=
HTMLNode
Node
=
HTMLNode
# Initialize an instance
# Initialize an instance
def
__init__
(
self
):
def
__init__
(
self
):
self
.
unknown
=
{}
# statistics about unknown @-commands
self
.
unknown
=
{}
# statistics about unknown @-commands
self
.
filenames
=
{}
# Check for identical filenames
self
.
filenames
=
{}
# Check for identical filenames
self
.
debugging
=
0
# larger values produce more output
self
.
debugging
=
0
# larger values produce more output
self
.
print_headers
=
0
# always print headers?
self
.
print_headers
=
0
# always print headers?
self
.
nodefp
=
None
# open file we're writing to
self
.
nodefp
=
None
# open file we're writing to
self
.
nodelineno
=
0
# Linenumber relative to node
self
.
nodelineno
=
0
# Linenumber relative to node
self
.
links
=
None
# Links from current node
self
.
links
=
None
# Links from current node
self
.
savetext
=
None
# If not None, save text head instead
self
.
savetext
=
None
# If not None, save text head instead
self
.
savestack
=
[]
# If not None, save text head instead
self
.
savestack
=
[]
# If not None, save text head instead
self
.
dirname
=
'tmp'
# directory where files are created
self
.
dirname
=
'tmp'
# directory where files are created
self
.
includedir
=
'.'
# directory to search @include files
self
.
includedir
=
'.'
# directory to search @include files
self
.
nodename
=
''
# name of current node
self
.
nodename
=
''
# name of current node
self
.
topname
=
''
# name of top node (first node seen)
self
.
topname
=
''
# name of top node (first node seen)
self
.
title
=
''
# title of this whole Texinfo tree
self
.
title
=
''
# title of this whole Texinfo tree
self
.
resetindex
()
# Reset all indices
self
.
resetindex
()
# Reset all indices
self
.
contents
=
[]
# Reset table of contents
self
.
contents
=
[]
# Reset table of contents
self
.
numbering
=
[]
# Reset section numbering counters
self
.
numbering
=
[]
# Reset section numbering counters
self
.
nofill
=
0
# Normal operation: fill paragraphs
self
.
nofill
=
0
# Normal operation: fill paragraphs
self
.
values
=
{
'html'
:
1
}
# Names that should be parsed in ifset
self
.
values
=
{
'html'
:
1
}
# Names that should be parsed in ifset
self
.
stackinfo
=
{}
# Keep track of state in the stack
self
.
stackinfo
=
{}
# Keep track of state in the stack
# XXX The following should be reset per node?!
# XXX The following should be reset per node?!
self
.
footnotes
=
[]
# Reset list of footnotes
self
.
footnotes
=
[]
# Reset list of footnotes
self
.
itemarg
=
None
# Reset command used by @item
self
.
itemarg
=
None
# Reset command used by @item
self
.
itemnumber
=
None
# Reset number for @item in @enumerate
self
.
itemnumber
=
None
# Reset number for @item in @enumerate
self
.
itemindex
=
None
# Reset item index name
self
.
itemindex
=
None
# Reset item index name
self
.
node
=
None
self
.
node
=
None
self
.
nodestack
=
[]
self
.
nodestack
=
[]
self
.
cont
=
0
self
.
cont
=
0
self
.
includedepth
=
0
self
.
includedepth
=
0
# Set (output) directory name
# Set (output) directory name
def
setdirname
(
self
,
dirname
):
def
setdirname
(
self
,
dirname
):
self
.
dirname
=
dirname
self
.
dirname
=
dirname
# Set include directory name
# Set include directory name
def
setincludedir
(
self
,
includedir
):
def
setincludedir
(
self
,
includedir
):
self
.
includedir
=
includedir
self
.
includedir
=
includedir
# Parse the contents of an entire file
# Parse the contents of an entire file
def
parse
(
self
,
fp
):
def
parse
(
self
,
fp
):
line
=
fp
.
readline
()
line
=
fp
.
readline
()
lineno
=
1
lineno
=
1
while
line
and
(
line
[
0
]
==
'
%
'
or
blprog
.
match
(
line
)):
while
line
and
(
line
[
0
]
==
'
%
'
or
blprog
.
match
(
line
)):
line
=
fp
.
readline
()
line
=
fp
.
readline
()
lineno
=
lineno
+
1
lineno
=
lineno
+
1
if
line
[:
len
(
MAGIC
)]
<>
MAGIC
:
if
line
[:
len
(
MAGIC
)]
<>
MAGIC
:
raise
SyntaxError
,
'file does not begin with '
+
`MAGIC`
raise
SyntaxError
,
'file does not begin with '
+
`MAGIC`
self
.
parserest
(
fp
,
lineno
)
self
.
parserest
(
fp
,
lineno
)
# Parse the contents of a file, not expecting a MAGIC header
# Parse the contents of a file, not expecting a MAGIC header
def
parserest
(
self
,
fp
,
initial_lineno
):
def
parserest
(
self
,
fp
,
initial_lineno
):
lineno
=
initial_lineno
lineno
=
initial_lineno
self
.
done
=
0
self
.
done
=
0
self
.
skip
=
0
self
.
skip
=
0
self
.
stack
=
[]
self
.
stack
=
[]
accu
=
[]
accu
=
[]
while
not
self
.
done
:
while
not
self
.
done
:
line
=
fp
.
readline
()
line
=
fp
.
readline
()
self
.
nodelineno
=
self
.
nodelineno
+
1
self
.
nodelineno
=
self
.
nodelineno
+
1
if
not
line
:
if
not
line
:
if
accu
:
if
accu
:
if
not
self
.
skip
:
self
.
process
(
accu
)
if
not
self
.
skip
:
self
.
process
(
accu
)
accu
=
[]
accu
=
[]
if
initial_lineno
>
0
:
if
initial_lineno
>
0
:
print
'*** EOF before @bye'
print
'*** EOF before @bye'
break
break
lineno
=
lineno
+
1
lineno
=
lineno
+
1
mo
=
cmprog
.
match
(
line
)
mo
=
cmprog
.
match
(
line
)
if
mo
:
if
mo
:
a
,
b
=
mo
.
span
(
1
)
a
,
b
=
mo
.
span
(
1
)
cmd
=
line
[
a
:
b
]
cmd
=
line
[
a
:
b
]
if
cmd
in
(
'noindent'
,
'refill'
):
if
cmd
in
(
'noindent'
,
'refill'
):
accu
.
append
(
line
)
accu
.
append
(
line
)
else
:
else
:
if
accu
:
if
accu
:
if
not
self
.
skip
:
if
not
self
.
skip
:
self
.
process
(
accu
)
self
.
process
(
accu
)
accu
=
[]
accu
=
[]
self
.
command
(
line
,
mo
)
self
.
command
(
line
,
mo
)
elif
blprog
.
match
(
line
)
and
\
elif
blprog
.
match
(
line
)
and
\
'format'
not
in
self
.
stack
and
\
'format'
not
in
self
.
stack
and
\
'example'
not
in
self
.
stack
:
'example'
not
in
self
.
stack
:
if
accu
:
if
accu
:
if
not
self
.
skip
:
if
not
self
.
skip
:
self
.
process
(
accu
)
self
.
process
(
accu
)
if
self
.
nofill
:
if
self
.
nofill
:
self
.
write
(
'
\n
'
)
self
.
write
(
'
\n
'
)
else
:
else
:
self
.
write
(
'<P>
\n
'
)
self
.
write
(
'<P>
\n
'
)
accu
=
[]
accu
=
[]
else
:
else
:
# Append the line including trailing \n!
# Append the line including trailing \n!
accu
.
append
(
line
)
accu
.
append
(
line
)
#
#
if
self
.
skip
:
if
self
.
skip
:
print
'*** Still skipping at the end'
print
'*** Still skipping at the end'
if
self
.
stack
:
if
self
.
stack
:
print
'*** Stack not empty at the end'
print
'*** Stack not empty at the end'
print
'***'
,
self
.
stack
print
'***'
,
self
.
stack
if
self
.
includedepth
==
0
:
if
self
.
includedepth
==
0
:
while
self
.
nodestack
:
while
self
.
nodestack
:
self
.
nodestack
[
-
1
]
.
finalize
()
self
.
nodestack
[
-
1
]
.
finalize
()
self
.
nodestack
[
-
1
]
.
flush
()
self
.
nodestack
[
-
1
]
.
flush
()
del
self
.
nodestack
[
-
1
]
del
self
.
nodestack
[
-
1
]
# Start saving text in a buffer instead of writing it to a file
# Start saving text in a buffer instead of writing it to a file
def
startsaving
(
self
):
def
startsaving
(
self
):
if
self
.
savetext
<>
None
:
if
self
.
savetext
<>
None
:
self
.
savestack
.
append
(
self
.
savetext
)
self
.
savestack
.
append
(
self
.
savetext
)
# print '*** Recursively saving text, expect trouble'
# print '*** Recursively saving text, expect trouble'
self
.
savetext
=
''
self
.
savetext
=
''
# Return the text saved so far and start writing to file again
# Return the text saved so far and start writing to file again
def
collectsavings
(
self
):
def
collectsavings
(
self
):
savetext
=
self
.
savetext
savetext
=
self
.
savetext
if
len
(
self
.
savestack
)
>
0
:
if
len
(
self
.
savestack
)
>
0
:
self
.
savetext
=
self
.
savestack
[
-
1
]
self
.
savetext
=
self
.
savestack
[
-
1
]
del
self
.
savestack
[
-
1
]
del
self
.
savestack
[
-
1
]
else
:
else
:
self
.
savetext
=
None
self
.
savetext
=
None
return
savetext
or
''
return
savetext
or
''
# Write text to file, or save it in a buffer, or ignore it
# Write text to file, or save it in a buffer, or ignore it
def
write
(
self
,
*
args
):
def
write
(
self
,
*
args
):
try
:
try
:
text
=
string
.
joinfields
(
args
,
''
)
text
=
string
.
joinfields
(
args
,
''
)
except
:
except
:
print
args
print
args
raise
TypeError
raise
TypeError
if
self
.
savetext
<>
None
:
if
self
.
savetext
<>
None
:
self
.
savetext
=
self
.
savetext
+
text
self
.
savetext
=
self
.
savetext
+
text
elif
self
.
nodefp
:
elif
self
.
nodefp
:
self
.
nodefp
.
write
(
text
)
self
.
nodefp
.
write
(
text
)
elif
self
.
node
:
elif
self
.
node
:
self
.
node
.
write
(
text
)
self
.
node
.
write
(
text
)
# Complete the current node -- write footnotes and close file
# Complete the current node -- write footnotes and close file
def
endnode
(
self
):
def
endnode
(
self
):
if
self
.
savetext
<>
None
:
if
self
.
savetext
<>
None
:
print
'*** Still saving text at end of node'
print
'*** Still saving text at end of node'
dummy
=
self
.
collectsavings
()
dummy
=
self
.
collectsavings
()
if
self
.
footnotes
:
if
self
.
footnotes
:
self
.
writefootnotes
()
self
.
writefootnotes
()
if
self
.
nodefp
:
if
self
.
nodefp
:
if
self
.
nodelineno
>
20
:
if
self
.
nodelineno
>
20
:
self
.
write
(
'<HR>
\n
'
)
self
.
write
(
'<HR>
\n
'
)
[
name
,
next
,
prev
,
up
]
=
self
.
nodelinks
[:
4
]
[
name
,
next
,
prev
,
up
]
=
self
.
nodelinks
[:
4
]
self
.
link
(
'Next'
,
next
)
self
.
link
(
'Next'
,
next
)
self
.
link
(
'Prev'
,
prev
)
self
.
link
(
'Prev'
,
prev
)
self
.
link
(
'Up'
,
up
)
self
.
link
(
'Up'
,
up
)
if
self
.
nodename
<>
self
.
topname
:
if
self
.
nodename
<>
self
.
topname
:
self
.
link
(
'Top'
,
self
.
topname
)
self
.
link
(
'Top'
,
self
.
topname
)
self
.
write
(
'<HR>
\n
'
)
self
.
write
(
'<HR>
\n
'
)
self
.
write
(
'</BODY>
\n
'
)
self
.
write
(
'</BODY>
\n
'
)
self
.
nodefp
.
close
()
self
.
nodefp
.
close
()
self
.
nodefp
=
None
self
.
nodefp
=
None
elif
self
.
node
:
elif
self
.
node
:
if
not
self
.
cont
and
\
if
not
self
.
cont
and
\
(
not
self
.
node
.
type
or
\
(
not
self
.
node
.
type
or
\
(
self
.
node
.
next
and
self
.
node
.
prev
and
self
.
node
.
up
)):
(
self
.
node
.
next
and
self
.
node
.
prev
and
self
.
node
.
up
)):
self
.
node
.
finalize
()
self
.
node
.
finalize
()
self
.
node
.
flush
()
self
.
node
.
flush
()
else
:
else
:
self
.
nodestack
.
append
(
self
.
node
)
self
.
nodestack
.
append
(
self
.
node
)
self
.
node
=
None
self
.
node
=
None
self
.
nodename
=
''
self
.
nodename
=
''
# Process a list of lines, expanding embedded @-commands
# Process a list of lines, expanding embedded @-commands
# This mostly distinguishes between menus and normal text
# This mostly distinguishes between menus and normal text
def
process
(
self
,
accu
):
def
process
(
self
,
accu
):
if
self
.
debugging
>
1
:
if
self
.
debugging
>
1
:
print
self
.
skip
,
self
.
stack
,
print
self
.
skip
,
self
.
stack
,
if
accu
:
print
accu
[
0
][:
30
],
if
accu
:
print
accu
[
0
][:
30
],
if
accu
[
0
][
30
:]
or
accu
[
1
:]:
print
'...'
,
if
accu
[
0
][
30
:]
or
accu
[
1
:]:
print
'...'
,
print
print
if
self
.
stack
and
self
.
stack
[
-
1
]
==
'menu'
:
if
self
.
stack
and
self
.
stack
[
-
1
]
==
'menu'
:
# XXX should be done differently
# XXX should be done differently
for
line
in
accu
:
for
line
in
accu
:
mo
=
miprog
.
match
(
line
)
mo
=
miprog
.
match
(
line
)
if
not
mo
:
if
not
mo
:
line
=
string
.
strip
(
line
)
+
'
\n
'
line
=
string
.
strip
(
line
)
+
'
\n
'
self
.
expand
(
line
)
self
.
expand
(
line
)
continue
continue
bgn
,
end
=
mo
.
span
(
0
)
bgn
,
end
=
mo
.
span
(
0
)
a
,
b
=
mo
.
span
(
1
)
a
,
b
=
mo
.
span
(
1
)
c
,
d
=
mo
.
span
(
2
)
c
,
d
=
mo
.
span
(
2
)
e
,
f
=
mo
.
span
(
3
)
e
,
f
=
mo
.
span
(
3
)
g
,
h
=
mo
.
span
(
4
)
g
,
h
=
mo
.
span
(
4
)
label
=
line
[
a
:
b
]
label
=
line
[
a
:
b
]
nodename
=
line
[
c
:
d
]
nodename
=
line
[
c
:
d
]
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
(
' <LI><A HREF="'
,
self
.
write
(
' <LI><A HREF="'
,
makefile
(
nodename
),
makefile
(
nodename
),
'">'
,
nodename
,
'">'
,
nodename
,
'</A>'
,
punct
,
'
\n
'
)
'</A>'
,
punct
,
'
\n
'
)
self
.
expand
(
line
[
end
:])
self
.
expand
(
line
[
end
:])
else
:
else
:
text
=
string
.
joinfields
(
accu
,
''
)
text
=
string
.
joinfields
(
accu
,
''
)
self
.
expand
(
text
)
self
.
expand
(
text
)
# Write a string, expanding embedded @-commands
# Write a string, expanding embedded @-commands
def
expand
(
self
,
text
):
def
expand
(
self
,
text
):
stack
=
[]
stack
=
[]
i
=
0
i
=
0
n
=
len
(
text
)
n
=
len
(
text
)
while
i
<
n
:
while
i
<
n
:
start
=
i
start
=
i
mo
=
spprog
.
search
(
text
,
i
)
mo
=
spprog
.
search
(
text
,
i
)
if
mo
:
if
mo
:
i
=
mo
.
start
()
i
=
mo
.
start
()
else
:
else
:
self
.
write
(
text
[
start
:])
self
.
write
(
text
[
start
:])
break
break
self
.
write
(
text
[
start
:
i
])
self
.
write
(
text
[
start
:
i
])
c
=
text
[
i
]
c
=
text
[
i
]
i
=
i
+
1
i
=
i
+
1
if
c
==
'
\n
'
:
if
c
==
'
\n
'
:
self
.
write
(
'
\n
'
)
self
.
write
(
'
\n
'
)
continue
continue
if
c
==
'<'
:
if
c
==
'<'
:
self
.
write
(
'<'
)
self
.
write
(
'<'
)
continue
continue
if
c
==
'>'
:
if
c
==
'>'
:
self
.
write
(
'>'
)
self
.
write
(
'>'
)
continue
continue
if
c
==
'&'
:
if
c
==
'&'
:
self
.
write
(
'&'
)
self
.
write
(
'&'
)
continue
continue
if
c
==
'{'
:
if
c
==
'{'
:
stack
.
append
(
''
)
stack
.
append
(
''
)
continue
continue
if
c
==
'}'
:
if
c
==
'}'
:
if
not
stack
:
if
not
stack
:
print
'*** Unmatched }'
print
'*** Unmatched }'
self
.
write
(
'}'
)
self
.
write
(
'}'
)
continue
continue
cmd
=
stack
[
-
1
]
cmd
=
stack
[
-
1
]
del
stack
[
-
1
]
del
stack
[
-
1
]
try
:
try
:
method
=
getattr
(
self
,
'close_'
+
cmd
)
method
=
getattr
(
self
,
'close_'
+
cmd
)
except
AttributeError
:
except
AttributeError
:
self
.
unknown_close
(
cmd
)
self
.
unknown_close
(
cmd
)
continue
continue
method
()
method
()
continue
continue
if
c
<>
'@'
:
if
c
<>
'@'
:
# Cannot happen unless spprog is changed
# Cannot happen unless spprog is changed
raise
RuntimeError
,
'unexpected funny '
+
`c`
raise
RuntimeError
,
'unexpected funny '
+
`c`
start
=
i
start
=
i
while
i
<
n
and
text
[
i
]
in
string
.
letters
:
i
=
i
+
1
while
i
<
n
and
text
[
i
]
in
string
.
letters
:
i
=
i
+
1
if
i
==
start
:
if
i
==
start
:
# @ plus non-letter: literal next character
# @ plus non-letter: literal next character
i
=
i
+
1
i
=
i
+
1
c
=
text
[
start
:
i
]
c
=
text
[
start
:
i
]
if
c
==
':'
:
if
c
==
':'
:
# `@:' means no extra space after
# `@:' means no extra space after
# preceding `.', `?', `!' or `:'
# preceding `.', `?', `!' or `:'
pass
pass
else
:
else
:
# `@.' means a sentence-ending period;
# `@.' means a sentence-ending period;
# `@@', `@{', `@}' quote `@', `{', `}'
# `@@', `@{', `@}' quote `@', `{', `}'
self
.
write
(
c
)
self
.
write
(
c
)
continue
continue
cmd
=
text
[
start
:
i
]
cmd
=
text
[
start
:
i
]
if
i
<
n
and
text
[
i
]
==
'{'
:
if
i
<
n
and
text
[
i
]
==
'{'
:
i
=
i
+
1
i
=
i
+
1
stack
.
append
(
cmd
)
stack
.
append
(
cmd
)
try
:
try
:
method
=
getattr
(
self
,
'open_'
+
cmd
)
method
=
getattr
(
self
,
'open_'
+
cmd
)
except
AttributeError
:
except
AttributeError
:
self
.
unknown_open
(
cmd
)
self
.
unknown_open
(
cmd
)
continue
continue
method
()
method
()
continue
continue
try
:
try
:
method
=
getattr
(
self
,
'handle_'
+
cmd
)
method
=
getattr
(
self
,
'handle_'
+
cmd
)
except
AttributeError
:
except
AttributeError
:
self
.
unknown_handle
(
cmd
)
self
.
unknown_handle
(
cmd
)
continue
continue
method
()
method
()
if
stack
:
if
stack
:
print
'*** Stack not empty at para:'
,
stack
print
'*** Stack not empty at para:'
,
stack
# --- Handle unknown embedded @-commands ---
# --- Handle unknown embedded @-commands ---
def
unknown_open
(
self
,
cmd
):
def
unknown_open
(
self
,
cmd
):
print
'*** No open func for @'
+
cmd
+
'{...}'
print
'*** No open func for @'
+
cmd
+
'{...}'
cmd
=
cmd
+
'{'
cmd
=
cmd
+
'{'
self
.
write
(
'@'
,
cmd
)
self
.
write
(
'@'
,
cmd
)
if
not
self
.
unknown
.
has_key
(
cmd
):
if
not
self
.
unknown
.
has_key
(
cmd
):
self
.
unknown
[
cmd
]
=
1
self
.
unknown
[
cmd
]
=
1
else
:
else
:
self
.
unknown
[
cmd
]
=
self
.
unknown
[
cmd
]
+
1
self
.
unknown
[
cmd
]
=
self
.
unknown
[
cmd
]
+
1
def
unknown_close
(
self
,
cmd
):
def
unknown_close
(
self
,
cmd
):
print
'*** No close func for @'
+
cmd
+
'{...}'
print
'*** No close func for @'
+
cmd
+
'{...}'
cmd
=
'}'
+
cmd
cmd
=
'}'
+
cmd
self
.
write
(
'}'
)
self
.
write
(
'}'
)
if
not
self
.
unknown
.
has_key
(
cmd
):
if
not
self
.
unknown
.
has_key
(
cmd
):
self
.
unknown
[
cmd
]
=
1
self
.
unknown
[
cmd
]
=
1
else
:
else
:
self
.
unknown
[
cmd
]
=
self
.
unknown
[
cmd
]
+
1
self
.
unknown
[
cmd
]
=
self
.
unknown
[
cmd
]
+
1
def
unknown_handle
(
self
,
cmd
):
def
unknown_handle
(
self
,
cmd
):
print
'*** No handler for @'
+
cmd
print
'*** No handler for @'
+
cmd
self
.
write
(
'@'
,
cmd
)
self
.
write
(
'@'
,
cmd
)
if
not
self
.
unknown
.
has_key
(
cmd
):
if
not
self
.
unknown
.
has_key
(
cmd
):
self
.
unknown
[
cmd
]
=
1
self
.
unknown
[
cmd
]
=
1
else
:
else
:
self
.
unknown
[
cmd
]
=
self
.
unknown
[
cmd
]
+
1
self
.
unknown
[
cmd
]
=
self
.
unknown
[
cmd
]
+
1
# XXX The following sections should be ordered as the texinfo docs
# XXX The following sections should be ordered as the texinfo docs
...
@@ -495,27 +495,27 @@ class TexinfoParser:
...
@@ -495,27 +495,27 @@ class TexinfoParser:
# --- Include file handling ---
# --- Include file handling ---
def
do_include
(
self
,
args
):
def
do_include
(
self
,
args
):
file
=
args
file
=
args
file
=
os
.
path
.
join
(
self
.
includedir
,
file
)
file
=
os
.
path
.
join
(
self
.
includedir
,
file
)
try
:
try
:
fp
=
open
(
file
,
'r'
)
fp
=
open
(
file
,
'r'
)
except
IOError
,
msg
:
except
IOError
,
msg
:
print
'*** Can
\'
t open include file'
,
`file`
print
'*** Can
\'
t open include file'
,
`file`
return
return
if
self
.
debugging
:
if
self
.
debugging
:
print
'--> file'
,
`file`
print
'--> file'
,
`file`
save_done
=
self
.
done
save_done
=
self
.
done
save_skip
=
self
.
skip
save_skip
=
self
.
skip
save_stack
=
self
.
stack
save_stack
=
self
.
stack
self
.
includedepth
=
self
.
includedepth
+
1
self
.
includedepth
=
self
.
includedepth
+
1
self
.
parserest
(
fp
,
0
)
self
.
parserest
(
fp
,
0
)
self
.
includedepth
=
self
.
includedepth
-
1
self
.
includedepth
=
self
.
includedepth
-
1
fp
.
close
()
fp
.
close
()
self
.
done
=
save_done
self
.
done
=
save_done
self
.
skip
=
save_skip
self
.
skip
=
save_skip
self
.
stack
=
save_stack
self
.
stack
=
save_stack
if
self
.
debugging
:
if
self
.
debugging
:
print
'<-- file'
,
`file`
print
'<-- file'
,
`file`
# --- Special Insertions ---
# --- Special Insertions ---
...
@@ -561,51 +561,51 @@ class TexinfoParser:
...
@@ -561,51 +561,51 @@ class TexinfoParser:
# --- Cross References ---
# --- Cross References ---
def
open_pxref
(
self
):
def
open_pxref
(
self
):
self
.
write
(
'see '
)
self
.
write
(
'see '
)
self
.
startsaving
()
self
.
startsaving
()
def
close_pxref
(
self
):
def
close_pxref
(
self
):
self
.
makeref
()
self
.
makeref
()
def
open_xref
(
self
):
def
open_xref
(
self
):
self
.
write
(
'See '
)
self
.
write
(
'See '
)
self
.
startsaving
()
self
.
startsaving
()
def
close_xref
(
self
):
def
close_xref
(
self
):
self
.
makeref
()
self
.
makeref
()
def
open_ref
(
self
):
def
open_ref
(
self
):
self
.
startsaving
()
self
.
startsaving
()
def
close_ref
(
self
):
def
close_ref
(
self
):
self
.
makeref
()
self
.
makeref
()
def
open_inforef
(
self
):
def
open_inforef
(
self
):
self
.
write
(
'See info file '
)
self
.
write
(
'See info file '
)
self
.
startsaving
()
self
.
startsaving
()
def
close_inforef
(
self
):
def
close_inforef
(
self
):
text
=
self
.
collectsavings
()
text
=
self
.
collectsavings
()
args
=
string
.
splitfields
(
text
,
','
)
args
=
string
.
splitfields
(
text
,
','
)
n
=
len
(
args
)
n
=
len
(
args
)
for
i
in
range
(
n
):
for
i
in
range
(
n
):
args
[
i
]
=
string
.
strip
(
args
[
i
])
args
[
i
]
=
string
.
strip
(
args
[
i
])
while
len
(
args
)
<
3
:
args
.
append
(
''
)
while
len
(
args
)
<
3
:
args
.
append
(
''
)
node
=
args
[
0
]
node
=
args
[
0
]
file
=
args
[
2
]
file
=
args
[
2
]
self
.
write
(
'`'
,
file
,
'
\'
, node `'
,
node
,
'
\'
'
)
self
.
write
(
'`'
,
file
,
'
\'
, node `'
,
node
,
'
\'
'
)
def
makeref
(
self
):
def
makeref
(
self
):
text
=
self
.
collectsavings
()
text
=
self
.
collectsavings
()
args
=
string
.
splitfields
(
text
,
','
)
args
=
string
.
splitfields
(
text
,
','
)
n
=
len
(
args
)
n
=
len
(
args
)
for
i
in
range
(
n
):
for
i
in
range
(
n
):
args
[
i
]
=
string
.
strip
(
args
[
i
])
args
[
i
]
=
string
.
strip
(
args
[
i
])
while
len
(
args
)
<
5
:
args
.
append
(
''
)
while
len
(
args
)
<
5
:
args
.
append
(
''
)
nodename
=
label
=
args
[
0
]
nodename
=
label
=
args
[
0
]
if
args
[
2
]:
label
=
args
[
2
]
if
args
[
2
]:
label
=
args
[
2
]
file
=
args
[
3
]
file
=
args
[
3
]
title
=
args
[
4
]
title
=
args
[
4
]
href
=
makefile
(
nodename
)
href
=
makefile
(
nodename
)
if
file
:
if
file
:
href
=
'../'
+
file
+
'/'
+
href
href
=
'../'
+
file
+
'/'
+
href
self
.
write
(
'<A HREF="'
,
href
,
'">'
,
label
,
'</A>'
)
self
.
write
(
'<A HREF="'
,
href
,
'">'
,
label
,
'</A>'
)
# --- Marking Words and Phrases ---
# --- Marking Words and Phrases ---
...
@@ -636,22 +636,22 @@ class TexinfoParser:
...
@@ -636,22 +636,22 @@ class TexinfoParser:
def
close_i
(
self
):
self
.
write
(
'</I>'
)
def
close_i
(
self
):
self
.
write
(
'</I>'
)
def
open_footnote
(
self
):
def
open_footnote
(
self
):
# if self.savetext <> None:
# if self.savetext <> None:
#
print '*** Recursive footnote -- expect weirdness'
#
print '*** Recursive footnote -- expect weirdness'
id
=
len
(
self
.
footnotes
)
+
1
id
=
len
(
self
.
footnotes
)
+
1
self
.
write
(
self
.
FN_SOURCE_PATTERN
%
{
'id'
:
`id`
})
self
.
write
(
self
.
FN_SOURCE_PATTERN
%
{
'id'
:
`id`
})
self
.
startsaving
()
self
.
startsaving
()
def
close_footnote
(
self
):
def
close_footnote
(
self
):
id
=
len
(
self
.
footnotes
)
+
1
id
=
len
(
self
.
footnotes
)
+
1
self
.
footnotes
.
append
(
id
,
self
.
collectsavings
())
self
.
footnotes
.
append
(
id
,
self
.
collectsavings
())
def
writefootnotes
(
self
):
def
writefootnotes
(
self
):
self
.
write
(
self
.
FN_HEADER
)
self
.
write
(
self
.
FN_HEADER
)
for
id
,
text
in
self
.
footnotes
:
for
id
,
text
in
self
.
footnotes
:
self
.
write
(
self
.
FN_TARGET_PATTERN
self
.
write
(
self
.
FN_TARGET_PATTERN
%
{
'id'
:
`id`
,
'text'
:
text
})
%
{
'id'
:
`id`
,
'text'
:
text
})
self
.
footnotes
=
[]
self
.
footnotes
=
[]
def
open_file
(
self
):
self
.
write
(
'<CODE>'
)
def
open_file
(
self
):
self
.
write
(
'<CODE>'
)
def
close_file
(
self
):
self
.
write
(
'</CODE>'
)
def
close_file
(
self
):
self
.
write
(
'</CODE>'
)
...
@@ -701,57 +701,57 @@ class TexinfoParser:
...
@@ -701,57 +701,57 @@ class TexinfoParser:
def
command
(
self
,
line
,
mo
):
def
command
(
self
,
line
,
mo
):
a
,
b
=
mo
.
span
(
1
)
a
,
b
=
mo
.
span
(
1
)
cmd
=
line
[
a
:
b
]
cmd
=
line
[
a
:
b
]
args
=
string
.
strip
(
line
[
b
:])
args
=
string
.
strip
(
line
[
b
:])
if
self
.
debugging
>
1
:
if
self
.
debugging
>
1
:
print
self
.
skip
,
self
.
stack
,
'@'
+
cmd
,
args
print
self
.
skip
,
self
.
stack
,
'@'
+
cmd
,
args
try
:
try
:
func
=
getattr
(
self
,
'do_'
+
cmd
)
func
=
getattr
(
self
,
'do_'
+
cmd
)
except
AttributeError
:
except
AttributeError
:
try
:
try
:
func
=
getattr
(
self
,
'bgn_'
+
cmd
)
func
=
getattr
(
self
,
'bgn_'
+
cmd
)
except
AttributeError
:
except
AttributeError
:
# don't complain if we are skipping anyway
# don't complain if we are skipping anyway
if
not
self
.
skip
:
if
not
self
.
skip
:
self
.
unknown_cmd
(
cmd
,
args
)
self
.
unknown_cmd
(
cmd
,
args
)
return
return
self
.
stack
.
append
(
cmd
)
self
.
stack
.
append
(
cmd
)
func
(
args
)
func
(
args
)
return
return
if
not
self
.
skip
or
cmd
==
'end'
:
if
not
self
.
skip
or
cmd
==
'end'
:
func
(
args
)
func
(
args
)
def
unknown_cmd
(
self
,
cmd
,
args
):
def
unknown_cmd
(
self
,
cmd
,
args
):
print
'*** unknown'
,
'@'
+
cmd
,
args
print
'*** unknown'
,
'@'
+
cmd
,
args
if
not
self
.
unknown
.
has_key
(
cmd
):
if
not
self
.
unknown
.
has_key
(
cmd
):
self
.
unknown
[
cmd
]
=
1
self
.
unknown
[
cmd
]
=
1
else
:
else
:
self
.
unknown
[
cmd
]
=
self
.
unknown
[
cmd
]
+
1
self
.
unknown
[
cmd
]
=
self
.
unknown
[
cmd
]
+
1
def
do_end
(
self
,
args
):
def
do_end
(
self
,
args
):
words
=
string
.
split
(
args
)
words
=
string
.
split
(
args
)
if
not
words
:
if
not
words
:
print
'*** @end w/o args'
print
'*** @end w/o args'
else
:
else
:
cmd
=
words
[
0
]
cmd
=
words
[
0
]
if
not
self
.
stack
or
self
.
stack
[
-
1
]
<>
cmd
:
if
not
self
.
stack
or
self
.
stack
[
-
1
]
<>
cmd
:
print
'*** @end'
,
cmd
,
'unexpected'
print
'*** @end'
,
cmd
,
'unexpected'
else
:
else
:
del
self
.
stack
[
-
1
]
del
self
.
stack
[
-
1
]
try
:
try
:
func
=
getattr
(
self
,
'end_'
+
cmd
)
func
=
getattr
(
self
,
'end_'
+
cmd
)
except
AttributeError
:
except
AttributeError
:
self
.
unknown_end
(
cmd
)
self
.
unknown_end
(
cmd
)
return
return
func
()
func
()
def
unknown_end
(
self
,
cmd
):
def
unknown_end
(
self
,
cmd
):
cmd
=
'end '
+
cmd
cmd
=
'end '
+
cmd
print
'*** unknown'
,
'@'
+
cmd
print
'*** unknown'
,
'@'
+
cmd
if
not
self
.
unknown
.
has_key
(
cmd
):
if
not
self
.
unknown
.
has_key
(
cmd
):
self
.
unknown
[
cmd
]
=
1
self
.
unknown
[
cmd
]
=
1
else
:
else
:
self
.
unknown
[
cmd
]
=
self
.
unknown
[
cmd
]
+
1
self
.
unknown
[
cmd
]
=
self
.
unknown
[
cmd
]
+
1
# --- Comments ---
# --- Comments ---
...
@@ -773,51 +773,51 @@ class TexinfoParser:
...
@@ -773,51 +773,51 @@ class TexinfoParser:
def
end_tex
(
self
):
self
.
skip
=
self
.
skip
-
1
def
end_tex
(
self
):
self
.
skip
=
self
.
skip
-
1
def
do_set
(
self
,
args
):
def
do_set
(
self
,
args
):
fields
=
string
.
splitfields
(
args
,
' '
)
fields
=
string
.
splitfields
(
args
,
' '
)
key
=
fields
[
0
]
key
=
fields
[
0
]
if
len
(
fields
)
==
1
:
if
len
(
fields
)
==
1
:
value
=
1
value
=
1
else
:
else
:
value
=
string
.
joinfields
(
fields
[
1
:],
' '
)
value
=
string
.
joinfields
(
fields
[
1
:],
' '
)
self
.
values
[
key
]
=
value
self
.
values
[
key
]
=
value
print
self
.
values
print
self
.
values
def
do_clear
(
self
,
args
):
def
do_clear
(
self
,
args
):
self
.
values
[
args
]
=
None
self
.
values
[
args
]
=
None
def
bgn_ifset
(
self
,
args
):
def
bgn_ifset
(
self
,
args
):
if
args
not
in
self
.
values
.
keys
()
\
if
args
not
in
self
.
values
.
keys
()
\
or
self
.
values
[
args
]
is
None
:
or
self
.
values
[
args
]
is
None
:
self
.
skip
=
self
.
skip
+
1
self
.
skip
=
self
.
skip
+
1
self
.
stackinfo
[
len
(
self
.
stack
)]
=
1
self
.
stackinfo
[
len
(
self
.
stack
)]
=
1
else
:
else
:
self
.
stackinfo
[
len
(
self
.
stack
)]
=
0
self
.
stackinfo
[
len
(
self
.
stack
)]
=
0
def
end_ifset
(
self
):
def
end_ifset
(
self
):
print
self
.
stack
print
self
.
stack
print
self
.
stackinfo
print
self
.
stackinfo
if
self
.
stackinfo
[
len
(
self
.
stack
)
+
1
]:
if
self
.
stackinfo
[
len
(
self
.
stack
)
+
1
]:
self
.
skip
=
self
.
skip
-
1
self
.
skip
=
self
.
skip
-
1
del
self
.
stackinfo
[
len
(
self
.
stack
)
+
1
]
del
self
.
stackinfo
[
len
(
self
.
stack
)
+
1
]
def
bgn_ifclear
(
self
,
args
):
def
bgn_ifclear
(
self
,
args
):
if
args
in
self
.
values
.
keys
()
\
if
args
in
self
.
values
.
keys
()
\
and
self
.
values
[
args
]
is
not
None
:
and
self
.
values
[
args
]
is
not
None
:
self
.
skip
=
self
.
skip
+
1
self
.
skip
=
self
.
skip
+
1
self
.
stackinfo
[
len
(
self
.
stack
)]
=
1
self
.
stackinfo
[
len
(
self
.
stack
)]
=
1
else
:
else
:
self
.
stackinfo
[
len
(
self
.
stack
)]
=
0
self
.
stackinfo
[
len
(
self
.
stack
)]
=
0
end_ifclear
=
end_ifset
end_ifclear
=
end_ifset
def
open_value
(
self
):
def
open_value
(
self
):
self
.
startsaving
()
self
.
startsaving
()
def
close_value
(
self
):
def
close_value
(
self
):
key
=
self
.
collectsavings
()
key
=
self
.
collectsavings
()
if
key
in
self
.
values
.
keys
():
if
key
in
self
.
values
.
keys
():
self
.
write
(
self
.
values
[
key
])
self
.
write
(
self
.
values
[
key
])
else
:
else
:
print
'*** Undefined value: '
,
key
print
'*** Undefined value: '
,
key
# --- Beginning a file ---
# --- Beginning a file ---
...
@@ -826,18 +826,18 @@ class TexinfoParser:
...
@@ -826,18 +826,18 @@ class TexinfoParser:
do_setfilename
=
do_comment
do_setfilename
=
do_comment
def
do_settitle
(
self
,
args
):
def
do_settitle
(
self
,
args
):
print
args
print
args
self
.
startsaving
()
self
.
startsaving
()
self
.
expand
(
args
)
self
.
expand
(
args
)
self
.
title
=
self
.
collectsavings
()
self
.
title
=
self
.
collectsavings
()
print
self
.
title
print
self
.
title
def
do_parskip
(
self
,
args
):
pass
def
do_parskip
(
self
,
args
):
pass
# --- Ending a file ---
# --- Ending a file ---
def
do_bye
(
self
,
args
):
def
do_bye
(
self
,
args
):
self
.
endnode
()
self
.
endnode
()
self
.
done
=
1
self
.
done
=
1
# --- Title page ---
# --- Title page ---
...
@@ -846,10 +846,10 @@ class TexinfoParser:
...
@@ -846,10 +846,10 @@ class TexinfoParser:
def
do_shorttitlepage
(
self
,
args
):
pass
def
do_shorttitlepage
(
self
,
args
):
pass
def
do_center
(
self
,
args
):
def
do_center
(
self
,
args
):
# Actually not used outside title page...
# Actually not used outside title page...
self
.
write
(
'<H1>'
)
self
.
write
(
'<H1>'
)
self
.
expand
(
args
)
self
.
expand
(
args
)
self
.
write
(
'</H1>
\n
'
)
self
.
write
(
'</H1>
\n
'
)
do_title
=
do_center
do_title
=
do_center
do_subtitle
=
do_center
do_subtitle
=
do_center
do_author
=
do_center
do_author
=
do_center
...
@@ -873,163 +873,163 @@ class TexinfoParser:
...
@@ -873,163 +873,163 @@ class TexinfoParser:
# --- Nodes ---
# --- Nodes ---
def
do_node
(
self
,
args
):
def
do_node
(
self
,
args
):
self
.
endnode
()
self
.
endnode
()
self
.
nodelineno
=
0
self
.
nodelineno
=
0
parts
=
string
.
splitfields
(
args
,
','
)
parts
=
string
.
splitfields
(
args
,
','
)
while
len
(
parts
)
<
4
:
parts
.
append
(
''
)
while
len
(
parts
)
<
4
:
parts
.
append
(
''
)
for
i
in
range
(
4
):
parts
[
i
]
=
string
.
strip
(
parts
[
i
])
for
i
in
range
(
4
):
parts
[
i
]
=
string
.
strip
(
parts
[
i
])
self
.
nodelinks
=
parts
self
.
nodelinks
=
parts
[
name
,
next
,
prev
,
up
]
=
parts
[:
4
]
[
name
,
next
,
prev
,
up
]
=
parts
[:
4
]
file
=
self
.
dirname
+
'/'
+
makefile
(
name
)
file
=
self
.
dirname
+
'/'
+
makefile
(
name
)
if
self
.
filenames
.
has_key
(
file
):
if
self
.
filenames
.
has_key
(
file
):
print
'*** Filename already in use: '
,
file
print
'*** Filename already in use: '
,
file
else
:
else
:
if
self
.
debugging
:
print
'--- writing'
,
file
if
self
.
debugging
:
print
'--- writing'
,
file
self
.
filenames
[
file
]
=
1
self
.
filenames
[
file
]
=
1
# self.nodefp = open(file, 'w')
# self.nodefp = open(file, 'w')
self
.
nodename
=
name
self
.
nodename
=
name
if
self
.
cont
and
self
.
nodestack
:
if
self
.
cont
and
self
.
nodestack
:
self
.
nodestack
[
-
1
]
.
cont
=
self
.
nodename
self
.
nodestack
[
-
1
]
.
cont
=
self
.
nodename
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
self
.
node
=
self
.
Node
(
self
.
dirname
,
self
.
nodename
,
self
.
topname
,
self
.
node
=
self
.
Node
(
self
.
dirname
,
self
.
nodename
,
self
.
topname
,
title
,
next
,
prev
,
up
)
title
,
next
,
prev
,
up
)
def
link
(
self
,
label
,
nodename
):
def
link
(
self
,
label
,
nodename
):
if
nodename
:
if
nodename
:
if
string
.
lower
(
nodename
)
==
'(dir)'
:
if
string
.
lower
(
nodename
)
==
'(dir)'
:
addr
=
'../dir.html'
addr
=
'../dir.html'
else
:
else
:
addr
=
makefile
(
nodename
)
addr
=
makefile
(
nodename
)
self
.
write
(
label
,
': <A HREF="'
,
addr
,
'" TYPE="'
,
self
.
write
(
label
,
': <A HREF="'
,
addr
,
'" TYPE="'
,
label
,
'">'
,
nodename
,
'</A>
\n
'
)
label
,
'">'
,
nodename
,
'</A>
\n
'
)
# --- Sectioning commands ---
# --- Sectioning commands ---
def
popstack
(
self
,
type
):
def
popstack
(
self
,
type
):
if
(
self
.
node
):
if
(
self
.
node
):
self
.
node
.
type
=
type
self
.
node
.
type
=
type
while
self
.
nodestack
:
while
self
.
nodestack
:
if
self
.
nodestack
[
-
1
]
.
type
>
type
:
if
self
.
nodestack
[
-
1
]
.
type
>
type
:
self
.
nodestack
[
-
1
]
.
finalize
()
self
.
nodestack
[
-
1
]
.
finalize
()
self
.
nodestack
[
-
1
]
.
flush
()
self
.
nodestack
[
-
1
]
.
flush
()
del
self
.
nodestack
[
-
1
]
del
self
.
nodestack
[
-
1
]
elif
self
.
nodestack
[
-
1
]
.
type
==
type
:
elif
self
.
nodestack
[
-
1
]
.
type
==
type
:
if
not
self
.
nodestack
[
-
1
]
.
next
:
if
not
self
.
nodestack
[
-
1
]
.
next
:
self
.
nodestack
[
-
1
]
.
next
=
self
.
node
.
name
self
.
nodestack
[
-
1
]
.
next
=
self
.
node
.
name
if
not
self
.
node
.
prev
:
if
not
self
.
node
.
prev
:
self
.
node
.
prev
=
self
.
nodestack
[
-
1
]
.
name
self
.
node
.
prev
=
self
.
nodestack
[
-
1
]
.
name
self
.
nodestack
[
-
1
]
.
finalize
()
self
.
nodestack
[
-
1
]
.
finalize
()
self
.
nodestack
[
-
1
]
.
flush
()
self
.
nodestack
[
-
1
]
.
flush
()
del
self
.
nodestack
[
-
1
]
del
self
.
nodestack
[
-
1
]
else
:
else
:
if
type
>
1
and
not
self
.
node
.
up
:
if
type
>
1
and
not
self
.
node
.
up
:
self
.
node
.
up
=
self
.
nodestack
[
-
1
]
.
name
self
.
node
.
up
=
self
.
nodestack
[
-
1
]
.
name
break
break
def
do_chapter
(
self
,
args
):
def
do_chapter
(
self
,
args
):
self
.
heading
(
'H1'
,
args
,
0
)
self
.
heading
(
'H1'
,
args
,
0
)
self
.
popstack
(
1
)
self
.
popstack
(
1
)
def
do_unnumbered
(
self
,
args
):
def
do_unnumbered
(
self
,
args
):
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
popstack
(
1
)
self
.
popstack
(
1
)
def
do_appendix
(
self
,
args
):
def
do_appendix
(
self
,
args
):
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
popstack
(
1
)
self
.
popstack
(
1
)
def
do_top
(
self
,
args
):
def
do_top
(
self
,
args
):
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
heading
(
'H1'
,
args
,
-
1
)
def
do_chapheading
(
self
,
args
):
def
do_chapheading
(
self
,
args
):
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
heading
(
'H1'
,
args
,
-
1
)
def
do_majorheading
(
self
,
args
):
def
do_majorheading
(
self
,
args
):
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
heading
(
'H1'
,
args
,
-
1
)
def
do_section
(
self
,
args
):
def
do_section
(
self
,
args
):
self
.
heading
(
'H1'
,
args
,
1
)
self
.
heading
(
'H1'
,
args
,
1
)
self
.
popstack
(
2
)
self
.
popstack
(
2
)
def
do_unnumberedsec
(
self
,
args
):
def
do_unnumberedsec
(
self
,
args
):
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
popstack
(
2
)
self
.
popstack
(
2
)
def
do_appendixsec
(
self
,
args
):
def
do_appendixsec
(
self
,
args
):
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
popstack
(
2
)
self
.
popstack
(
2
)
do_appendixsection
=
do_appendixsec
do_appendixsection
=
do_appendixsec
def
do_heading
(
self
,
args
):
def
do_heading
(
self
,
args
):
self
.
heading
(
'H1'
,
args
,
-
1
)
self
.
heading
(
'H1'
,
args
,
-
1
)
def
do_subsection
(
self
,
args
):
def
do_subsection
(
self
,
args
):
self
.
heading
(
'H2'
,
args
,
2
)
self
.
heading
(
'H2'
,
args
,
2
)
self
.
popstack
(
3
)
self
.
popstack
(
3
)
def
do_unnumberedsubsec
(
self
,
args
):
def
do_unnumberedsubsec
(
self
,
args
):
self
.
heading
(
'H2'
,
args
,
-
1
)
self
.
heading
(
'H2'
,
args
,
-
1
)
self
.
popstack
(
3
)
self
.
popstack
(
3
)
def
do_appendixsubsec
(
self
,
args
):
def
do_appendixsubsec
(
self
,
args
):
self
.
heading
(
'H2'
,
args
,
-
1
)
self
.
heading
(
'H2'
,
args
,
-
1
)
self
.
popstack
(
3
)
self
.
popstack
(
3
)
def
do_subheading
(
self
,
args
):
def
do_subheading
(
self
,
args
):
self
.
heading
(
'H2'
,
args
,
-
1
)
self
.
heading
(
'H2'
,
args
,
-
1
)
def
do_subsubsection
(
self
,
args
):
def
do_subsubsection
(
self
,
args
):
self
.
heading
(
'H3'
,
args
,
3
)
self
.
heading
(
'H3'
,
args
,
3
)
self
.
popstack
(
4
)
self
.
popstack
(
4
)
def
do_unnumberedsubsubsec
(
self
,
args
):
def
do_unnumberedsubsubsec
(
self
,
args
):
self
.
heading
(
'H3'
,
args
,
-
1
)
self
.
heading
(
'H3'
,
args
,
-
1
)
self
.
popstack
(
4
)
self
.
popstack
(
4
)
def
do_appendixsubsubsec
(
self
,
args
):
def
do_appendixsubsubsec
(
self
,
args
):
self
.
heading
(
'H3'
,
args
,
-
1
)
self
.
heading
(
'H3'
,
args
,
-
1
)
self
.
popstack
(
4
)
self
.
popstack
(
4
)
def
do_subsubheading
(
self
,
args
):
def
do_subsubheading
(
self
,
args
):
self
.
heading
(
'H3'
,
args
,
-
1
)
self
.
heading
(
'H3'
,
args
,
-
1
)
def
heading
(
self
,
type
,
args
,
level
):
def
heading
(
self
,
type
,
args
,
level
):
if
level
>=
0
:
if
level
>=
0
:
while
len
(
self
.
numbering
)
<=
level
:
while
len
(
self
.
numbering
)
<=
level
:
self
.
numbering
.
append
(
0
)
self
.
numbering
.
append
(
0
)
del
self
.
numbering
[
level
+
1
:]
del
self
.
numbering
[
level
+
1
:]
self
.
numbering
[
level
]
=
self
.
numbering
[
level
]
+
1
self
.
numbering
[
level
]
=
self
.
numbering
[
level
]
+
1
x
=
''
x
=
''
for
i
in
self
.
numbering
:
for
i
in
self
.
numbering
:
x
=
x
+
`i`
+
'.'
x
=
x
+
`i`
+
'.'
args
=
x
+
' '
+
args
args
=
x
+
' '
+
args
self
.
contents
.
append
(
level
,
args
,
self
.
nodename
)
self
.
contents
.
append
(
level
,
args
,
self
.
nodename
)
self
.
write
(
'<'
,
type
,
'>'
)
self
.
write
(
'<'
,
type
,
'>'
)
self
.
expand
(
args
)
self
.
expand
(
args
)
self
.
write
(
'</'
,
type
,
'>
\n
'
)
self
.
write
(
'</'
,
type
,
'>
\n
'
)
if
self
.
debugging
or
self
.
print_headers
:
if
self
.
debugging
or
self
.
print_headers
:
print
'---'
,
args
print
'---'
,
args
def
do_contents
(
self
,
args
):
def
do_contents
(
self
,
args
):
# pass
# pass
self
.
listcontents
(
'Table of Contents'
,
999
)
self
.
listcontents
(
'Table of Contents'
,
999
)
def
do_shortcontents
(
self
,
args
):
def
do_shortcontents
(
self
,
args
):
pass
pass
# self.listcontents('Short Contents', 0)
# self.listcontents('Short Contents', 0)
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 PLAIN>
\n
'
)
self
.
write
(
'<H1>'
,
title
,
'</H1>
\n
<UL COMPACT PLAIN>
\n
'
)
prevlevels
=
[
0
]
prevlevels
=
[
0
]
for
level
,
title
,
node
in
self
.
contents
:
for
level
,
title
,
node
in
self
.
contents
:
if
level
>
maxlevel
:
if
level
>
maxlevel
:
continue
continue
if
level
>
prevlevels
[
-
1
]:
if
level
>
prevlevels
[
-
1
]:
# can only advance one level at a time
# can only advance one level at a time
self
.
write
(
' '
*
prevlevels
[
-
1
],
'<UL PLAIN>
\n
'
)
self
.
write
(
' '
*
prevlevels
[
-
1
],
'<UL PLAIN>
\n
'
)
prevlevels
.
append
(
level
)
prevlevels
.
append
(
level
)
elif
level
<
prevlevels
[
-
1
]:
elif
level
<
prevlevels
[
-
1
]:
# might drop back multiple levels
# might drop back multiple levels
while
level
<
prevlevels
[
-
1
]:
while
level
<
prevlevels
[
-
1
]:
del
prevlevels
[
-
1
]
del
prevlevels
[
-
1
]
self
.
write
(
' '
*
prevlevels
[
-
1
],
self
.
write
(
' '
*
prevlevels
[
-
1
],
'</UL>
\n
'
)
'</UL>
\n
'
)
self
.
write
(
' '
*
level
,
'<LI> <A HREF="'
,
self
.
write
(
' '
*
level
,
'<LI> <A HREF="'
,
makefile
(
node
),
'">'
)
makefile
(
node
),
'">'
)
self
.
expand
(
title
)
self
.
expand
(
title
)
self
.
write
(
'</A>
\n
'
)
self
.
write
(
'</A>
\n
'
)
self
.
write
(
'</UL>
\n
'
*
len
(
prevlevels
))
self
.
write
(
'</UL>
\n
'
*
len
(
prevlevels
))
# --- Page lay-out ---
# --- Page lay-out ---
...
@@ -1045,32 +1045,32 @@ class TexinfoParser:
...
@@ -1045,32 +1045,32 @@ class TexinfoParser:
# --- Line lay-out ---
# --- Line lay-out ---
def
do_sp
(
self
,
args
):
def
do_sp
(
self
,
args
):
if
self
.
nofill
:
if
self
.
nofill
:
self
.
write
(
'
\n
'
)
self
.
write
(
'
\n
'
)
else
:
else
:
self
.
write
(
'<P>
\n
'
)
self
.
write
(
'<P>
\n
'
)
def
do_hline
(
self
,
args
):
def
do_hline
(
self
,
args
):
self
.
write
(
'<HR>'
)
self
.
write
(
'<HR>'
)
# --- Function and variable definitions ---
# --- Function and variable definitions ---
def
bgn_deffn
(
self
,
args
):
def
bgn_deffn
(
self
,
args
):
self
.
write
(
'<DL>'
)
self
.
write
(
'<DL>'
)
self
.
do_deffnx
(
args
)
self
.
do_deffnx
(
args
)
def
end_deffn
(
self
):
def
end_deffn
(
self
):
self
.
write
(
'</DL>
\n
'
)
self
.
write
(
'</DL>
\n
'
)
def
do_deffnx
(
self
,
args
):
def
do_deffnx
(
self
,
args
):
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
words
=
splitwords
(
args
,
2
)
words
=
splitwords
(
args
,
2
)
[
category
,
name
],
rest
=
words
[:
2
],
words
[
2
:]
[
category
,
name
],
rest
=
words
[:
2
],
words
[
2
:]
self
.
expand
(
'@b{
%
s}'
%
name
)
self
.
expand
(
'@b{
%
s}'
%
name
)
for
word
in
rest
:
self
.
expand
(
' '
+
makevar
(
word
))
for
word
in
rest
:
self
.
expand
(
' '
+
makevar
(
word
))
#self.expand(' -- ' + category)
#self.expand(' -- ' + category)
self
.
write
(
'
\n
<DD>'
)
self
.
write
(
'
\n
<DD>'
)
self
.
index
(
'fn'
,
name
)
self
.
index
(
'fn'
,
name
)
def
bgn_defun
(
self
,
args
):
self
.
bgn_deffn
(
'Function '
+
args
)
def
bgn_defun
(
self
,
args
):
self
.
bgn_deffn
(
'Function '
+
args
)
end_defun
=
end_deffn
end_defun
=
end_deffn
...
@@ -1085,21 +1085,21 @@ class TexinfoParser:
...
@@ -1085,21 +1085,21 @@ class TexinfoParser:
def
do_defspecx
(
self
,
args
):
self
.
do_deffnx
(
'{Special Form} '
+
args
)
def
do_defspecx
(
self
,
args
):
self
.
do_deffnx
(
'{Special Form} '
+
args
)
def
bgn_defvr
(
self
,
args
):
def
bgn_defvr
(
self
,
args
):
self
.
write
(
'<DL>'
)
self
.
write
(
'<DL>'
)
self
.
do_defvrx
(
args
)
self
.
do_defvrx
(
args
)
end_defvr
=
end_deffn
end_defvr
=
end_deffn
def
do_defvrx
(
self
,
args
):
def
do_defvrx
(
self
,
args
):
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
words
=
splitwords
(
args
,
2
)
words
=
splitwords
(
args
,
2
)
[
category
,
name
],
rest
=
words
[:
2
],
words
[
2
:]
[
category
,
name
],
rest
=
words
[:
2
],
words
[
2
:]
self
.
expand
(
'@code{
%
s}'
%
name
)
self
.
expand
(
'@code{
%
s}'
%
name
)
# If there are too many arguments, show them
# If there are too many arguments, show them
for
word
in
rest
:
self
.
expand
(
' '
+
word
)
for
word
in
rest
:
self
.
expand
(
' '
+
word
)
#self.expand(' -- ' + category)
#self.expand(' -- ' + category)
self
.
write
(
'
\n
<DD>'
)
self
.
write
(
'
\n
<DD>'
)
self
.
index
(
'vr'
,
name
)
self
.
index
(
'vr'
,
name
)
def
bgn_defvar
(
self
,
args
):
self
.
bgn_defvr
(
'Variable '
+
args
)
def
bgn_defvar
(
self
,
args
):
self
.
bgn_defvr
(
'Variable '
+
args
)
end_defvar
=
end_defvr
end_defvar
=
end_defvr
...
@@ -1112,20 +1112,20 @@ class TexinfoParser:
...
@@ -1112,20 +1112,20 @@ class TexinfoParser:
# --- Ditto for typed languages ---
# --- Ditto for typed languages ---
def
bgn_deftypefn
(
self
,
args
):
def
bgn_deftypefn
(
self
,
args
):
self
.
write
(
'<DL>'
)
self
.
write
(
'<DL>'
)
self
.
do_deftypefnx
(
args
)
self
.
do_deftypefnx
(
args
)
end_deftypefn
=
end_deffn
end_deftypefn
=
end_deffn
def
do_deftypefnx
(
self
,
args
):
def
do_deftypefnx
(
self
,
args
):
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
words
=
splitwords
(
args
,
3
)
words
=
splitwords
(
args
,
3
)
[
category
,
datatype
,
name
],
rest
=
words
[:
3
],
words
[
3
:]
[
category
,
datatype
,
name
],
rest
=
words
[:
3
],
words
[
3
:]
self
.
expand
(
'@code{
%
s} @b{
%
s}'
%
(
datatype
,
name
))
self
.
expand
(
'@code{
%
s} @b{
%
s}'
%
(
datatype
,
name
))
for
word
in
rest
:
self
.
expand
(
' '
+
makevar
(
word
))
for
word
in
rest
:
self
.
expand
(
' '
+
makevar
(
word
))
#self.expand(' -- ' + category)
#self.expand(' -- ' + category)
self
.
write
(
'
\n
<DD>'
)
self
.
write
(
'
\n
<DD>'
)
self
.
index
(
'fn'
,
name
)
self
.
index
(
'fn'
,
name
)
def
bgn_deftypefun
(
self
,
args
):
self
.
bgn_deftypefn
(
'Function '
+
args
)
def
bgn_deftypefun
(
self
,
args
):
self
.
bgn_deftypefn
(
'Function '
+
args
)
...
@@ -1133,149 +1133,149 @@ class TexinfoParser:
...
@@ -1133,149 +1133,149 @@ class TexinfoParser:
def
do_deftypefunx
(
self
,
args
):
self
.
do_deftypefnx
(
'Function '
+
args
)
def
do_deftypefunx
(
self
,
args
):
self
.
do_deftypefnx
(
'Function '
+
args
)
def
bgn_deftypevr
(
self
,
args
):
def
bgn_deftypevr
(
self
,
args
):
self
.
write
(
'<DL>'
)
self
.
write
(
'<DL>'
)
self
.
do_deftypevrx
(
args
)
self
.
do_deftypevrx
(
args
)
end_deftypevr
=
end_deftypefn
end_deftypevr
=
end_deftypefn
def
do_deftypevrx
(
self
,
args
):
def
do_deftypevrx
(
self
,
args
):
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
words
=
splitwords
(
args
,
3
)
words
=
splitwords
(
args
,
3
)
[
category
,
datatype
,
name
],
rest
=
words
[:
3
],
words
[
3
:]
[
category
,
datatype
,
name
],
rest
=
words
[:
3
],
words
[
3
:]
self
.
expand
(
'@code{
%
s} @b{
%
s}'
%
(
datatype
,
name
))
self
.
expand
(
'@code{
%
s} @b{
%
s}'
%
(
datatype
,
name
))
# If there are too many arguments, show them
# If there are too many arguments, show them
for
word
in
rest
:
self
.
expand
(
' '
+
word
)
for
word
in
rest
:
self
.
expand
(
' '
+
word
)
#self.expand(' -- ' + category)
#self.expand(' -- ' + category)
self
.
write
(
'
\n
<DD>'
)
self
.
write
(
'
\n
<DD>'
)
self
.
index
(
'fn'
,
name
)
self
.
index
(
'fn'
,
name
)
def
bgn_deftypevar
(
self
,
args
):
def
bgn_deftypevar
(
self
,
args
):
self
.
bgn_deftypevr
(
'Variable '
+
args
)
self
.
bgn_deftypevr
(
'Variable '
+
args
)
end_deftypevar
=
end_deftypevr
end_deftypevar
=
end_deftypevr
def
do_deftypevarx
(
self
,
args
):
def
do_deftypevarx
(
self
,
args
):
self
.
do_deftypevrx
(
'Variable '
+
args
)
self
.
do_deftypevrx
(
'Variable '
+
args
)
# --- Ditto for object-oriented languages ---
# --- Ditto for object-oriented languages ---
def
bgn_defcv
(
self
,
args
):
def
bgn_defcv
(
self
,
args
):
self
.
write
(
'<DL>'
)
self
.
write
(
'<DL>'
)
self
.
do_defcvx
(
args
)
self
.
do_defcvx
(
args
)
end_defcv
=
end_deftypevr
end_defcv
=
end_deftypevr
def
do_defcvx
(
self
,
args
):
def
do_defcvx
(
self
,
args
):
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
words
=
splitwords
(
args
,
3
)
words
=
splitwords
(
args
,
3
)
[
category
,
classname
,
name
],
rest
=
words
[:
3
],
words
[
3
:]
[
category
,
classname
,
name
],
rest
=
words
[:
3
],
words
[
3
:]
self
.
expand
(
'@b{
%
s}'
%
name
)
self
.
expand
(
'@b{
%
s}'
%
name
)
# If there are too many arguments, show them
# If there are too many arguments, show them
for
word
in
rest
:
self
.
expand
(
' '
+
word
)
for
word
in
rest
:
self
.
expand
(
' '
+
word
)
#self.expand(' -- %s of @code{%s}' % (category, classname))
#self.expand(' -- %s of @code{%s}' % (category, classname))
self
.
write
(
'
\n
<DD>'
)
self
.
write
(
'
\n
<DD>'
)
self
.
index
(
'vr'
,
'
%
s @r{on
%
s}'
%
(
name
,
classname
))
self
.
index
(
'vr'
,
'
%
s @r{on
%
s}'
%
(
name
,
classname
))
def
bgn_defivar
(
self
,
args
):
def
bgn_defivar
(
self
,
args
):
self
.
bgn_defcv
(
'{Instance Variable} '
+
args
)
self
.
bgn_defcv
(
'{Instance Variable} '
+
args
)
end_defivar
=
end_defcv
end_defivar
=
end_defcv
def
do_defivarx
(
self
,
args
):
def
do_defivarx
(
self
,
args
):
self
.
do_defcvx
(
'{Instance Variable} '
+
args
)
self
.
do_defcvx
(
'{Instance Variable} '
+
args
)
def
bgn_defop
(
self
,
args
):
def
bgn_defop
(
self
,
args
):
self
.
write
(
'<DL>'
)
self
.
write
(
'<DL>'
)
self
.
do_defopx
(
args
)
self
.
do_defopx
(
args
)
end_defop
=
end_defcv
end_defop
=
end_defcv
def
do_defopx
(
self
,
args
):
def
do_defopx
(
self
,
args
):
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
words
=
splitwords
(
args
,
3
)
words
=
splitwords
(
args
,
3
)
[
category
,
classname
,
name
],
rest
=
words
[:
3
],
words
[
3
:]
[
category
,
classname
,
name
],
rest
=
words
[:
3
],
words
[
3
:]
self
.
expand
(
'@b{
%
s}'
%
name
)
self
.
expand
(
'@b{
%
s}'
%
name
)
for
word
in
rest
:
self
.
expand
(
' '
+
makevar
(
word
))
for
word
in
rest
:
self
.
expand
(
' '
+
makevar
(
word
))
#self.expand(' -- %s of @code{%s}' % (category, classname))
#self.expand(' -- %s of @code{%s}' % (category, classname))
self
.
write
(
'
\n
<DD>'
)
self
.
write
(
'
\n
<DD>'
)
self
.
index
(
'fn'
,
'
%
s @r{on
%
s}'
%
(
name
,
classname
))
self
.
index
(
'fn'
,
'
%
s @r{on
%
s}'
%
(
name
,
classname
))
def
bgn_defmethod
(
self
,
args
):
def
bgn_defmethod
(
self
,
args
):
self
.
bgn_defop
(
'Method '
+
args
)
self
.
bgn_defop
(
'Method '
+
args
)
end_defmethod
=
end_defop
end_defmethod
=
end_defop
def
do_defmethodx
(
self
,
args
):
def
do_defmethodx
(
self
,
args
):
self
.
do_defopx
(
'Method '
+
args
)
self
.
do_defopx
(
'Method '
+
args
)
# --- Ditto for data types ---
# --- Ditto for data types ---
def
bgn_deftp
(
self
,
args
):
def
bgn_deftp
(
self
,
args
):
self
.
write
(
'<DL>'
)
self
.
write
(
'<DL>'
)
self
.
do_deftpx
(
args
)
self
.
do_deftpx
(
args
)
end_deftp
=
end_defcv
end_deftp
=
end_defcv
def
do_deftpx
(
self
,
args
):
def
do_deftpx
(
self
,
args
):
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
words
=
splitwords
(
args
,
2
)
words
=
splitwords
(
args
,
2
)
[
category
,
name
],
rest
=
words
[:
2
],
words
[
2
:]
[
category
,
name
],
rest
=
words
[:
2
],
words
[
2
:]
self
.
expand
(
'@b{
%
s}'
%
name
)
self
.
expand
(
'@b{
%
s}'
%
name
)
for
word
in
rest
:
self
.
expand
(
' '
+
word
)
for
word
in
rest
:
self
.
expand
(
' '
+
word
)
#self.expand(' -- ' + category)
#self.expand(' -- ' + category)
self
.
write
(
'
\n
<DD>'
)
self
.
write
(
'
\n
<DD>'
)
self
.
index
(
'tp'
,
name
)
self
.
index
(
'tp'
,
name
)
# --- Making Lists and Tables
# --- Making Lists and Tables
def
bgn_enumerate
(
self
,
args
):
def
bgn_enumerate
(
self
,
args
):
if
not
args
:
if
not
args
:
self
.
write
(
'<OL>
\n
'
)
self
.
write
(
'<OL>
\n
'
)
self
.
stackinfo
[
len
(
self
.
stack
)]
=
'</OL>
\n
'
self
.
stackinfo
[
len
(
self
.
stack
)]
=
'</OL>
\n
'
else
:
else
:
self
.
itemnumber
=
args
self
.
itemnumber
=
args
self
.
write
(
'<UL>
\n
'
)
self
.
write
(
'<UL>
\n
'
)
self
.
stackinfo
[
len
(
self
.
stack
)]
=
'</UL>
\n
'
self
.
stackinfo
[
len
(
self
.
stack
)]
=
'</UL>
\n
'
def
end_enumerate
(
self
):
def
end_enumerate
(
self
):
self
.
itemnumber
=
None
self
.
itemnumber
=
None
self
.
write
(
self
.
stackinfo
[
len
(
self
.
stack
)
+
1
])
self
.
write
(
self
.
stackinfo
[
len
(
self
.
stack
)
+
1
])
del
self
.
stackinfo
[
len
(
self
.
stack
)
+
1
]
del
self
.
stackinfo
[
len
(
self
.
stack
)
+
1
]
def
bgn_itemize
(
self
,
args
):
def
bgn_itemize
(
self
,
args
):
self
.
itemarg
=
args
self
.
itemarg
=
args
self
.
write
(
'<UL>
\n
'
)
self
.
write
(
'<UL>
\n
'
)
def
end_itemize
(
self
):
def
end_itemize
(
self
):
self
.
itemarg
=
None
self
.
itemarg
=
None
self
.
write
(
'</UL>
\n
'
)
self
.
write
(
'</UL>
\n
'
)
def
bgn_table
(
self
,
args
):
def
bgn_table
(
self
,
args
):
self
.
itemarg
=
args
self
.
itemarg
=
args
self
.
write
(
'<DL>
\n
'
)
self
.
write
(
'<DL>
\n
'
)
def
end_table
(
self
):
def
end_table
(
self
):
self
.
itemarg
=
None
self
.
itemarg
=
None
self
.
write
(
'</DL>
\n
'
)
self
.
write
(
'</DL>
\n
'
)
def
bgn_ftable
(
self
,
args
):
def
bgn_ftable
(
self
,
args
):
self
.
itemindex
=
'fn'
self
.
itemindex
=
'fn'
self
.
bgn_table
(
args
)
self
.
bgn_table
(
args
)
def
end_ftable
(
self
):
def
end_ftable
(
self
):
self
.
itemindex
=
None
self
.
itemindex
=
None
self
.
end_table
()
self
.
end_table
()
def
do_item
(
self
,
args
):
def
do_item
(
self
,
args
):
if
self
.
itemindex
:
self
.
index
(
self
.
itemindex
,
args
)
if
self
.
itemindex
:
self
.
index
(
self
.
itemindex
,
args
)
if
self
.
itemarg
:
if
self
.
itemarg
:
if
self
.
itemarg
[
0
]
==
'@'
and
self
.
itemarg
[
1
:
2
]
and
\
if
self
.
itemarg
[
0
]
==
'@'
and
self
.
itemarg
[
1
:
2
]
and
\
self
.
itemarg
[
1
]
in
string
.
letters
:
self
.
itemarg
[
1
]
in
string
.
letters
:
args
=
self
.
itemarg
+
'{'
+
args
+
'}'
args
=
self
.
itemarg
+
'{'
+
args
+
'}'
else
:
else
:
# some other character, e.g. '-'
# some other character, e.g. '-'
args
=
self
.
itemarg
+
' '
+
args
args
=
self
.
itemarg
+
' '
+
args
if
self
.
itemnumber
<>
None
:
if
self
.
itemnumber
<>
None
:
args
=
self
.
itemnumber
+
'. '
+
args
args
=
self
.
itemnumber
+
'. '
+
args
self
.
itemnumber
=
increment
(
self
.
itemnumber
)
self
.
itemnumber
=
increment
(
self
.
itemnumber
)
if
self
.
stack
and
self
.
stack
[
-
1
]
==
'table'
:
if
self
.
stack
and
self
.
stack
[
-
1
]
==
'table'
:
self
.
write
(
'<DT>'
)
self
.
write
(
'<DT>'
)
self
.
expand
(
args
)
self
.
expand
(
args
)
self
.
write
(
'
\n
<DD>'
)
self
.
write
(
'
\n
<DD>'
)
else
:
else
:
self
.
write
(
'<LI>'
)
self
.
write
(
'<LI>'
)
self
.
expand
(
args
)
self
.
expand
(
args
)
self
.
write
(
' '
)
self
.
write
(
' '
)
do_itemx
=
do_item
# XXX Should suppress leading blank line
do_itemx
=
do_item
# XXX Should suppress leading blank line
# --- Enumerations, displays, quotations ---
# --- Enumerations, displays, quotations ---
...
@@ -1285,11 +1285,11 @@ class TexinfoParser:
...
@@ -1285,11 +1285,11 @@ class TexinfoParser:
def
end_quotation
(
self
):
self
.
write
(
'</BLOCKQUOTE>
\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>'
)
self
.
write
(
'<PRE>'
)
def
end_example
(
self
):
def
end_example
(
self
):
self
.
write
(
'</PRE>
\n
'
)
self
.
write
(
'</PRE>
\n
'
)
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
end_lisp
=
end_example
end_lisp
=
end_example
...
@@ -1310,24 +1310,24 @@ class TexinfoParser:
...
@@ -1310,24 +1310,24 @@ class TexinfoParser:
# XXX Should really mess with indentation
# XXX Should really mess with indentation
def
bgn_flushleft
(
self
,
args
):
def
bgn_flushleft
(
self
,
args
):
self
.
nofill
=
self
.
nofill
+
1
self
.
nofill
=
self
.
nofill
+
1
self
.
write
(
'<PRE>
\n
'
)
self
.
write
(
'<PRE>
\n
'
)
def
end_flushleft
(
self
):
def
end_flushleft
(
self
):
self
.
write
(
'</PRE>
\n
'
)
self
.
write
(
'</PRE>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
self
.
nofill
=
self
.
nofill
-
1
def
bgn_flushright
(
self
,
args
):
def
bgn_flushright
(
self
,
args
):
self
.
nofill
=
self
.
nofill
+
1
self
.
nofill
=
self
.
nofill
+
1
self
.
write
(
'<ADDRESS COMPACT>
\n
'
)
self
.
write
(
'<ADDRESS COMPACT>
\n
'
)
def
end_flushright
(
self
):
def
end_flushright
(
self
):
self
.
write
(
'</ADDRESS>
\n
'
)
self
.
write
(
'</ADDRESS>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
self
.
nofill
=
self
.
nofill
-
1
def
bgn_menu
(
self
,
args
):
def
bgn_menu
(
self
,
args
):
self
.
write
(
'<DIR>
\n
'
)
self
.
write
(
'<DIR>
\n
'
)
self
.
write
(
' <STRONG><EM>Menu</EM></STRONG><P>
\n
'
)
self
.
write
(
' <STRONG><EM>Menu</EM></STRONG><P>
\n
'
)
def
end_menu
(
self
):
def
end_menu
(
self
):
self
.
write
(
'</DIR>
\n
'
)
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
...
@@ -1335,24 +1335,24 @@ class TexinfoParser:
...
@@ -1335,24 +1335,24 @@ class TexinfoParser:
# --- Indices ---
# --- Indices ---
def
resetindex
(
self
):
def
resetindex
(
self
):
self
.
noncodeindices
=
[
'cp'
]
self
.
noncodeindices
=
[
'cp'
]
self
.
indextitle
=
{}
self
.
indextitle
=
{}
self
.
indextitle
[
'cp'
]
=
'Concept'
self
.
indextitle
[
'cp'
]
=
'Concept'
self
.
indextitle
[
'fn'
]
=
'Function'
self
.
indextitle
[
'fn'
]
=
'Function'
self
.
indextitle
[
'ky'
]
=
'Keyword'
self
.
indextitle
[
'ky'
]
=
'Keyword'
self
.
indextitle
[
'pg'
]
=
'Program'
self
.
indextitle
[
'pg'
]
=
'Program'
self
.
indextitle
[
'tp'
]
=
'Type'
self
.
indextitle
[
'tp'
]
=
'Type'
self
.
indextitle
[
'vr'
]
=
'Variable'
self
.
indextitle
[
'vr'
]
=
'Variable'
#
#
self
.
whichindex
=
{}
self
.
whichindex
=
{}
for
name
in
self
.
indextitle
.
keys
():
for
name
in
self
.
indextitle
.
keys
():
self
.
whichindex
[
name
]
=
[]
self
.
whichindex
[
name
]
=
[]
def
user_index
(
self
,
name
,
args
):
def
user_index
(
self
,
name
,
args
):
if
self
.
whichindex
.
has_key
(
name
):
if
self
.
whichindex
.
has_key
(
name
):
self
.
index
(
name
,
args
)
self
.
index
(
name
,
args
)
else
:
else
:
print
'*** No index named'
,
`name`
print
'*** No index named'
,
`name`
def
do_cindex
(
self
,
args
):
self
.
index
(
'cp'
,
args
)
def
do_cindex
(
self
,
args
):
self
.
index
(
'cp'
,
args
)
def
do_findex
(
self
,
args
):
self
.
index
(
'fn'
,
args
)
def
do_findex
(
self
,
args
):
self
.
index
(
'fn'
,
args
)
...
@@ -1362,79 +1362,79 @@ class TexinfoParser:
...
@@ -1362,79 +1362,79 @@ class TexinfoParser:
def
do_vindex
(
self
,
args
):
self
.
index
(
'vr'
,
args
)
def
do_vindex
(
self
,
args
):
self
.
index
(
'vr'
,
args
)
def
index
(
self
,
name
,
args
):
def
index
(
self
,
name
,
args
):
self
.
whichindex
[
name
]
.
append
(
args
,
self
.
nodename
)
self
.
whichindex
[
name
]
.
append
(
args
,
self
.
nodename
)
def
do_synindex
(
self
,
args
):
def
do_synindex
(
self
,
args
):
words
=
string
.
split
(
args
)
words
=
string
.
split
(
args
)
if
len
(
words
)
<>
2
:
if
len
(
words
)
<>
2
:
print
'*** bad @synindex'
,
args
print
'*** bad @synindex'
,
args
return
return
[
old
,
new
]
=
words
[
old
,
new
]
=
words
if
not
self
.
whichindex
.
has_key
(
old
)
or
\
if
not
self
.
whichindex
.
has_key
(
old
)
or
\
not
self
.
whichindex
.
has_key
(
new
):
not
self
.
whichindex
.
has_key
(
new
):
print
'*** bad key(s) in @synindex'
,
args
print
'*** bad key(s) in @synindex'
,
args
return
return
if
old
<>
new
and
\
if
old
<>
new
and
\
self
.
whichindex
[
old
]
is
not
self
.
whichindex
[
new
]:
self
.
whichindex
[
old
]
is
not
self
.
whichindex
[
new
]:
inew
=
self
.
whichindex
[
new
]
inew
=
self
.
whichindex
[
new
]
inew
[
len
(
inew
):]
=
self
.
whichindex
[
old
]
inew
[
len
(
inew
):]
=
self
.
whichindex
[
old
]
self
.
whichindex
[
old
]
=
inew
self
.
whichindex
[
old
]
=
inew
do_syncodeindex
=
do_synindex
# XXX Should use code font
do_syncodeindex
=
do_synindex
# XXX Should use code font
def
do_printindex
(
self
,
args
):
def
do_printindex
(
self
,
args
):
words
=
string
.
split
(
args
)
words
=
string
.
split
(
args
)
for
name
in
words
:
for
name
in
words
:
if
self
.
whichindex
.
has_key
(
name
):
if
self
.
whichindex
.
has_key
(
name
):
self
.
prindex
(
name
)
self
.
prindex
(
name
)
else
:
else
:
print
'*** No index named'
,
`name`
print
'*** No index named'
,
`name`
def
prindex
(
self
,
name
):
def
prindex
(
self
,
name
):
iscodeindex
=
(
name
not
in
self
.
noncodeindices
)
iscodeindex
=
(
name
not
in
self
.
noncodeindices
)
index
=
self
.
whichindex
[
name
]
index
=
self
.
whichindex
[
name
]
if
not
index
:
return
if
not
index
:
return
if
self
.
debugging
:
if
self
.
debugging
:
print
'--- Generating'
,
self
.
indextitle
[
name
],
'index'
print
'--- Generating'
,
self
.
indextitle
[
name
],
'index'
# The node already provides a title
# The node already provides a title
index1
=
[]
index1
=
[]
junkprog
=
re
.
compile
(
'^(@[a-z]+)?{'
)
junkprog
=
re
.
compile
(
'^(@[a-z]+)?{'
)
for
key
,
node
in
index
:
for
key
,
node
in
index
:
sortkey
=
string
.
lower
(
key
)
sortkey
=
string
.
lower
(
key
)
# Remove leading `@cmd{' from sort key
# Remove leading `@cmd{' from sort key
# -- don't bother about the matching `}'
# -- don't bother about the matching `}'
oldsortkey
=
sortkey
oldsortkey
=
sortkey
while
1
:
while
1
:
mo
=
junkprog
.
match
(
sortkey
)
mo
=
junkprog
.
match
(
sortkey
)
if
not
mo
:
if
not
mo
:
break
break
i
=
mo
.
end
()
i
=
mo
.
end
()
sortkey
=
sortkey
[
i
:]
sortkey
=
sortkey
[
i
:]
index1
.
append
(
sortkey
,
key
,
node
)
index1
.
append
(
sortkey
,
key
,
node
)
del
index
[:]
del
index
[:]
index1
.
sort
()
index1
.
sort
()
self
.
write
(
'<DL COMPACT>
\n
'
)
self
.
write
(
'<DL COMPACT>
\n
'
)
prevkey
=
prevnode
=
None
prevkey
=
prevnode
=
None
for
sortkey
,
key
,
node
in
index1
:
for
sortkey
,
key
,
node
in
index1
:
if
(
key
,
node
)
==
(
prevkey
,
prevnode
):
if
(
key
,
node
)
==
(
prevkey
,
prevnode
):
continue
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
+
'}'
if
key
!=
prevkey
:
if
key
!=
prevkey
:
self
.
expand
(
key
)
self
.
expand
(
key
)
self
.
write
(
'
\n
<DD><A HREF="
%
s">
%
s</A>
\n
'
%
(
makefile
(
node
),
node
))
self
.
write
(
'
\n
<DD><A HREF="
%
s">
%
s</A>
\n
'
%
(
makefile
(
node
),
node
))
prevkey
,
prevnode
=
key
,
node
prevkey
,
prevnode
=
key
,
node
self
.
write
(
'</DL>
\n
'
)
self
.
write
(
'</DL>
\n
'
)
# --- Final error reports ---
# --- Final error reports ---
def
report
(
self
):
def
report
(
self
):
if
self
.
unknown
:
if
self
.
unknown
:
print
'--- Unrecognized commands ---'
print
'--- Unrecognized commands ---'
cmds
=
self
.
unknown
.
keys
()
cmds
=
self
.
unknown
.
keys
()
cmds
.
sort
()
cmds
.
sort
()
for
cmd
in
cmds
:
for
cmd
in
cmds
:
print
string
.
ljust
(
cmd
,
20
),
self
.
unknown
[
cmd
]
print
string
.
ljust
(
cmd
,
20
),
self
.
unknown
[
cmd
]
class
TexinfoParserHTML3
(
TexinfoParser
):
class
TexinfoParserHTML3
(
TexinfoParser
):
...
@@ -1442,12 +1442,12 @@ class TexinfoParserHTML3(TexinfoParser):
...
@@ -1442,12 +1442,12 @@ class TexinfoParserHTML3(TexinfoParser):
COPYRIGHT_SYMBOL
=
"©"
COPYRIGHT_SYMBOL
=
"©"
FN_ID_PATTERN
=
"[
%(id)
s]"
FN_ID_PATTERN
=
"[
%(id)
s]"
FN_SOURCE_PATTERN
=
'<A ID=footnoteref
%(id)
s '
\
FN_SOURCE_PATTERN
=
'<A ID=footnoteref
%(id)
s '
\
'HREF="#footnotetext
%(id)
s">'
+
FN_ID_PATTERN
+
'</A>'
'HREF="#footnotetext
%(id)
s">'
+
FN_ID_PATTERN
+
'</A>'
FN_TARGET_PATTERN
=
'<FN ID=footnotetext
%(id)
s>
\n
'
\
FN_TARGET_PATTERN
=
'<FN ID=footnotetext
%(id)
s>
\n
'
\
'<P><A HREF="#footnoteref
%(id)
s">'
+
FN_ID_PATTERN
\
'<P><A HREF="#footnoteref
%(id)
s">'
+
FN_ID_PATTERN
\
+
'</A>
\n
%(text)
s</P></FN>
\n
'
+
'</A>
\n
%(text)
s</P></FN>
\n
'
FN_HEADER
=
'<DIV CLASS=footnotes>
\n
<HR NOSHADE WIDTH=200>
\n
'
\
FN_HEADER
=
'<DIV CLASS=footnotes>
\n
<HR NOSHADE WIDTH=200>
\n
'
\
' <STRONG><EM>Footnotes</EM></STRONG>
\n
<P>
\n
'
' <STRONG><EM>Footnotes</EM></STRONG>
\n
<P>
\n
'
Node
=
HTML3Node
Node
=
HTML3Node
...
@@ -1455,30 +1455,30 @@ class TexinfoParserHTML3(TexinfoParser):
...
@@ -1455,30 +1455,30 @@ class TexinfoParserHTML3(TexinfoParser):
def
end_quotation
(
self
):
self
.
write
(
'</BQ>
\n
'
)
def
end_quotation
(
self
):
self
.
write
(
'</BQ>
\n
'
)
def
bgn_example
(
self
,
args
):
def
bgn_example
(
self
,
args
):
# this use of <CODE> would not be legal in HTML 2.0,
# this use of <CODE> would not be legal in HTML 2.0,
# but is in more recent DTDs.
# but is in more recent DTDs.
self
.
nofill
=
self
.
nofill
+
1
self
.
nofill
=
self
.
nofill
+
1
self
.
write
(
'<PRE CLASS=example><CODE>'
)
self
.
write
(
'<PRE CLASS=example><CODE>'
)
def
end_example
(
self
):
def
end_example
(
self
):
self
.
write
(
"</CODE></PRE>
\n
"
)
self
.
write
(
"</CODE></PRE>
\n
"
)
self
.
nofill
=
self
.
nofill
-
1
self
.
nofill
=
self
.
nofill
-
1
def
bgn_flushleft
(
self
,
args
):
def
bgn_flushleft
(
self
,
args
):
self
.
nofill
=
self
.
nofill
+
1
self
.
nofill
=
self
.
nofill
+
1
self
.
write
(
'<PRE CLASS=flushleft>
\n
'
)
self
.
write
(
'<PRE CLASS=flushleft>
\n
'
)
def
bgn_flushright
(
self
,
args
):
def
bgn_flushright
(
self
,
args
):
self
.
nofill
=
self
.
nofill
+
1
self
.
nofill
=
self
.
nofill
+
1
self
.
write
(
'<DIV ALIGN=right CLASS=flushright><ADDRESS COMPACT>
\n
'
)
self
.
write
(
'<DIV ALIGN=right CLASS=flushright><ADDRESS COMPACT>
\n
'
)
def
end_flushright
(
self
):
def
end_flushright
(
self
):
self
.
write
(
'</ADDRESS></DIV>
\n
'
)
self
.
write
(
'</ADDRESS></DIV>
\n
'
)
self
.
nofill
=
self
.
nofill
-
1
self
.
nofill
=
self
.
nofill
-
1
def
bgn_menu
(
self
,
args
):
def
bgn_menu
(
self
,
args
):
self
.
write
(
'<UL PLAIN CLASS=menu>
\n
'
)
self
.
write
(
'<UL PLAIN CLASS=menu>
\n
'
)
self
.
write
(
' <LH>Menu</LH>
\n
'
)
self
.
write
(
' <LH>Menu</LH>
\n
'
)
def
end_menu
(
self
):
def
end_menu
(
self
):
self
.
write
(
'</UL>
\n
'
)
self
.
write
(
'</UL>
\n
'
)
# Put @var{} around alphabetic substrings
# Put @var{} around alphabetic substrings
...
@@ -1492,11 +1492,11 @@ def splitwords(str, minlength):
...
@@ -1492,11 +1492,11 @@ def splitwords(str, minlength):
i
=
0
i
=
0
n
=
len
(
str
)
n
=
len
(
str
)
while
i
<
n
:
while
i
<
n
:
while
i
<
n
and
str
[
i
]
in
'
\t\n
'
:
i
=
i
+
1
while
i
<
n
and
str
[
i
]
in
'
\t\n
'
:
i
=
i
+
1
if
i
>=
n
:
break
if
i
>=
n
:
break
start
=
i
start
=
i
i
=
findwordend
(
str
,
i
,
n
)
i
=
findwordend
(
str
,
i
,
n
)
words
.
append
(
str
[
start
:
i
])
words
.
append
(
str
[
start
:
i
])
while
len
(
words
)
<
minlength
:
words
.
append
(
''
)
while
len
(
words
)
<
minlength
:
words
.
append
(
''
)
return
words
return
words
...
@@ -1510,11 +1510,11 @@ def findwordend(str, i, n):
...
@@ -1510,11 +1510,11 @@ def findwordend(str, i, n):
if
not
mo
:
if
not
mo
:
break
break
i
=
mo
.
start
()
i
=
mo
.
start
()
c
=
str
[
i
];
i
=
i
+
1
c
=
str
[
i
];
i
=
i
+
1
if
c
==
'@'
:
i
=
i
+
1
# Next character is not special
if
c
==
'@'
:
i
=
i
+
1
# Next character is not special
elif
c
==
'{'
:
level
=
level
+
1
elif
c
==
'{'
:
level
=
level
+
1
elif
c
==
'}'
:
level
=
level
-
1
elif
c
==
'}'
:
level
=
level
-
1
elif
c
==
' '
and
level
<=
0
:
return
i
-
1
elif
c
==
' '
and
level
<=
0
:
return
i
-
1
return
n
return
n
...
@@ -1533,32 +1533,32 @@ goodchars = string.letters + string.digits + '!@-=+.'
...
@@ -1533,32 +1533,32 @@ goodchars = string.letters + string.digits + '!@-=+.'
def
fixfunnychars
(
addr
):
def
fixfunnychars
(
addr
):
i
=
0
i
=
0
while
i
<
len
(
addr
):
while
i
<
len
(
addr
):
c
=
addr
[
i
]
c
=
addr
[
i
]
if
c
not
in
goodchars
:
if
c
not
in
goodchars
:
c
=
'-'
c
=
'-'
addr
=
addr
[:
i
]
+
c
+
addr
[
i
+
1
:]
addr
=
addr
[:
i
]
+
c
+
addr
[
i
+
1
:]
i
=
i
+
len
(
c
)
i
=
i
+
len
(
c
)
return
addr
return
addr
# Increment a string used as an enumeration
# Increment a string used as an enumeration
def
increment
(
s
):
def
increment
(
s
):
if
not
s
:
if
not
s
:
return
'1'
return
'1'
for
sequence
in
string
.
digits
,
string
.
lowercase
,
string
.
uppercase
:
for
sequence
in
string
.
digits
,
string
.
lowercase
,
string
.
uppercase
:
lastc
=
s
[
-
1
]
lastc
=
s
[
-
1
]
if
lastc
in
sequence
:
if
lastc
in
sequence
:
i
=
string
.
index
(
sequence
,
lastc
)
+
1
i
=
string
.
index
(
sequence
,
lastc
)
+
1
if
i
>=
len
(
sequence
):
if
i
>=
len
(
sequence
):
if
len
(
s
)
==
1
:
if
len
(
s
)
==
1
:
s
=
sequence
[
0
]
*
2
s
=
sequence
[
0
]
*
2
if
s
==
'00'
:
if
s
==
'00'
:
s
=
'10'
s
=
'10'
else
:
else
:
s
=
increment
(
s
[:
-
1
])
+
sequence
[
0
]
s
=
increment
(
s
[:
-
1
])
+
sequence
[
0
]
else
:
else
:
s
=
s
[:
-
1
]
+
sequence
[
i
]
s
=
s
[:
-
1
]
+
sequence
[
i
]
return
s
return
s
return
s
# Don't increment
return
s
# Don't increment
...
@@ -1570,25 +1570,25 @@ def test():
...
@@ -1570,25 +1570,25 @@ def test():
html3
=
0
html3
=
0
while
sys
.
argv
[
1
:
2
]
==
[
'-d'
]:
while
sys
.
argv
[
1
:
2
]
==
[
'-d'
]:
debugging
=
debugging
+
1
debugging
=
debugging
+
1
del
sys
.
argv
[
1
:
2
]
del
sys
.
argv
[
1
:
2
]
if
sys
.
argv
[
1
]
==
'-p'
:
if
sys
.
argv
[
1
]
==
'-p'
:
print_headers
=
1
print_headers
=
1
del
sys
.
argv
[
1
]
del
sys
.
argv
[
1
]
if
sys
.
argv
[
1
]
==
'-c'
:
if
sys
.
argv
[
1
]
==
'-c'
:
cont
=
1
cont
=
1
del
sys
.
argv
[
1
]
del
sys
.
argv
[
1
]
if
sys
.
argv
[
1
]
==
'-3'
:
if
sys
.
argv
[
1
]
==
'-3'
:
html3
=
1
html3
=
1
del
sys
.
argv
[
1
]
del
sys
.
argv
[
1
]
if
len
(
sys
.
argv
)
<>
3
:
if
len
(
sys
.
argv
)
<>
3
:
print
'usage: texi2html [-d [-d]] [-p] [-c] inputfile outputdirectory'
print
'usage: texi2html [-d [-d]] [-p] [-c] inputfile outputdirectory'
sys
.
exit
(
2
)
sys
.
exit
(
2
)
if
html3
:
if
html3
:
parser
=
TexinfoParserHTML3
()
parser
=
TexinfoParserHTML3
()
else
:
else
:
parser
=
TexinfoParser
()
parser
=
TexinfoParser
()
parser
.
cont
=
cont
parser
.
cont
=
cont
parser
.
debugging
=
debugging
parser
.
debugging
=
debugging
parser
.
print_headers
=
print_headers
parser
.
print_headers
=
print_headers
...
@@ -1596,14 +1596,14 @@ def test():
...
@@ -1596,14 +1596,14 @@ def test():
file
=
sys
.
argv
[
1
]
file
=
sys
.
argv
[
1
]
parser
.
setdirname
(
sys
.
argv
[
2
])
parser
.
setdirname
(
sys
.
argv
[
2
])
if
file
==
'-'
:
if
file
==
'-'
:
fp
=
sys
.
stdin
fp
=
sys
.
stdin
else
:
else
:
parser
.
setincludedir
(
os
.
path
.
dirname
(
file
))
parser
.
setincludedir
(
os
.
path
.
dirname
(
file
))
try
:
try
:
fp
=
open
(
file
,
'r'
)
fp
=
open
(
file
,
'r'
)
except
IOError
,
msg
:
except
IOError
,
msg
:
print
file
,
':'
,
msg
print
file
,
':'
,
msg
sys
.
exit
(
1
)
sys
.
exit
(
1
)
parser
.
parse
(
fp
)
parser
.
parse
(
fp
)
fp
.
close
()
fp
.
close
()
parser
.
report
()
parser
.
report
()
...
...
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