annotate Tools/scripts/texi2html.py @ 6719:faebc1940432 legacy-trunk

Understand -Xlinker option.
author Guido van Rossum <guido@python.org>
date Tue, 02 Dec 1997 20:38:11 +0000
parents 18927abdc262
children c7d99f6d2e2f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1 #! /usr/local/bin/python
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
2
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
3 # Convert GNU texinfo files into HTML, one file per node.
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
4 # Based on Texinfo 2.14.
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
5 # Usage: texi2html [-d] [-d] [-c] inputfile outputdirectory
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
6 # The input file must be a complete texinfo file, e.g. emacs.texi.
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
7 # This creates many files (one per info node) in the output directory,
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
8 # overwriting existing files of the same name. All files created have
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
9 # ".html" as their extension.
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
10
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
11
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
12 # XXX To do:
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
13 # - handle @comment*** correctly
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
14 # - handle @xref {some words} correctly
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
15 # - handle @ftable correctly (items aren't indexed?)
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
16 # - handle @itemx properly
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
17 # - handle @exdent properly
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
18 # - add links directly to the proper line from indices
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
19 # - check against the definitive list of @-cmds; we still miss (among others):
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
20 # - @defindex (hard)
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
21 # - @c(omment) in the middle of a line (rarely used)
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
22 # - @this* (not really needed, only used in headers anyway)
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
23 # - @today{} (ever used outside title page?)
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
24
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
25 # More consistent handling of chapters/sections/etc.
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
26 # Lots of documentation
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
27 # Many more options:
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
28 # -top designate top node
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
29 # -links customize which types of links are included
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
30 # -split split at chapters or sections instead of nodes
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
31 # -name Allow different types of filename handling. Non unix systems
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
32 # will have problems with long node names
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
33 # ...
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
34 # Support the most recent texinfo version and take a good look at HTML 3.0
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
35 # More debugging output (customizable) and more fexible error handling
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
36 # How about icons ?
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
37
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
38 import os
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
39 import regex
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
40 import regsub
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
41 import string
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
42
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
43 MAGIC = '\\input texinfo'
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
44
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
45 cmprog = regex.compile('^@\([a-z]+\)\([ \t]\|$\)') # Command (line-oriented)
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
46 blprog = regex.compile('^[ \t]*$') # Blank line
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
47 kwprog = regex.compile('@[a-z]+') # Keyword (embedded, usually with {} args)
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
48 spprog = regex.compile('[\n@{}&<>]') # Special characters in running text
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
49 miprog = regex.compile( \
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
50 '^\* \([^:]*\):\(:\|[ \t]*\([^\t,\n.]+\)\([^ \t\n]*\)\)[ \t\n]*')
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
51 # menu item (Yuck!)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
52
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
53
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
54 class HTMLNode:
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
55 """Some of the parser's functionality is separated into this class.
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
56
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
57 A Node accumulates its contents, takes care of links to other Nodes
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
58 and saves itself when it is finished and all links are resolved.
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
59 """
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
60
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
61 DOCTYPE = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">'
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
62
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
63 type = 0
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
64 cont = ''
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
65 epilogue = '</BODY></HTML>\n'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
66
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
67 def __init__(self, dir, name, topname, title, next, prev, up):
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
68 self.dirname = dir
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
69 self.name = name
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
70 if topname:
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
71 self.topname = topname
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
72 else:
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
73 self.topname = name
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
74 self.title = title
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
75 self.next = next
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
76 self.prev = prev
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
77 self.up = up
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
78 self.lines = []
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
79
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
80 def write(self, *lines):
3998
f630a067ae8c Some improvements by Fred Drake.
Guido van Rossum <guido@python.org>
parents: 3016
diff changeset
81 map(self.lines.append, lines)
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
82
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
83 def flush(self):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
84 fp = open(self.dirname + '/' + makefile(self.name), 'w')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
85 fp.write(self.prologue)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
86 fp.write(self.text)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
87 fp.write(self.epilogue)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
88 fp.close()
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
89
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
90 def link(self, label, nodename, rel=None, rev=None):
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
91 if nodename:
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
92 if string.lower(nodename) == '(dir)':
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
93 addr = '../dir.html'
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
94 title = ''
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
95 else:
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
96 addr = makefile(nodename)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
97 title = ' TITLE="%s"' % nodename
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
98 self.write(label, ': <A HREF="', addr, '"', \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
99 rel and (' REL=' + rel) or "", \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
100 rev and (' REV=' + rev) or "", \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
101 title, '>', nodename, '</A> \n')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
102
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
103 def finalize(self):
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
104 length = len(self.lines)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
105 self.text = string.joinfields(self.lines, '')
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
106 self.lines = []
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
107 self.open_links()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
108 self.output_links()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
109 self.close_links()
3998
f630a067ae8c Some improvements by Fred Drake.
Guido van Rossum <guido@python.org>
parents: 3016
diff changeset
110 links = string.joinfields(self.lines, '')
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
111 self.lines = []
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
112
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
113 self.prologue = (
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
114 self.DOCTYPE +
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
115 '\n<HTML><HEAD>\n'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
116 ' <!-- Converted with texi2html and Python -->\n'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
117 ' <TITLE>' + self.title + '</TITLE>\n'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
118 ' <LINK REL=Next HREF="'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
119 + makefile(self.next) + '" TITLE="' + self.next + '">\n'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
120 ' <LINK REL=Previous HREF="'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
121 + makefile(self.prev) + '" TITLE="' + self.prev + '">\n'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
122 ' <LINK REL=Up HREF="'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
123 + makefile(self.up) + '" TITLE="' + self.up + '">\n'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
124 '</HEAD><BODY>\n' +
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
125 links)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
126 if length > 20:
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
127 self.epilogue = '<P>\n%s</BODY></HTML>\n' % links
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
128
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
129 def open_links(self):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
130 self.write('<HR>\n')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
131
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
132 def close_links(self):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
133 self.write('<HR>\n')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
134
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
135 def output_links(self):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
136 if self.cont != self.next:
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
137 self.link(' Cont', self.cont)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
138 self.link(' Next', self.next, rel='Next')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
139 self.link(' Prev', self.prev, rel='Previous')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
140 self.link(' Up', self.up, rel='Up')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
141 if self.name <> self.topname:
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
142 self.link(' Top', self.topname)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
143
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
144
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
145 class HTML3Node(HTMLNode):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
146
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
147 DOCTYPE = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML Level 3//EN//3.0">'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
148
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
149 def open_links(self):
4405
e528c0ace4e5 (texi2html.py): Added CLASS=Navigation attribute to DIV around top/bottom
Fred Drake <fdrake@acm.org>
parents: 4392
diff changeset
150 self.write('<DIV CLASS=Navigation>\n <HR>\n')
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
151
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
152 def close_links(self):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
153 self.write(' <HR>\n</DIV>\n')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
154
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
155
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
156 class TexinfoParser:
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
157
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
158 COPYRIGHT_SYMBOL = "&copy;"
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
159 FN_ID_PATTERN = "(%(id)s)"
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
160 FN_SOURCE_PATTERN = '<A NAME=footnoteref%(id)s' \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
161 ' HREF="#footnotetext%(id)s">' \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
162 + FN_ID_PATTERN + '</A>'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
163 FN_TARGET_PATTERN = '<A NAME=footnotetext%(id)s' \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
164 ' HREF="#footnoteref%(id)s">' \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
165 + FN_ID_PATTERN + '</A>\n%(text)s<P>\n'
4405
e528c0ace4e5 (texi2html.py): Added CLASS=Navigation attribute to DIV around top/bottom
Fred Drake <fdrake@acm.org>
parents: 4392
diff changeset
166 FN_HEADER = '\n<P>\n<HR NOSHADE SIZE=1 WIDTH=200>\n' \
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
167 '<STRONG><EM>Footnotes</EM></STRONG>\n<P>'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
168
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
169
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
170 Node = HTMLNode
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
171
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
172 # Initialize an instance
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
173 def __init__(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
174 self.unknown = {} # statistics about unknown @-commands
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
175 self.filenames = {} # Check for identical filenames
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
176 self.debugging = 0 # larger values produce more output
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
177 self.print_headers = 0 # always print headers?
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
178 self.nodefp = None # open file we're writing to
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
179 self.nodelineno = 0 # Linenumber relative to node
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
180 self.links = None # Links from current node
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
181 self.savetext = None # If not None, save text head instead
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
182 self.savestack = [] # If not None, save text head instead
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
183 self.dirname = 'tmp' # directory where files are created
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
184 self.includedir = '.' # directory to search @include files
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
185 self.nodename = '' # name of current node
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
186 self.topname = '' # name of top node (first node seen)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
187 self.title = '' # title of this whole Texinfo tree
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
188 self.resetindex() # Reset all indices
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
189 self.contents = [] # Reset table of contents
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
190 self.numbering = [] # Reset section numbering counters
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
191 self.nofill = 0 # Normal operation: fill paragraphs
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
192 self.values={'html': 1} # Names that should be parsed in ifset
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
193 self.stackinfo={} # Keep track of state in the stack
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
194 # XXX The following should be reset per node?!
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
195 self.footnotes = [] # Reset list of footnotes
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
196 self.itemarg = None # Reset command used by @item
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
197 self.itemnumber = None # Reset number for @item in @enumerate
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
198 self.itemindex = None # Reset item index name
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
199 self.node = None
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
200 self.nodestack = []
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
201 self.cont = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
202 self.includedepth = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
203 # Set (output) directory name
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
204 def setdirname(self, dirname):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
205 self.dirname = dirname
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
206
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
207 # Set include directory name
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
208 def setincludedir(self, includedir):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
209 self.includedir = includedir
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
210
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
211 # Parse the contents of an entire file
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
212 def parse(self, fp):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
213 line = fp.readline()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
214 lineno = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
215 while line and (line[0] == '%' or blprog.match(line) >= 0):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
216 line = fp.readline()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
217 lineno = lineno + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
218 if line[:len(MAGIC)] <> MAGIC:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
219 raise SyntaxError, 'file does not begin with '+`MAGIC`
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
220 self.parserest(fp, lineno)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
221
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
222 # Parse the contents of a file, not expecting a MAGIC header
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
223 def parserest(self, fp, initial_lineno):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
224 lineno = initial_lineno
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
225 self.done = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
226 self.skip = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
227 self.stack = []
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
228 accu = []
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
229 while not self.done:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
230 line = fp.readline()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
231 self.nodelineno = self.nodelineno + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
232 if not line:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
233 if accu:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
234 if not self.skip: self.process(accu)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
235 accu = []
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
236 if initial_lineno > 0:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
237 print '*** EOF before @bye'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
238 break
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
239 lineno = lineno + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
240 if cmprog.match(line) >= 0:
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
241 a, b = cmprog.regs[1]
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
242 cmd = line[a:b]
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
243 if cmd in ('noindent', 'refill'):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
244 accu.append(line)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
245 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
246 if accu:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
247 if not self.skip:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
248 self.process(accu)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
249 accu = []
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
250 self.command(line)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
251 elif blprog.match(line) >= 0 and \
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
252 'format' not in self.stack and \
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
253 'example' not in self.stack:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
254 if accu:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
255 if not self.skip:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
256 self.process(accu)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
257 if self.nofill:
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
258 self.write('\n')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
259 else:
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
260 self.write('<P>\n')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
261 accu = []
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
262 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
263 # Append the line including trailing \n!
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
264 accu.append(line)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
265 #
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
266 if self.skip:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
267 print '*** Still skipping at the end'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
268 if self.stack:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
269 print '*** Stack not empty at the end'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
270 print '***', self.stack
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
271 if self.includedepth == 0:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
272 while self.nodestack:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
273 self.nodestack[-1].finalize()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
274 self.nodestack[-1].flush()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
275 del self.nodestack[-1]
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
276
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
277 # Start saving text in a buffer instead of writing it to a file
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
278 def startsaving(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
279 if self.savetext <> None:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
280 self.savestack.append(self.savetext)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
281 # print '*** Recursively saving text, expect trouble'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
282 self.savetext = ''
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
283
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
284 # Return the text saved so far and start writing to file again
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
285 def collectsavings(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
286 savetext = self.savetext
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
287 if len(self.savestack) > 0:
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
288 self.savetext = self.savestack[-1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
289 del self.savestack[-1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
290 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
291 self.savetext = None
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
292 return savetext or ''
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
293
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
294 # Write text to file, or save it in a buffer, or ignore it
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
295 def write(self, *args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
296 try:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
297 text = string.joinfields(args, '')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
298 except:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
299 print args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
300 raise TypeError
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
301 if self.savetext <> None:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
302 self.savetext = self.savetext + text
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
303 elif self.nodefp:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
304 self.nodefp.write(text)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
305 elif self.node:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
306 self.node.write(text)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
307 # Complete the current node -- write footnotes and close file
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
308 def endnode(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
309 if self.savetext <> None:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
310 print '*** Still saving text at end of node'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
311 dummy = self.collectsavings()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
312 if self.footnotes:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
313 self.writefootnotes()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
314 if self.nodefp:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
315 if self.nodelineno > 20:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
316 self.write('<HR>\n')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
317 [name, next, prev, up] = self.nodelinks[:4]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
318 self.link('Next', next)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
319 self.link('Prev', prev)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
320 self.link('Up', up)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
321 if self.nodename <> self.topname:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
322 self.link('Top', self.topname)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
323 self.write('<HR>\n')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
324 self.write('</BODY>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
325 self.nodefp.close()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
326 self.nodefp = None
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
327 elif self.node:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
328 if not self.cont and \
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
329 (not self.node.type or \
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
330 (self.node.next and self.node.prev and self.node.up)):
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
331 self.node.finalize()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
332 self.node.flush()
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
333 else:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
334 self.nodestack.append(self.node)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
335 self.node = None
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
336 self.nodename = ''
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
337
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
338 # Process a list of lines, expanding embedded @-commands
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
339 # This mostly distinguishes between menus and normal text
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
340 def process(self, accu):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
341 if self.debugging > 1:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
342 print self.skip, self.stack,
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
343 if accu: print accu[0][:30],
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
344 if accu[0][30:] or accu[1:]: print '...',
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
345 print
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
346 if self.stack and self.stack[-1] == 'menu':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
347 # XXX should be done differently
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
348 for line in accu:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
349 if miprog.match(line) < 0:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
350 line = string.strip(line) + '\n'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
351 self.expand(line)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
352 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
353 (bgn, end), (a, b), (c, d), (e, f), (g, h) = \
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
354 miprog.regs[:5]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
355 label = line[a:b]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
356 nodename = line[c:d]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
357 if nodename[0] == ':': nodename = label
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
358 else: nodename = line[e:f]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
359 punct = line[g:h]
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
360 self.write(' <LI><A HREF="',
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
361 makefile(nodename),
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
362 '">', nodename,
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
363 '</A>', punct, '\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
364 self.expand(line[end:])
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
365 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
366 text = string.joinfields(accu, '')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
367 self.expand(text)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
368
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
369 # Write a string, expanding embedded @-commands
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
370 def expand(self, text):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
371 stack = []
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
372 i = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
373 n = len(text)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
374 while i < n:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
375 start = i
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
376 i = spprog.search(text, i)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
377 if i < 0:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
378 self.write(text[start:])
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
379 break
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
380 self.write(text[start:i])
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
381 c = text[i]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
382 i = i+1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
383 if c == '\n':
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
384 self.write('\n')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
385 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
386 if c == '<':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
387 self.write('&lt;')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
388 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
389 if c == '>':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
390 self.write('&gt;')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
391 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
392 if c == '&':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
393 self.write('&amp;')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
394 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
395 if c == '{':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
396 stack.append('')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
397 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
398 if c == '}':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
399 if not stack:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
400 print '*** Unmatched }'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
401 self.write('}')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
402 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
403 cmd = stack[-1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
404 del stack[-1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
405 try:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
406 method = getattr(self, 'close_' + cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
407 except AttributeError:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
408 self.unknown_close(cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
409 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
410 method()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
411 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
412 if c <> '@':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
413 # Cannot happen unless spprog is changed
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
414 raise RuntimeError, 'unexpected funny '+`c`
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
415 start = i
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
416 while i < n and text[i] in string.letters: i = i+1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
417 if i == start:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
418 # @ plus non-letter: literal next character
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
419 i = i+1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
420 c = text[start:i]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
421 if c == ':':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
422 # `@:' means no extra space after
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
423 # preceding `.', `?', `!' or `:'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
424 pass
2705
9ed45dbf2765 mods by Gregor Schmid -- very nice!
Guido van Rossum <guido@python.org>
parents: 2551
diff changeset
425 else:
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
426 # `@.' means a sentence-ending period;
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
427 # `@@', `@{', `@}' quote `@', `{', `}'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
428 self.write(c)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
429 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
430 cmd = text[start:i]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
431 if i < n and text[i] == '{':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
432 i = i+1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
433 stack.append(cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
434 try:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
435 method = getattr(self, 'open_' + cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
436 except AttributeError:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
437 self.unknown_open(cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
438 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
439 method()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
440 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
441 try:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
442 method = getattr(self, 'handle_' + cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
443 except AttributeError:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
444 self.unknown_handle(cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
445 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
446 method()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
447 if stack:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
448 print '*** Stack not empty at para:', stack
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
449
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
450 # --- Handle unknown embedded @-commands ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
451
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
452 def unknown_open(self, cmd):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
453 print '*** No open func for @' + cmd + '{...}'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
454 cmd = cmd + '{'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
455 self.write('@', cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
456 if not self.unknown.has_key(cmd):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
457 self.unknown[cmd] = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
458 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
459 self.unknown[cmd] = self.unknown[cmd] + 1
2705
9ed45dbf2765 mods by Gregor Schmid -- very nice!
Guido van Rossum <guido@python.org>
parents: 2551
diff changeset
460
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
461 def unknown_close(self, cmd):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
462 print '*** No close func for @' + cmd + '{...}'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
463 cmd = '}' + cmd
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
464 self.write('}')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
465 if not self.unknown.has_key(cmd):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
466 self.unknown[cmd] = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
467 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
468 self.unknown[cmd] = self.unknown[cmd] + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
469
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
470 def unknown_handle(self, cmd):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
471 print '*** No handler for @' + cmd
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
472 self.write('@', cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
473 if not self.unknown.has_key(cmd):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
474 self.unknown[cmd] = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
475 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
476 self.unknown[cmd] = self.unknown[cmd] + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
477
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
478 # XXX The following sections should be ordered as the texinfo docs
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
479
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
480 # --- Embedded @-commands without {} argument list --
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
481
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
482 def handle_noindent(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
483
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
484 def handle_refill(self): pass
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
485
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
486 # --- Include file handling ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
487
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
488 def do_include(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
489 file = args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
490 file = os.path.join(self.includedir, file)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
491 try:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
492 fp = open(file, 'r')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
493 except IOError, msg:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
494 print '*** Can\'t open include file', `file`
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
495 return
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
496 if self.debugging:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
497 print '--> file', `file`
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
498 save_done = self.done
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
499 save_skip = self.skip
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
500 save_stack = self.stack
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
501 self.includedepth = self.includedepth + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
502 self.parserest(fp, 0)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
503 self.includedepth = self.includedepth - 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
504 fp.close()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
505 self.done = save_done
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
506 self.skip = save_skip
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
507 self.stack = save_stack
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
508 if self.debugging:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
509 print '<-- file', `file`
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
510
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
511 # --- Special Insertions ---
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
512
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
513 def open_dmn(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
514 def close_dmn(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
515
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
516 def open_dots(self): self.write('...')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
517 def close_dots(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
518
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
519 def open_bullet(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
520 def close_bullet(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
521
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
522 def open_TeX(self): self.write('TeX')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
523 def close_TeX(self): pass
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
524
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
525 def handle_copyright(self): self.write(self.COPYRIGHT_SYMBOL)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
526 def open_copyright(self): self.write(self.COPYRIGHT_SYMBOL)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
527 def close_copyright(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
528
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
529 def open_minus(self): self.write('-')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
530 def close_minus(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
531
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
532 # --- Special Glyphs for Examples ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
533
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
534 def open_result(self): self.write('=&gt;')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
535 def close_result(self): pass
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
536
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
537 def open_expansion(self): self.write('==&gt;')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
538 def close_expansion(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
539
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
540 def open_print(self): self.write('-|')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
541 def close_print(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
542
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
543 def open_error(self): self.write('error--&gt;')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
544 def close_error(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
545
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
546 def open_equiv(self): self.write('==')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
547 def close_equiv(self): pass
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
548
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
549 def open_point(self): self.write('-!-')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
550 def close_point(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
551
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
552 # --- Cross References ---
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
553
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
554 def open_pxref(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
555 self.write('see ')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
556 self.startsaving()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
557 def close_pxref(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
558 self.makeref()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
559
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
560 def open_xref(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
561 self.write('See ')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
562 self.startsaving()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
563 def close_xref(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
564 self.makeref()
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
565
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
566 def open_ref(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
567 self.startsaving()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
568 def close_ref(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
569 self.makeref()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
570
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
571 def open_inforef(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
572 self.write('See info file ')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
573 self.startsaving()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
574 def close_inforef(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
575 text = self.collectsavings()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
576 args = string.splitfields(text, ',')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
577 n = len(args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
578 for i in range(n):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
579 args[i] = string.strip(args[i])
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
580 while len(args) < 3: args.append('')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
581 node = args[0]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
582 file = args[2]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
583 self.write('`', file, '\', node `', node, '\'')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
584
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
585 def makeref(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
586 text = self.collectsavings()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
587 args = string.splitfields(text, ',')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
588 n = len(args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
589 for i in range(n):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
590 args[i] = string.strip(args[i])
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
591 while len(args) < 5: args.append('')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
592 nodename = label = args[0]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
593 if args[2]: label = args[2]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
594 file = args[3]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
595 title = args[4]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
596 href = makefile(nodename)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
597 if file:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
598 href = '../' + file + '/' + href
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
599 self.write('<A HREF="', href, '">', label, '</A>')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
600
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
601 # --- Marking Words and Phrases ---
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
602
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
603 # --- Other @xxx{...} commands ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
604
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
605 def open_(self): pass # Used by {text enclosed in braces}
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
606 def close_(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
607
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
608 open_asis = open_
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
609 close_asis = close_
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
610
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
611 def open_cite(self): self.write('<CITE>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
612 def close_cite(self): self.write('</CITE>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
613
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
614 def open_code(self): self.write('<CODE>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
615 def close_code(self): self.write('</CODE>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
616
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
617 def open_t(self): self.write('<TT>')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
618 def close_t(self): self.write('</TT>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
619
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
620 def open_dfn(self): self.write('<DFN>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
621 def close_dfn(self): self.write('</DFN>')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
622
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
623 def open_emph(self): self.write('<EM>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
624 def close_emph(self): self.write('</EM>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
625
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
626 def open_i(self): self.write('<I>')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
627 def close_i(self): self.write('</I>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
628
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
629 def open_footnote(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
630 # if self.savetext <> None:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
631 # print '*** Recursive footnote -- expect weirdness'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
632 id = len(self.footnotes) + 1
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
633 self.write(self.FN_SOURCE_PATTERN % {'id': `id`})
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
634 self.startsaving()
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
635
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
636 def close_footnote(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
637 id = len(self.footnotes) + 1
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
638 self.footnotes.append(id, self.collectsavings())
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
639
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
640 def writefootnotes(self):
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
641 self.write(self.FN_HEADER)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
642 for id, text in self.footnotes:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
643 self.write(self.FN_TARGET_PATTERN
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
644 % {'id': `id`, 'text': text})
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
645 self.footnotes = []
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
646
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
647 def open_file(self): self.write('<CODE>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
648 def close_file(self): self.write('</CODE>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
649
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
650 def open_kbd(self): self.write('<KBD>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
651 def close_kbd(self): self.write('</KBD>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
652
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
653 def open_key(self): self.write('<KEY>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
654 def close_key(self): self.write('</KEY>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
655
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
656 def open_r(self): self.write('<R>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
657 def close_r(self): self.write('</R>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
658
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
659 def open_samp(self): self.write('`<SAMP>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
660 def close_samp(self): self.write('</SAMP>\'')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
661
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
662 def open_sc(self): self.write('<SMALLCAPS>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
663 def close_sc(self): self.write('</SMALLCAPS>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
664
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
665 def open_strong(self): self.write('<STRONG>')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
666 def close_strong(self): self.write('</STRONG>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
667
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
668 def open_b(self): self.write('<B>')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
669 def close_b(self): self.write('</B>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
670
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
671 def open_var(self): self.write('<VAR>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
672 def close_var(self): self.write('</VAR>')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
673
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
674 def open_w(self): self.write('<NOBREAK>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
675 def close_w(self): self.write('</NOBREAK>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
676
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
677 open_titlefont = open_
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
678 close_titlefont = close_
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
679
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
680 def open_small(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
681 def close_small(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
682
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
683 def command(self, line):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
684 a, b = cmprog.regs[1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
685 cmd = line[a:b]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
686 args = string.strip(line[b:])
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
687 if self.debugging > 1:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
688 print self.skip, self.stack, '@' + cmd, args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
689 try:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
690 func = getattr(self, 'do_' + cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
691 except AttributeError:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
692 try:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
693 func = getattr(self, 'bgn_' + cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
694 except AttributeError:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
695 # don't complain if we are skipping anyway
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
696 if not self.skip:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
697 self.unknown_cmd(cmd, args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
698 return
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
699 self.stack.append(cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
700 func(args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
701 return
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
702 if not self.skip or cmd == 'end':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
703 func(args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
704
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
705 def unknown_cmd(self, cmd, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
706 print '*** unknown', '@' + cmd, args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
707 if not self.unknown.has_key(cmd):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
708 self.unknown[cmd] = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
709 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
710 self.unknown[cmd] = self.unknown[cmd] + 1
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
711
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
712 def do_end(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
713 words = string.split(args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
714 if not words:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
715 print '*** @end w/o args'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
716 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
717 cmd = words[0]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
718 if not self.stack or self.stack[-1] <> cmd:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
719 print '*** @end', cmd, 'unexpected'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
720 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
721 del self.stack[-1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
722 try:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
723 func = getattr(self, 'end_' + cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
724 except AttributeError:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
725 self.unknown_end(cmd)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
726 return
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
727 func()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
728
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
729 def unknown_end(self, cmd):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
730 cmd = 'end ' + cmd
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
731 print '*** unknown', '@' + cmd
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
732 if not self.unknown.has_key(cmd):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
733 self.unknown[cmd] = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
734 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
735 self.unknown[cmd] = self.unknown[cmd] + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
736
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
737 # --- Comments ---
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
738
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
739 def do_comment(self, args): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
740 do_c = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
741
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
742 # --- Conditional processing ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
743
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
744 def bgn_ifinfo(self, args): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
745 def end_ifinfo(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
746
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
747 def bgn_iftex(self, args): self.skip = self.skip + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
748 def end_iftex(self): self.skip = self.skip - 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
749
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
750 def bgn_ignore(self, args): self.skip = self.skip + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
751 def end_ignore(self): self.skip = self.skip - 1
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
752
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
753 def bgn_tex(self, args): self.skip = self.skip + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
754 def end_tex(self): self.skip = self.skip - 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
755
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
756 def do_set(self, args):
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
757 fields = string.splitfields(args, ' ')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
758 key = fields[0]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
759 if len(fields) == 1:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
760 value = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
761 else:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
762 value = string.joinfields(fields[1:], ' ')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
763 self.values[key] = value
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
764 print self.values
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
765
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
766 def do_clear(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
767 self.values[args] = None
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
768
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
769 def bgn_ifset(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
770 if args not in self.values.keys() \
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
771 or self.values[args] is None:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
772 self.skip = self.skip + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
773 self.stackinfo[len(self.stack)] = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
774 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
775 self.stackinfo[len(self.stack)] = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
776 def end_ifset(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
777 print self.stack
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
778 print self.stackinfo
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
779 if self.stackinfo[len(self.stack) + 1]:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
780 self.skip = self.skip - 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
781 del self.stackinfo[len(self.stack) + 1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
782
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
783 def bgn_ifclear(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
784 if args in self.values.keys() \
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
785 and self.values[args] is not None:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
786 self.skip = self.skip + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
787 self.stackinfo[len(self.stack)] = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
788 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
789 self.stackinfo[len(self.stack)] = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
790
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
791 end_ifclear = end_ifset
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
792
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
793 def open_value(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
794 self.startsaving()
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
795
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
796 def close_value(self):
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
797 key = self.collectsavings()
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
798 if key in self.values.keys():
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
799 self.write(self.values[key])
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
800 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
801 print '*** Undefined value: ', key
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
802
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
803 # --- Beginning a file ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
804
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
805 do_finalout = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
806 do_setchapternewpage = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
807 do_setfilename = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
808
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
809 def do_settitle(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
810 print args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
811 self.startsaving()
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
812 self.expand(args)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
813 self.title = self.collectsavings()
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
814 print self.title
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
815 def do_parskip(self, args): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
816
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
817 # --- Ending a file ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
818
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
819 def do_bye(self, args):
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
820 self.endnode()
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
821 self.done = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
822
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
823 # --- Title page ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
824
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
825 def bgn_titlepage(self, args): self.skip = self.skip + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
826 def end_titlepage(self): self.skip = self.skip - 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
827 def do_shorttitlepage(self, args): pass
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
828
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
829 def do_center(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
830 # Actually not used outside title page...
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
831 self.write('<H1>')
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
832 self.expand(args)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
833 self.write('</H1>\n')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
834 do_title = do_center
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
835 do_subtitle = do_center
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
836 do_author = do_center
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
837
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
838 do_vskip = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
839 do_vfill = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
840 do_smallbook = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
841
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
842 do_paragraphindent = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
843 do_setchapternewpage = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
844 do_headings = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
845 do_footnotestyle = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
846
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
847 do_evenheading = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
848 do_evenfooting = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
849 do_oddheading = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
850 do_oddfooting = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
851 do_everyheading = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
852 do_everyfooting = do_comment
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
853
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
854 # --- Nodes ---
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
855
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
856 def do_node(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
857 self.endnode()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
858 self.nodelineno = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
859 parts = string.splitfields(args, ',')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
860 while len(parts) < 4: parts.append('')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
861 for i in range(4): parts[i] = string.strip(parts[i])
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
862 self.nodelinks = parts
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
863 [name, next, prev, up] = parts[:4]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
864 file = self.dirname + '/' + makefile(name)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
865 if self.filenames.has_key(file):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
866 print '*** Filename already in use: ', file
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
867 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
868 if self.debugging: print '--- writing', file
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
869 self.filenames[file] = 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
870 # self.nodefp = open(file, 'w')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
871 self.nodename = name
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
872 if self.cont and self.nodestack:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
873 self.nodestack[-1].cont = self.nodename
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
874 if not self.topname: self.topname = name
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
875 title = name
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
876 if self.title: title = title + ' -- ' + self.title
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
877 self.node = self.Node(self.dirname, self.nodename, self.topname,
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
878 title, next, prev, up)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
879
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
880 def link(self, label, nodename):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
881 if nodename:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
882 if string.lower(nodename) == '(dir)':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
883 addr = '../dir.html'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
884 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
885 addr = makefile(nodename)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
886 self.write(label, ': <A HREF="', addr, '" TYPE="',
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
887 label, '">', nodename, '</A> \n')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
888
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
889 # --- Sectioning commands ---
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
890
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
891 def popstack(self, type):
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
892 if (self.node):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
893 self.node.type = type
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
894 while self.nodestack:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
895 if self.nodestack[-1].type > type:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
896 self.nodestack[-1].finalize()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
897 self.nodestack[-1].flush()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
898 del self.nodestack[-1]
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
899 elif self.nodestack[-1].type == type:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
900 if not self.nodestack[-1].next:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
901 self.nodestack[-1].next = self.node.name
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
902 if not self.node.prev:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
903 self.node.prev = self.nodestack[-1].name
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
904 self.nodestack[-1].finalize()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
905 self.nodestack[-1].flush()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
906 del self.nodestack[-1]
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
907 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
908 if type > 1 and not self.node.up:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
909 self.node.up = self.nodestack[-1].name
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
910 break
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
911
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
912 def do_chapter(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
913 self.heading('H1', args, 0)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
914 self.popstack(1)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
915
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
916 def do_unnumbered(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
917 self.heading('H1', args, -1)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
918 self.popstack(1)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
919 def do_appendix(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
920 self.heading('H1', args, -1)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
921 self.popstack(1)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
922 def do_top(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
923 self.heading('H1', args, -1)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
924 def do_chapheading(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
925 self.heading('H1', args, -1)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
926 def do_majorheading(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
927 self.heading('H1', args, -1)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
928
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
929 def do_section(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
930 self.heading('H1', args, 1)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
931 self.popstack(2)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
932
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
933 def do_unnumberedsec(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
934 self.heading('H1', args, -1)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
935 self.popstack(2)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
936 def do_appendixsec(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
937 self.heading('H1', args, -1)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
938 self.popstack(2)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
939 do_appendixsection = do_appendixsec
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
940 def do_heading(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
941 self.heading('H1', args, -1)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
942
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
943 def do_subsection(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
944 self.heading('H2', args, 2)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
945 self.popstack(3)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
946 def do_unnumberedsubsec(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
947 self.heading('H2', args, -1)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
948 self.popstack(3)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
949 def do_appendixsubsec(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
950 self.heading('H2', args, -1)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
951 self.popstack(3)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
952 def do_subheading(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
953 self.heading('H2', args, -1)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
954
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
955 def do_subsubsection(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
956 self.heading('H3', args, 3)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
957 self.popstack(4)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
958 def do_unnumberedsubsubsec(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
959 self.heading('H3', args, -1)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
960 self.popstack(4)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
961 def do_appendixsubsubsec(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
962 self.heading('H3', args, -1)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
963 self.popstack(4)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
964 def do_subsubheading(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
965 self.heading('H3', args, -1)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
966
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
967 def heading(self, type, args, level):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
968 if level >= 0:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
969 while len(self.numbering) <= level:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
970 self.numbering.append(0)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
971 del self.numbering[level+1:]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
972 self.numbering[level] = self.numbering[level] + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
973 x = ''
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
974 for i in self.numbering:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
975 x = x + `i` + '.'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
976 args = x + ' ' + args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
977 self.contents.append(level, args, self.nodename)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
978 self.write('<', type, '>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
979 self.expand(args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
980 self.write('</', type, '>\n')
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
981 if self.debugging or self.print_headers:
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
982 print '---', args
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
983
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
984 def do_contents(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
985 # pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
986 self.listcontents('Table of Contents', 999)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
987
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
988 def do_shortcontents(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
989 pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
990 # self.listcontents('Short Contents', 0)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
991 do_summarycontents = do_shortcontents
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
992
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
993 def listcontents(self, title, maxlevel):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
994 self.write('<H1>', title, '</H1>\n<UL COMPACT PLAIN>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
995 prevlevels = [0]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
996 for level, title, node in self.contents:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
997 if level > maxlevel:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
998 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
999 if level > prevlevels[-1]:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1000 # can only advance one level at a time
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1001 self.write(' '*prevlevels[-1], '<UL PLAIN>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1002 prevlevels.append(level)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1003 elif level < prevlevels[-1]:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1004 # might drop back multiple levels
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1005 while level < prevlevels[-1]:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1006 del prevlevels[-1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1007 self.write(' '*prevlevels[-1],
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1008 '</UL>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1009 self.write(' '*level, '<LI> <A HREF="',
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1010 makefile(node), '">')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1011 self.expand(title)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1012 self.write('</A>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1013 self.write('</UL>\n' * len(prevlevels))
2705
9ed45dbf2765 mods by Gregor Schmid -- very nice!
Guido van Rossum <guido@python.org>
parents: 2551
diff changeset
1014
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1015 # --- Page lay-out ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1016
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1017 # These commands are only meaningful in printed text
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1018
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1019 def do_page(self, args): pass
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1020
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1021 def do_need(self, args): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1022
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1023 def bgn_group(self, args): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1024 def end_group(self): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1025
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1026 # --- Line lay-out ---
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1027
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1028 def do_sp(self, args):
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1029 if self.nofill:
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1030 self.write('\n')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1031 else:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1032 self.write('<P>\n')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1033
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1034 def do_hline(self, args):
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1035 self.write('<HR>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1036
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1037 # --- Function and variable definitions ---
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1038
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1039 def bgn_deffn(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1040 self.write('<DL>')
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1041 self.do_deffnx(args)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1042
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1043 def end_deffn(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1044 self.write('</DL>\n')
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1045
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1046 def do_deffnx(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1047 self.write('<DT>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1048 words = splitwords(args, 2)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1049 [category, name], rest = words[:2], words[2:]
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1050 self.expand('@b{%s}' % name)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1051 for word in rest: self.expand(' ' + makevar(word))
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1052 #self.expand(' -- ' + category)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1053 self.write('\n<DD>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1054 self.index('fn', name)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1055
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1056 def bgn_defun(self, args): self.bgn_deffn('Function ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1057 end_defun = end_deffn
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1058 def do_defunx(self, args): self.do_deffnx('Function ' + args)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1059
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1060 def bgn_defmac(self, args): self.bgn_deffn('Macro ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1061 end_defmac = end_deffn
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1062 def do_defmacx(self, args): self.do_deffnx('Macro ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1063
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1064 def bgn_defspec(self, args): self.bgn_deffn('{Special Form} ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1065 end_defspec = end_deffn
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1066 def do_defspecx(self, args): self.do_deffnx('{Special Form} ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1067
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1068 def bgn_defvr(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1069 self.write('<DL>')
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1070 self.do_defvrx(args)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1071
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1072 end_defvr = end_deffn
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1073
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1074 def do_defvrx(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1075 self.write('<DT>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1076 words = splitwords(args, 2)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1077 [category, name], rest = words[:2], words[2:]
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1078 self.expand('@code{%s}' % name)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1079 # If there are too many arguments, show them
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1080 for word in rest: self.expand(' ' + word)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1081 #self.expand(' -- ' + category)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1082 self.write('\n<DD>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1083 self.index('vr', name)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1084
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1085 def bgn_defvar(self, args): self.bgn_defvr('Variable ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1086 end_defvar = end_defvr
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1087 def do_defvarx(self, args): self.do_defvrx('Variable ' + args)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1088
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1089 def bgn_defopt(self, args): self.bgn_defvr('{User Option} ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1090 end_defopt = end_defvr
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1091 def do_defoptx(self, args): self.do_defvrx('{User Option} ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1092
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1093 # --- Ditto for typed languages ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1094
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1095 def bgn_deftypefn(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1096 self.write('<DL>')
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1097 self.do_deftypefnx(args)
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1098
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1099 end_deftypefn = end_deffn
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1100
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1101 def do_deftypefnx(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1102 self.write('<DT>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1103 words = splitwords(args, 3)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1104 [category, datatype, name], rest = words[:3], words[3:]
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1105 self.expand('@code{%s} @b{%s}' % (datatype, name))
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1106 for word in rest: self.expand(' ' + makevar(word))
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1107 #self.expand(' -- ' + category)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1108 self.write('\n<DD>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1109 self.index('fn', name)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1110
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1111
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1112 def bgn_deftypefun(self, args): self.bgn_deftypefn('Function ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1113 end_deftypefun = end_deftypefn
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1114 def do_deftypefunx(self, args): self.do_deftypefnx('Function ' + args)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1115
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1116 def bgn_deftypevr(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1117 self.write('<DL>')
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1118 self.do_deftypevrx(args)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1119
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1120 end_deftypevr = end_deftypefn
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1121
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1122 def do_deftypevrx(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1123 self.write('<DT>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1124 words = splitwords(args, 3)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1125 [category, datatype, name], rest = words[:3], words[3:]
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1126 self.expand('@code{%s} @b{%s}' % (datatype, name))
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1127 # If there are too many arguments, show them
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1128 for word in rest: self.expand(' ' + word)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1129 #self.expand(' -- ' + category)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1130 self.write('\n<DD>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1131 self.index('fn', name)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1132
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1133 def bgn_deftypevar(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1134 self.bgn_deftypevr('Variable ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1135 end_deftypevar = end_deftypevr
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1136 def do_deftypevarx(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1137 self.do_deftypevrx('Variable ' + args)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1138
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1139 # --- Ditto for object-oriented languages ---
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1140
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1141 def bgn_defcv(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1142 self.write('<DL>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1143 self.do_defcvx(args)
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1144
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1145 end_defcv = end_deftypevr
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1146
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1147 def do_defcvx(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1148 self.write('<DT>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1149 words = splitwords(args, 3)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1150 [category, classname, name], rest = words[:3], words[3:]
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1151 self.expand('@b{%s}' % name)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1152 # If there are too many arguments, show them
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1153 for word in rest: self.expand(' ' + word)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1154 #self.expand(' -- %s of @code{%s}' % (category, classname))
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1155 self.write('\n<DD>')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1156 self.index('vr', '%s @r{on %s}' % (name, classname))
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1157
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1158 def bgn_defivar(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1159 self.bgn_defcv('{Instance Variable} ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1160 end_defivar = end_defcv
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1161 def do_defivarx(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1162 self.do_defcvx('{Instance Variable} ' + args)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1163
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1164 def bgn_defop(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1165 self.write('<DL>')
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1166 self.do_defopx(args)
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1167
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1168 end_defop = end_defcv
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1169
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1170 def do_defopx(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1171 self.write('<DT>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1172 words = splitwords(args, 3)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1173 [category, classname, name], rest = words[:3], words[3:]
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1174 self.expand('@b{%s}' % name)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1175 for word in rest: self.expand(' ' + makevar(word))
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1176 #self.expand(' -- %s of @code{%s}' % (category, classname))
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1177 self.write('\n<DD>')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1178 self.index('fn', '%s @r{on %s}' % (name, classname))
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1179
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1180 def bgn_defmethod(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1181 self.bgn_defop('Method ' + args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1182 end_defmethod = end_defop
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1183 def do_defmethodx(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1184 self.do_defopx('Method ' + args)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1185
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1186 # --- Ditto for data types ---
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1187
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1188 def bgn_deftp(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1189 self.write('<DL>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1190 self.do_deftpx(args)
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1191
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1192 end_deftp = end_defcv
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1193
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1194 def do_deftpx(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1195 self.write('<DT>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1196 words = splitwords(args, 2)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1197 [category, name], rest = words[:2], words[2:]
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1198 self.expand('@b{%s}' % name)
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1199 for word in rest: self.expand(' ' + word)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1200 #self.expand(' -- ' + category)
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1201 self.write('\n<DD>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1202 self.index('tp', name)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1203
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1204 # --- Making Lists and Tables
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1205
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1206 def bgn_enumerate(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1207 if not args:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1208 self.write('<OL>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1209 self.stackinfo[len(self.stack)] = '</OL>\n'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1210 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1211 self.itemnumber = args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1212 self.write('<UL>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1213 self.stackinfo[len(self.stack)] = '</UL>\n'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1214 def end_enumerate(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1215 self.itemnumber = None
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1216 self.write(self.stackinfo[len(self.stack) + 1])
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1217 del self.stackinfo[len(self.stack) + 1]
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1218
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1219 def bgn_itemize(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1220 self.itemarg = args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1221 self.write('<UL>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1222 def end_itemize(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1223 self.itemarg = None
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1224 self.write('</UL>\n')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1225
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1226 def bgn_table(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1227 self.itemarg = args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1228 self.write('<DL>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1229 def end_table(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1230 self.itemarg = None
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1231 self.write('</DL>\n')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1232
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1233 def bgn_ftable(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1234 self.itemindex = 'fn'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1235 self.bgn_table(args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1236 def end_ftable(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1237 self.itemindex = None
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1238 self.end_table()
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1239
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1240 def do_item(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1241 if self.itemindex: self.index(self.itemindex, args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1242 if self.itemarg:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1243 if self.itemarg[0] == '@' and self.itemarg[1:2] and \
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1244 self.itemarg[1] in string.letters:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1245 args = self.itemarg + '{' + args + '}'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1246 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1247 # some other character, e.g. '-'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1248 args = self.itemarg + ' ' + args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1249 if self.itemnumber <> None:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1250 args = self.itemnumber + '. ' + args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1251 self.itemnumber = increment(self.itemnumber)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1252 if self.stack and self.stack[-1] == 'table':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1253 self.write('<DT>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1254 self.expand(args)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1255 self.write('\n<DD>')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1256 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1257 self.write('<LI>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1258 self.expand(args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1259 self.write(' ')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1260 do_itemx = do_item # XXX Should suppress leading blank line
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1261
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1262 # --- Enumerations, displays, quotations ---
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1263 # XXX Most of these should increase the indentation somehow
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1264
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1265 def bgn_quotation(self, args): self.write('<BLOCKQUOTE>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1266 def end_quotation(self): self.write('</BLOCKQUOTE>\n')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1267
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1268 def bgn_example(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1269 self.nofill = self.nofill + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1270 self.write('<PRE>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1271 def end_example(self):
4507
18927abdc262 (texi2html.py): Minor improvement to HTML 3.0 output for code examples.
Fred Drake <fdrake@acm.org>
parents: 4405
diff changeset
1272 self.write('</PRE>\n')
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1273 self.nofill = self.nofill - 1
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1274
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1275 bgn_lisp = bgn_example # Synonym when contents are executable lisp code
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1276 end_lisp = end_example
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1277
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1278 bgn_smallexample = bgn_example # XXX Should use smaller font
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1279 end_smallexample = end_example
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1280
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1281 bgn_smalllisp = bgn_lisp # Ditto
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1282 end_smalllisp = end_lisp
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1283
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1284 bgn_display = bgn_example
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1285 end_display = end_example
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1286
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1287 bgn_format = bgn_display
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1288 end_format = end_display
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1289
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1290 def do_exdent(self, args): self.expand(args + '\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1291 # XXX Should really mess with indentation
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1292
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1293 def bgn_flushleft(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1294 self.nofill = self.nofill + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1295 self.write('<PRE>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1296 def end_flushleft(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1297 self.write('</PRE>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1298 self.nofill = self.nofill - 1
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1299
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1300 def bgn_flushright(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1301 self.nofill = self.nofill + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1302 self.write('<ADDRESS COMPACT>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1303 def end_flushright(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1304 self.write('</ADDRESS>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1305 self.nofill = self.nofill - 1
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1306
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1307 def bgn_menu(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1308 self.write('<DIR>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1309 self.write(' <STRONG><EM>Menu</EM></STRONG><P>\n')
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1310 def end_menu(self):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1311 self.write('</DIR>\n')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1312
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1313 def bgn_cartouche(self, args): pass
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1314 def end_cartouche(self): pass
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1315
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1316 # --- Indices ---
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1317
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1318 def resetindex(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1319 self.noncodeindices = ['cp']
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1320 self.indextitle = {}
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1321 self.indextitle['cp'] = 'Concept'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1322 self.indextitle['fn'] = 'Function'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1323 self.indextitle['ky'] = 'Keyword'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1324 self.indextitle['pg'] = 'Program'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1325 self.indextitle['tp'] = 'Type'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1326 self.indextitle['vr'] = 'Variable'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1327 #
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1328 self.whichindex = {}
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1329 for name in self.indextitle.keys():
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1330 self.whichindex[name] = []
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1331
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1332 def user_index(self, name, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1333 if self.whichindex.has_key(name):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1334 self.index(name, args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1335 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1336 print '*** No index named', `name`
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1337
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1338 def do_cindex(self, args): self.index('cp', args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1339 def do_findex(self, args): self.index('fn', args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1340 def do_kindex(self, args): self.index('ky', args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1341 def do_pindex(self, args): self.index('pg', args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1342 def do_tindex(self, args): self.index('tp', args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1343 def do_vindex(self, args): self.index('vr', args)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1344
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1345 def index(self, name, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1346 self.whichindex[name].append(args, self.nodename)
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1347
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1348 def do_synindex(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1349 words = string.split(args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1350 if len(words) <> 2:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1351 print '*** bad @synindex', args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1352 return
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1353 [old, new] = words
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1354 if not self.whichindex.has_key(old) or \
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1355 not self.whichindex.has_key(new):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1356 print '*** bad key(s) in @synindex', args
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1357 return
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1358 if old <> new and \
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1359 self.whichindex[old] is not self.whichindex[new]:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1360 inew = self.whichindex[new]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1361 inew[len(inew):] = self.whichindex[old]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1362 self.whichindex[old] = inew
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1363 do_syncodeindex = do_synindex # XXX Should use code font
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1364
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1365 def do_printindex(self, args):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1366 words = string.split(args)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1367 for name in words:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1368 if self.whichindex.has_key(name):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1369 self.prindex(name)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1370 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1371 print '*** No index named', `name`
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1372
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1373 def prindex(self, name):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1374 iscodeindex = (name not in self.noncodeindices)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1375 index = self.whichindex[name]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1376 if not index: return
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1377 if self.debugging:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1378 print '--- Generating', self.indextitle[name], 'index'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1379 # The node already provides a title
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1380 index1 = []
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1381 junkprog = regex.compile('^\(@[a-z]+\)?{')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1382 for key, node in index:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1383 sortkey = string.lower(key)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1384 # Remove leading `@cmd{' from sort key
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1385 # -- don't bother about the matching `}'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1386 oldsortkey = sortkey
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1387 while 1:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1388 i = junkprog.match(sortkey)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1389 if i < 0: break
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1390 sortkey = sortkey[i:]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1391 index1.append(sortkey, key, node)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1392 del index[:]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1393 index1.sort()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1394 self.write('<DL COMPACT>\n')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1395 prevkey = prevnode = None
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1396 for sortkey, key, node in index1:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1397 if (key, node) == (prevkey, prevnode):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1398 continue
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1399 if self.debugging > 1: print key, ':', node
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1400 self.write('<DT>')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1401 if iscodeindex: key = '@code{' + key + '}'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1402 if key != prevkey:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1403 self.expand(key)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1404 self.write('\n<DD><A HREF="%s">%s</A>\n' % (makefile(node), node))
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1405 prevkey, prevnode = key, node
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1406 self.write('</DL>\n')
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1407
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1408 # --- Final error reports ---
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1409
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1410 def report(self):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1411 if self.unknown:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1412 print '--- Unrecognized commands ---'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1413 cmds = self.unknown.keys()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1414 cmds.sort()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1415 for cmd in cmds:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1416 print string.ljust(cmd, 20), self.unknown[cmd]
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1417
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1418
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1419 class TexinfoParserHTML3(TexinfoParser):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1420
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1421 COPYRIGHT_SYMBOL = "&copy;"
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1422 FN_ID_PATTERN = "[%(id)s]"
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1423 FN_SOURCE_PATTERN = '<A ID=footnoteref%(id)s ' \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1424 'HREF="#footnotetext%(id)s">' + FN_ID_PATTERN + '</A>'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1425 FN_TARGET_PATTERN = '<FN ID=footnotetext%(id)s>\n' \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1426 '<P><A HREF="#footnoteref%(id)s">' + FN_ID_PATTERN \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1427 + '</A>\n%(text)s</P></FN>\n'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1428 FN_HEADER = '<DIV CLASS=footnotes>\n <HR NOSHADE WIDTH=200>\n' \
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1429 ' <STRONG><EM>Footnotes</EM></STRONG>\n <P>\n'
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1430
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1431 Node = HTML3Node
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1432
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1433 def bgn_quotation(self, args): self.write('<BQ>')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1434 def end_quotation(self): self.write('</BQ>\n')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1435
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1436 def bgn_example(self, args):
4507
18927abdc262 (texi2html.py): Minor improvement to HTML 3.0 output for code examples.
Fred Drake <fdrake@acm.org>
parents: 4405
diff changeset
1437 # this use of <CODE> would not be legal in HTML 2.0,
18927abdc262 (texi2html.py): Minor improvement to HTML 3.0 output for code examples.
Fred Drake <fdrake@acm.org>
parents: 4405
diff changeset
1438 # but is in more recent DTDs.
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1439 self.nofill = self.nofill + 1
4507
18927abdc262 (texi2html.py): Minor improvement to HTML 3.0 output for code examples.
Fred Drake <fdrake@acm.org>
parents: 4405
diff changeset
1440 self.write('<PRE CLASS=example><CODE>')
18927abdc262 (texi2html.py): Minor improvement to HTML 3.0 output for code examples.
Fred Drake <fdrake@acm.org>
parents: 4405
diff changeset
1441 def end_example(self):
18927abdc262 (texi2html.py): Minor improvement to HTML 3.0 output for code examples.
Fred Drake <fdrake@acm.org>
parents: 4405
diff changeset
1442 self.write("</CODE></PRE>\n")
18927abdc262 (texi2html.py): Minor improvement to HTML 3.0 output for code examples.
Fred Drake <fdrake@acm.org>
parents: 4405
diff changeset
1443 self.nofill = self.nofill - 1
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1444
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1445 def bgn_flushleft(self, args):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1446 self.nofill = self.nofill + 1
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1447 self.write('<PRE CLASS=flushleft>\n')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1448
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1449 def bgn_flushright(self, args):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1450 self.nofill = self.nofill + 1
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1451 self.write('<DIV ALIGN=right CLASS=flushright><ADDRESS COMPACT>\n')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1452 def end_flushright(self):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1453 self.write('</ADDRESS></DIV>\n')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1454 self.nofill = self.nofill - 1
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1455
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1456 def bgn_menu(self, args):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1457 self.write('<UL PLAIN CLASS=menu>\n')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1458 self.write(' <LH>Menu</LH>\n')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1459 def end_menu(self):
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1460 self.write('</UL>\n')
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1461
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1462
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1463 # Put @var{} around alphabetic substrings
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1464 def makevar(str):
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1465 return '@var{'+str+'}'
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1466
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1467
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1468 # Split a string in "words" according to findwordend
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1469 def splitwords(str, minlength):
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1470 words = []
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1471 i = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1472 n = len(str)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1473 while i < n:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1474 while i < n and str[i] in ' \t\n': i = i+1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1475 if i >= n: break
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1476 start = i
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1477 i = findwordend(str, i, n)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1478 words.append(str[start:i])
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1479 while len(words) < minlength: words.append('')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1480 return words
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1481
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1482
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1483 # Find the end of a "word", matching braces and interpreting @@ @{ @}
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1484 fwprog = regex.compile('[@{} ]')
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1485 def findwordend(str, i, n):
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1486 level = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1487 while i < n:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1488 i = fwprog.search(str, i)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1489 if i < 0: break
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1490 c = str[i]; i = i+1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1491 if c == '@': i = i+1 # Next character is not special
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1492 elif c == '{': level = level+1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1493 elif c == '}': level = level-1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1494 elif c == ' ' and level <= 0: return i-1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1495 return n
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1496
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1497
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1498 # Convert a node name into a file name
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1499 def makefile(nodename):
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1500 return fixfunnychars(nodename) + '.html'
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1501
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1502
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1503 # Characters that are perfectly safe in filenames and hyperlinks
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1504 goodchars = string.letters + string.digits + '!@-=+.'
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1505
3016
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1506 # Replace characters that aren't perfectly safe by dashes
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1507 # Underscores are bad since Cern HTTPD treats them as delimiters for
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1508 # encoding times, so you get mismatches if you compress your files:
7ae332472629 many fixes by anonymous contributor
Guido van Rossum <guido@python.org>
parents: 2705
diff changeset
1509 # a.html.gz will map to a_b.html.gz
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1510 def fixfunnychars(addr):
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1511 i = 0
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1512 while i < len(addr):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1513 c = addr[i]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1514 if c not in goodchars:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1515 c = '-'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1516 addr = addr[:i] + c + addr[i+1:]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1517 i = i + len(c)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1518 return addr
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1519
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1520
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1521 # Increment a string used as an enumeration
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1522 def increment(s):
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1523 if not s:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1524 return '1'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1525 for sequence in string.digits, string.lowercase, string.uppercase:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1526 lastc = s[-1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1527 if lastc in sequence:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1528 i = string.index(sequence, lastc) + 1
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1529 if i >= len(sequence):
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1530 if len(s) == 1:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1531 s = sequence[0]*2
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1532 if s == '00':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1533 s = '10'
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1534 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1535 s = increment(s[:-1]) + sequence[0]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1536 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1537 s = s[:-1] + sequence[i]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1538 return s
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1539 return s # Don't increment
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1540
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1541
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1542 def test():
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1543 import sys
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1544 debugging = 0
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1545 print_headers = 0
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1546 cont = 0
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1547 html3 = 0
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1548
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1549 while sys.argv[1:2] == ['-d']:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1550 debugging = debugging + 1
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1551 del sys.argv[1:2]
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1552 if sys.argv[1] == '-p':
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1553 print_headers = 1
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1554 del sys.argv[1]
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1555 if sys.argv[1] == '-c':
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1556 cont = 1
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1557 del sys.argv[1]
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1558 if sys.argv[1] == '-3':
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1559 html3 = 1
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1560 del sys.argv[1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1561 if len(sys.argv) <> 3:
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1562 print 'usage: texi2html [-d [-d]] [-p] [-c] inputfile outputdirectory'
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1563 sys.exit(2)
4392
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1564
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1565 if html3:
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1566 parser = TexinfoParserHTML3()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1567 else:
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1568 parser = TexinfoParser()
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1569 parser.cont = cont
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1570 parser.debugging = debugging
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1571 parser.print_headers = print_headers
72a0cfda2004 (texi2html.py): Tightened the generated HTML slightly. Added -p option to
Fred Drake <fdrake@acm.org>
parents: 4307
diff changeset
1572
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1573 file = sys.argv[1]
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1574 parser.setdirname(sys.argv[2])
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1575 if file == '-':
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1576 fp = sys.stdin
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1577 else:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1578 parser.setincludedir(os.path.dirname(file))
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1579 try:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1580 fp = open(file, 'r')
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1581 except IOError, msg:
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1582 print file, ':', msg
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1583 sys.exit(1)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1584 parser.parse(fp)
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1585 fp.close()
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1586 parser.report()
2551
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1587
c55dddbfcf7c new, from ../Demo/www
Guido van Rossum <guido@python.org>
parents:
diff changeset
1588
4307
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1589 if __name__ == "__main__":
2eec35e2afff (texi2html.py): Use "if __name__ == '__main__':" test. Adjust indentation
Fred Drake <fdrake@acm.org>
parents: 3998
diff changeset
1590 test()