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