Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8335 | maxcodehac | 1 | |
2 | GNU UnRTF, a command-line program to convert RTF documents to other formats. |
||
3 | Copyright (C) 2000,2001 Zachary Thayer Smith |
||
4 | |||
5 | |||
6 | it under the terms of the GNU General Public License as published by |
||
7 | the Free Software Foundation; either version 2 of the License, or |
||
8 | (at your option) any later version. |
||
9 | |||
10 | |||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | GNU General Public License for more details. |
||
14 | |||
15 | |||
16 | along with this program; if not, write to the Free Software |
||
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
18 | |||
19 | |||
20 | =============================================================================*/ |
||
21 | |||
22 | |||
23 | |||
24 | * Module name: html |
||
25 | * Author name: Zach Smith |
||
26 | * Create date: 18 Sep 01 |
||
27 | * Purpose: HTML-specific output module |
||
28 | *---------------------------------------------------------------------- |
||
29 | * Changes: |
||
30 | * 01 Aug 01, tuorfa@yahoo.com: code moved over from convert.c |
||
31 | * 03 Aug 01, tuorfa@yahoo.com: removed null entries to save space |
||
32 | * 08 Aug 01, tuorfa@yahoo.com, gommer@gmx.net: fixed/added some ANSI chars |
||
33 | * 18 Sep 01, tuorfa@yahoo.com: moved character sets into html.c etc |
||
34 | * 22 Sep 01, tuorfa@yahoo.com: added function-level comment blocks |
||
35 | *--------------------------------------------------------------------*/ |
||
36 | |||
37 | |||
38 | |||
39 | #include |
||
40 | #include "malloc.h" |
||
41 | #include "defs.h" |
||
42 | #include "error.h" |
||
43 | #include "main.h" |
||
44 | #include "output.h" |
||
45 | |||
46 | |||
47 | |||
48 | /* 0x20 */ " ", "!", "\"", "#", "$", "%", "&", "'", |
||
49 | /* 0x28 */ "(", ")", "*", "+", ",", "-", ".", "/", |
||
50 | /* 0x30 */ "0", "1", "2", "3", "4", "5", "6", "7", |
||
51 | /* 0x38 */ "8", "9", ":", ";", "<", "=", ">", "?", |
||
52 | /* 0x40 */ "@", "A", "B", "C", "D", "E", "F", "G", |
||
53 | /* 0x48 */ "H", "I", "J", "K", "L", "M", "N", "O", |
||
54 | /* 0x50 */ "P", "Q", "R", "S", "T", "U", "V", "W", |
||
55 | /* 0x58 */ "X", "Y", "Z", "[", "\\", "]", "^", "_", |
||
56 | /* 0x60 */ "`", "a", "b", "c", "d", "e", "f", "g", |
||
57 | /* 0x68 */ "h", "i", "j", "k", "l", "m", "n", "o", |
||
58 | /* 0x70 */ "p", "q", "r", "s", "t", "u", "v", "w", |
||
59 | /* 0x78 */ "x", "y", "z", "{", "|", "}", "~", "", |
||
60 | }; |
||
61 | |||
62 | |||
63 | |||
64 | /* 0x82 */ "‚", "ƒ", |
||
65 | "„", "…", "†", "‡", |
||
66 | "ˆ", "‰", "Š", "‹", |
||
67 | "Œ", NULL, NULL, NULL, |
||
68 | /* 0x90 */ NULL,"`","'","``","''","•","–","—", |
||
69 | /* 0x98 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
||
70 | /* 0xa0 */ " ","¡","¢","£","¤","¥","¦","§", |
||
71 | /* 0xa8 */ "¨","©","ª","«","¬","","®","¯", |
||
72 | /* 0xb0 */ "°", "±","²","³","´","µ","¶","·", |
||
73 | /* 0xb8 */ "¸","¹", "º","»", "¼", "½","¾","¿", |
||
74 | /* 0xc0 */ "À","Á","Â","Ã","Ä","Å","Æ","Ç", |
||
75 | /* 0xc8 */ "È","É","Ê","Ë","Ì","Í","Î","Ï", |
||
76 | /* 0xd0 */ "Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×", |
||
77 | /* 0xd8 */ "Ø","Ù","Ú","Û","Ü","Ý","Þ","ß", |
||
78 | /* 0xe0 */ "à","á","â","ã","ä","å","æ","ç", |
||
79 | /* 0xe8 */ "è","é","ê","ë","ì","í","î","ï", |
||
80 | /* 0xf0 */ "ð","ñ","ò","ó","ô","õ","ö","÷", |
||
81 | /* 0xf8 */ "ø","ù","ú","û","ü","ý","þ","ÿ", |
||
82 | }; |
||
83 | |||
84 | |||
85 | /* 0xa4 */ "•", NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
||
86 | /* 0xb0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
||
87 | /* 0xc0 */ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, |
||
88 | /* 0xd0 */ "—","–","“","”","&lquo;","&rquo;", |
||
89 | }; |
||
90 | |||
91 | |||
92 | /* 0x80 */ "ç", |
||
93 | /* 0x81 */ "ü", |
||
94 | /* 0x82 */ "é", |
||
95 | /* 0x83 */ "â", |
||
96 | /* 0x84 */ "ä", |
||
97 | /* 0x85 */ "à", |
||
98 | /* 0x86 */ "å", |
||
99 | /* 0x87 */ "ç", |
||
100 | /* 0x88 */ "ê", |
||
101 | /* 0x89 */ "ë", |
||
102 | /* 0x8a */ "è", |
||
103 | /* 0x8b */ "ï", |
||
104 | /* 0x8c */ "î", |
||
105 | /* 0x8d */ "ì", |
||
106 | /* 0x8e */ "ä", |
||
107 | /* 0x8f */ "å", |
||
108 | /* 0x90 */ "é", |
||
109 | /* 0x91 */ "æ", |
||
110 | /* 0x92 */ "æ", |
||
111 | /* 0x93 */ "ô", |
||
112 | /* 0x94 */ "ö", |
||
113 | /* 0x95 */ "ò", |
||
114 | /* 0x96 */ "û", |
||
115 | /* 0x97 */ "ù", |
||
116 | /* 0x98 */ "ÿ", |
||
117 | /* 0x99 */ "ö", |
||
118 | /* 0x9a */ "ü", |
||
119 | /* 0x9b */ "¢", |
||
120 | /* 0x9c */ "£", |
||
121 | /* 0x9d */ "¥", |
||
122 | /* 0x9e */ "₧", /* peseta */ |
||
123 | /* 0x9f */ "ƒ", /* small f with hook */ |
||
124 | /* 0xa0 */ "á", |
||
125 | /* 0xa1 */ "í", |
||
126 | /* 0xa2 */ "ó", |
||
127 | /* 0xa3 */ "ú", |
||
128 | /* 0xa4 */ "ñ", |
||
129 | /* 0xa5 */ "ñ", |
||
130 | /* 0xa6 */ "ª", |
||
131 | /* 0xa7 */ "¼", |
||
132 | /* 0xa8 */ "¿", |
||
133 | /* 0xa9 */ "⌐", /* reversed not */ |
||
134 | /* 0xaa */ "¬", |
||
135 | /* 0xab */ "½", |
||
136 | /* 0xac */ "»", |
||
137 | /* 0xad */ "¡", |
||
138 | /* 0xae */ "«", |
||
139 | /* 0xaf */ "º", |
||
140 | /* 0xb0 */ "░", /* light shade */ |
||
141 | /* 0xb1 */ "▒", /* med. shade */ |
||
142 | /* 0xb2 */ "▓", /* dark shade */ |
||
143 | /* 0xb3 */ "│", /* box-draw light vert. */ |
||
144 | /* 0xb4 */ "┤", /* box-draw light vert. + lt. */ |
||
145 | /* 0xb5 */ "╡", /* box-draw vert. sgl. + lt. dbl. */ |
||
146 | /* 0xb6 */ "╢", /* box-draw vert. dbl. + lt. sgl. */ |
||
147 | /* 0xb7 */ "╖", /* box-draw dn. dbl. + lt. sgl. */ |
||
148 | /* 0xb8 */ "╕", /* box-draw dn. sgl. + lt. dbl. */ |
||
149 | /* 0xb9 */ "╣", /* box-draw dbl. vert. + lt. */ |
||
150 | /* 0xba */ "║", /* box-draw dbl. vert. */ |
||
151 | /* 0xbb */ "╗", /* box-draw dbl. dn. + lt. */ |
||
152 | /* 0xbc */ "╝", /* box-draw dbl. up + lt. */ |
||
153 | /* 0xbd */ "╜", /* box-draw up dbl. + lt. sgl. */ |
||
154 | /* 0xbe */ "╛", /* box-draw up sgl. + lt. dbl. */ |
||
155 | /* 0xbf */ "┐", /* box-draw light dn. + lt. */ |
||
156 | /* 0xc0 */ "└", /* box-draw light up + rt. */ |
||
157 | /* 0xc1 */ "┴", /* box-draw light up + horiz. */ |
||
158 | /* 0xc2 */ "┬", /* box-draw light dn. + horiz. */ |
||
159 | /* 0xc3 */ "├", /* box-draw light vert. + rt. */ |
||
160 | /* 0xc4 */ "─", /* box-draw light horiz. */ |
||
161 | /* 0xc5 */ "┼", /* box-draw light vert. + horiz. */ |
||
162 | /* 0xc6 */ "╞", /* box-draw vert. sgl. + rt. dbl. */ |
||
163 | /* 0xc7 */ "╟", /* box-draw vert. dbl. + rt. sgl. */ |
||
164 | /* 0xc8 */ "╚", /* box-draw dbl. up + rt. */ |
||
165 | /* 0xc9 */ "╔", /* box-draw dbl. dn. + rt. */ |
||
166 | /* 0xca */ "╩", /* box-draw dbl. up + horiz. */ |
||
167 | /* 0xcb */ "╦", /* box-draw dbl. dn. + horiz. */ |
||
168 | /* 0xcc */ "╠", /* box-draw dbl. vert. + rt. */ |
||
169 | /* 0xcd */ "═", /* box-draw dbl. horiz. */ |
||
170 | /* 0xce */ "╬", /* box-draw dbl. vert. + horiz. */ |
||
171 | /* 0xcf */ "╧", /* box-draw up sgl. + horiz. dbl. */ |
||
172 | /* 0xd0 */ "╨", /* box-draw up dbl. + horiz. sgl. */ |
||
173 | /* 0xd1 */ "╤", /* box-draw dn. sgl. + horiz. dbl. */ |
||
174 | /* 0xd2 */ "╥", /* box-draw dn. dbl. + horiz. sgl. */ |
||
175 | /* 0xd3 */ "╙", /* box-draw up dbl. + rt. sgl. */ |
||
176 | /* 0xd4 */ "╘", /* box-draw up sgl. + rt. dbl. */ |
||
177 | /* 0xd5 */ "╒", /* box-draw dn. sgl. + rt. dbl. */ |
||
178 | /* 0xd6 */ "╓", /* box-draw dn. dbl. + rt. sgl. */ |
||
179 | /* 0xd7 */ "╫", /* box-draw vert. dbl. + horiz. sgl. */ |
||
180 | /* 0xd8 */ "╪", /* box-draw vert. sgl. + horiz. dbl. */ |
||
181 | /* 0xd9 */ "┘", /* box-draw light up + lt. */ |
||
182 | /* 0xda */ "┌", /* box-draw light dn. + rt. */ |
||
183 | /* 0xdb */ "█", /* full block */ |
||
184 | /* 0xdc */ "▄", /* lower 1/2 block */ |
||
185 | /* 0xdd */ "▌", /* lt. 1/2 block */ |
||
186 | /* 0xde */ "▐", /* rt. 1/2 block */ |
||
187 | /* 0xdf */ "▀", /* upper 1/2 block */ |
||
188 | /* 0xe0 */ "α", /* greek small alpha */ |
||
189 | /* 0xe1 */ "ß", |
||
190 | /* 0xe2 */ "Γ", /* greek cap gamma */ |
||
191 | /* 0xe3 */ "π", /* greek small pi */ |
||
192 | /* 0xe4 */ "Σ", /* greek cap sigma */ |
||
193 | /* 0xe5 */ "σ", /* greek small sigma */ |
||
194 | /* 0xe6 */ "µ", |
||
195 | /* 0xe7 */ "τ", /* greek small tau */ |
||
196 | /* 0xe8 */ "Φ", /* greek cap phi */ |
||
197 | /* 0xe9 */ "Θ", /* greek cap theta */ |
||
198 | /* 0xea */ "Ω", /* greek cap omega */ |
||
199 | /* 0xeb */ "δ", /* greek small delta */ |
||
200 | /* 0xec */ "∞", /* inf. */ |
||
201 | /* 0xed */ "φ", /* greek small phi */ |
||
202 | /* 0xee */ "ε", /* greek small epsilon */ |
||
203 | /* 0xef */ "∩", /* intersect */ |
||
204 | /* 0xf0 */ "≡", /* identical */ |
||
205 | /* 0xf1 */ "±", |
||
206 | /* 0xf2 */ "≥", /* greater-than or equal to */ |
||
207 | /* 0xf3 */ "≤", /* less-than or equal to */ |
||
208 | /* 0xf4 */ "⌠", /* top 1/2 integral */ |
||
209 | /* 0xf5 */ "⌡", /* bottom 1/2 integral */ |
||
210 | /* 0xf6 */ "÷", |
||
211 | /* 0xf7 */ "≈", /* almost = */ |
||
212 | /* 0xf8 */ "+", |
||
213 | /* 0xf9 */ "∙", /* bullet op */ |
||
214 | /* 0xfa */ "·", |
||
215 | /* 0xfb */ "√", /* sqrt */ |
||
216 | /* 0xfc */ "ⁿ", /* super-script small n */ |
||
217 | /* 0xfd */ "²", |
||
218 | /* 0xfe */ "■", /* black square */ |
||
219 | /* 0xff */ " ", |
||
220 | }; |
||
221 | |||
222 | |||
223 | /* 0x80 */ "ç", |
||
224 | /* 0x81 */ "ü", |
||
225 | /* 0x82 */ "é", |
||
226 | /* 0x83 */ "â", |
||
227 | /* 0x84 */ "ä", |
||
228 | /* 0x85 */ "à", |
||
229 | /* 0x86 */ "å", |
||
230 | /* 0x87 */ "ç", |
||
231 | /* 0x88 */ "ê", |
||
232 | /* 0x89 */ "ë", |
||
233 | /* 0x8a */ "è", |
||
234 | /* 0x8b */ "ï", |
||
235 | /* 0x8c */ "î", |
||
236 | /* 0x8d */ "ì", |
||
237 | /* 0x8e */ "ä", |
||
238 | /* 0x8f */ "å", |
||
239 | /* 0x90 */ "é", |
||
240 | /* 0x91 */ "æ", |
||
241 | /* 0x92 */ "æ", |
||
242 | /* 0x93 */ "ô", |
||
243 | /* 0x94 */ "ö", |
||
244 | /* 0x95 */ "ò", |
||
245 | /* 0x96 */ "û", |
||
246 | /* 0x97 */ "ù", |
||
247 | /* 0x98 */ "ÿ", |
||
248 | /* 0x99 */ "ö", |
||
249 | /* 0x9a */ "ü", |
||
250 | /* 0x9b */ "ø", |
||
251 | /* 0x9c */ "£", |
||
252 | /* 0x9d */ "ø", |
||
253 | /* 0x9e */ "×", |
||
254 | /* 0x9f */ "ƒ", /* small f with hook */ |
||
255 | /* 0xa0 */ "á", |
||
256 | /* 0xa1 */ "í", |
||
257 | /* 0xa2 */ "ó", |
||
258 | /* 0xa3 */ "ú", |
||
259 | /* 0xa4 */ "ñ", |
||
260 | /* 0xa5 */ "ñ", |
||
261 | /* 0xa6 */ "ª", |
||
262 | /* 0xa7 */ "¼", |
||
263 | /* 0xa8 */ "¿", |
||
264 | /* 0xa9 */ "®", |
||
265 | /* 0xaa */ "¬", |
||
266 | /* 0xab */ "½", |
||
267 | /* 0xac */ "»", |
||
268 | /* 0xad */ "¡", |
||
269 | /* 0xae */ "«", |
||
270 | /* 0xaf */ "º", |
||
271 | /* 0xb0 */ "░", /* light shade */ |
||
272 | /* 0xb1 */ "▒", /* med. shade */ |
||
273 | /* 0xb2 */ "▓", /* dark shade */ |
||
274 | /* 0xb3 */ "│", /* box-draw light vert. */ |
||
275 | /* 0xb4 */ "┤", /* box-draw light vert. + lt. */ |
||
276 | /* 0xb5 */ "á", |
||
277 | /* 0xb6 */ "â", |
||
278 | /* 0xb7 */ "à", |
||
279 | /* 0xb8 */ "©", |
||
280 | /* 0xb9 */ "╣", /* box-draw dbl. vert. + lt. */ |
||
281 | /* 0xba */ "║", /* box-draw dbl. vert. */ |
||
282 | /* 0xbb */ "╗", /* box-draw dbl. dn. + lt. */ |
||
283 | /* 0xbc */ "╝", /* box-draw dbl. up + lt. */ |
||
284 | /* 0xbd */ "¢", |
||
285 | /* 0xbe */ "¥", |
||
286 | /* 0xbf */ "┐", /* box-draw light dn. + lt. */ |
||
287 | /* 0xc0 */ "└", /* box-draw light up + rt. */ |
||
288 | /* 0xc1 */ "┴", /* box-draw light up + horiz. */ |
||
289 | /* 0xc2 */ "┬", /* box-draw light dn. + horiz. */ |
||
290 | /* 0xc3 */ "├", /* box-draw light vert. + rt. */ |
||
291 | /* 0xc4 */ "─", /* box-draw light horiz. */ |
||
292 | /* 0xc5 */ "┼", /* box-draw light vert. + horiz. */ |
||
293 | /* 0xc6 */ "ã", |
||
294 | /* 0xc7 */ "ã", |
||
295 | /* 0xc8 */ "╚", /* box-draw dbl. up + rt. */ |
||
296 | /* 0xc9 */ "╔", /* box-draw dbl. dn. + rt. */ |
||
297 | /* 0xca */ "╩", /* box-draw dbl. up + horiz. */ |
||
298 | /* 0xcb */ "╦", /* box-draw dbl. dn. + horiz. */ |
||
299 | /* 0xcc */ "╠", /* box-draw dbl. vert. + rt. */ |
||
300 | /* 0xcd */ "═", /* box-draw dbl. horiz. */ |
||
301 | /* 0xce */ "╬", /* box-draw dbl. vert. + horiz. */ |
||
302 | /* 0xcf */ "¤", |
||
303 | /* 0xd0 */ "ð", |
||
304 | /* 0xd1 */ "ð", |
||
305 | /* 0xd2 */ "ê", |
||
306 | /* 0xd3 */ "ë", |
||
307 | /* 0xd4 */ "è", |
||
308 | /* 0xd5 */ "ı", /* small dotless i */ |
||
309 | /* 0xd6 */ "í", |
||
310 | /* 0xd7 */ "î", |
||
311 | /* 0xd8 */ "ï", |
||
312 | /* 0xd9 */ "┘", /* box-draw light up + lt. */ |
||
313 | /* 0xda */ "┌", /* box-draw light dn. + rt. */ |
||
314 | /* 0xdb */ "█", /* full-block */ |
||
315 | /* 0xdc */ "▄", /* lower 1/2 block */ |
||
316 | /* 0xdd */ "¦", |
||
317 | /* 0xde */ "ì", |
||
318 | /* 0xdf */ "▀", /* upper 1/2 block */ |
||
319 | /* 0xe0 */ "ó", |
||
320 | /* 0xe1 */ "ß", |
||
321 | /* 0xe2 */ "ô", |
||
322 | /* 0xe3 */ "ò", |
||
323 | /* 0xe4 */ "õ", |
||
324 | /* 0xe5 */ "õ", |
||
325 | /* 0xe6 */ "µ", |
||
326 | /* 0xe7 */ "þ", |
||
327 | /* 0xe8 */ "þ", |
||
328 | /* 0xe9 */ "ú", |
||
329 | /* 0xea */ "û", |
||
330 | /* 0xeb */ "ù", |
||
331 | /* 0xec */ "ý", |
||
332 | /* 0xed */ "ý", |
||
333 | /* 0xee */ "¯", |
||
334 | /* 0xef */ "´", |
||
335 | /* 0xf0 */ "", |
||
336 | /* 0xf1 */ "±", |
||
337 | /* 0xf2 */ "‗", /* dbl. lowline */ |
||
338 | /* 0xf3 */ "¾", |
||
339 | /* 0xf4 */ "¶", |
||
340 | /* 0xf5 */ "§", |
||
341 | /* 0xf6 */ "÷", |
||
342 | /* 0xf7 */ "¸", |
||
343 | /* 0xf8 */ "+", |
||
344 | /* 0xf9 */ "¨", |
||
345 | /* 0xfa */ "·", |
||
346 | /* 0xfb */ "¹", |
||
347 | /* 0xfc */ "³", |
||
348 | /* 0xfd */ "²", |
||
349 | /* 0xfe */ "■", /* black square */ |
||
350 | /* 0xff */ " ", |
||
351 | }; |
||
352 | |||
353 | |||
354 | |||
355 | |||
356 | |||
357 | * Name: html_init |
||
358 | * Purpose: Generates the HTML output personality. |
||
359 | * Args: None. |
||
360 | * Returns: OutputPersonality. |
||
361 | *=======================================================================*/ |
||
362 | |||
363 | |||
364 | html_init (void) |
||
365 | { |
||
366 | OutputPersonality* op; |
||
367 | |||
368 | |||
369 | |||
370 | |||
371 | op->comment_end = " --->\n"; |
||
372 | |||
373 | |||
374 | op->document_end = " |