/[public]/psiconv/trunk/program/psiconv/gen_xhtml.c
ViewVC logotype

Contents of /psiconv/trunk/program/psiconv/gen_xhtml.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 191 - (show annotations)
Wed Jan 28 20:18:54 2004 UTC (16 years, 10 months ago) by frodo
File MIME type: text/plain
File size: 23415 byte(s)
(Frodo) XHTML output complete

1 /* gen_html.c - Part of psiconv, a PSION 5 file formats converter
2 Copyright (c) 1999-2004 Frodo Looijaard <frodol@dds.nl>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19 #include "config.h"
20
21 #include <psiconv/configuration.h>
22 #include <psiconv/data.h>
23 #include "general.h"
24
25 #include <string.h>
26 #include <stdlib.h>
27
28 #ifdef DMALLOC
29 #include "dmalloc.h"
30 #endif
31
32 #define TEMPSTR_LEN 100
33
34 void text(const psiconv_config config,psiconv_list list,
35 psiconv_string_t data,const encoding enc)
36 {
37 int i;
38 for (i = 0; i < psiconv_unicode_strlen(data); i++) {
39 if ((data[i] == 0x06) || (data[i] == 0x07) || (data[i] == 0x08))
40 output_simple_chars(config,list,"<br/>",enc);
41 else if ((data[i] == 0x0b) || (data[i] == 0x0c))
42 output_simple_chars(config,list,"-",enc);
43 else if (data[i] == 0x0f)
44 output_simple_chars(config,list," ",enc);
45 else if (data[i] >= 0x20)
46 output_char(config,list,data[i],enc);
47 }
48 }
49
50 void color(const psiconv_config config, psiconv_list list,
51 psiconv_color color,int may_be_transparant, const encoding enc)
52 {
53 char tempstr[TEMPSTR_LEN];
54 if (may_be_transparant &&
55 (color->red == 0xff) &&
56 (color->blue == 0xff) &&
57 (color->green == 0xff))
58 output_simple_chars(config,list,"transparant",enc);
59 else {
60 snprintf(tempstr,TEMPSTR_LEN,"rgb(%d,%d,%d)",
61 color->red,
62 color->green,
63 color->blue);
64 output_simple_chars(config,list,tempstr,enc);
65 }
66 }
67
68 void border(const psiconv_config config, psiconv_list list,
69 psiconv_border_kind_t border,const encoding enc)
70 {
71 output_simple_chars(config,list,
72 border == psiconv_border_none?"none":
73 border == psiconv_border_solid?"solid":
74 border == psiconv_border_double?"double":
75 border == psiconv_border_dotted?"dotted":
76 border == psiconv_border_dashed?"dashed":
77 border == psiconv_border_dotdashed?"dashed":
78 border == psiconv_border_dotdotdashed?"dashed":"",enc);
79 }
80
81 void style_name(const psiconv_config config, psiconv_list list,
82 const psiconv_string_t name,const encoding enc)
83 {
84 psiconv_string_t name_copy;
85 int i;
86
87 if (!name)
88 return;
89
90 if (!(name_copy = psiconv_unicode_strdup(name))) {
91 fputs("Out of memory error\n",stderr);
92 exit(1);
93 }
94 for (i = 0; i < psiconv_unicode_strlen(name_copy); i++) {
95 if ((name_copy[i] < 0x21) ||
96 ((name_copy[i] >= 0x7f) && name_copy[i] <= 0xa0))
97 name_copy[i] = '_';
98 }
99 output_string(config,list,name_copy,enc);
100 free(name_copy);
101 }
102
103 void character_layout_diffs(const psiconv_config config, psiconv_list list,
104 const psiconv_character_layout new,
105 const psiconv_character_layout base,
106 const encoding enc)
107 {
108 char tempstr[TEMPSTR_LEN];
109
110 if (!base || (new->color->red != base->color->red) ||
111 (new->color->green != base->color->green) ||
112 (new->color->blue != base->color->blue)) {
113 output_simple_chars(config,list,"color:",enc);
114 color(config,list,new->color,0,enc);
115 output_simple_chars(config,list,";",enc);
116 }
117
118 if (!base || (new->back_color->red != base->back_color->red) ||
119 (new->back_color->green != base->back_color->green) ||
120 (new->back_color->blue != base->back_color->blue)) {
121 output_simple_chars(config,list,"background-color:",enc);
122 color(config,list,new->back_color,1,enc);
123 output_simple_chars(config,list,";",enc);
124 }
125
126 if (!base || (new->font_size != base->font_size)) {
127 output_simple_chars(config,list,"font-size:",enc);
128 snprintf(tempstr,TEMPSTR_LEN,"%f",new->font_size);
129 output_simple_chars(config,list,tempstr,enc);
130 output_simple_chars(config,list,"pt;",enc);
131 }
132
133 if (!base || (new->italic != base->italic)) {
134 output_simple_chars(config,list,"font-style:",enc);
135 output_simple_chars(config,list,new->italic?"italic":"normal",enc);
136 output_simple_chars(config,list,";",enc);
137 }
138 if (!base || (new->bold != base->bold)) {
139 output_simple_chars(config,list,"font-weight:",enc);
140 output_simple_chars(config,list,new->bold?"bold":"normal",enc);
141 output_simple_chars(config,list,";",enc);
142 }
143 if (!base || (new->super_sub != base->super_sub)) {
144 output_simple_chars(config,list,"font-style:",enc);
145 output_simple_chars(config,list,
146 new->super_sub==psiconv_superscript?"super":
147 new->super_sub==psiconv_subscript?"sub":
148 "normal",enc);
149 output_simple_chars(config,list,";",enc);
150 }
151 if (!base || (new->underline != base->underline) ||
152 (new->strikethrough != base->strikethrough)) {
153 output_simple_chars(config,list,"text-decoration:",enc);
154 output_simple_chars(config,list,new->underline?"underline":
155 new->strikethrough?"line-through":
156 "none",enc);
157 output_simple_chars(config,list,";",enc);
158 }
159 if (!base || (new->font->screenfont != base->font->screenfont)) {
160 output_simple_chars(config,list,"font-family:",enc);
161 output_simple_chars(config,list,
162 new->font->screenfont == psiconv_font_serif?"serif":
163 new->font->screenfont == psiconv_font_sansserif?"sans-serif":
164 new->font->screenfont == psiconv_font_nonprop?"monospace":
165 new->font->screenfont == psiconv_font_misc?"fantasy":"",
166 enc);
167 }
168 }
169
170 void paragraph_layout_diffs(const psiconv_config config, psiconv_list list,
171 const psiconv_paragraph_layout new,
172 const psiconv_paragraph_layout base,
173 const encoding enc)
174 {
175 char tempstr[TEMPSTR_LEN];
176 float pad_left_base=0.0,pad_left_new,text_indent_base=0.0,text_indent_new;
177
178 if (new->bullet->on) {
179 pad_left_new = new->indent_left < new->indent_first?
180 new->indent_left:new->indent_first;
181 text_indent_new = 0.0;
182 } else {
183 pad_left_new = new->indent_left;
184 text_indent_new = new->indent_first;
185 }
186 if (base) {
187 if (base->bullet->on) {
188 pad_left_base = base->indent_left < base->indent_first?
189 base->indent_left:base->indent_first;
190 text_indent_base = 0.0;
191 } else {
192 pad_left_base = base->indent_left;
193 text_indent_base = base->indent_first;
194 }
195 }
196
197
198 if (!base || (new->back_color->red != base->back_color->red) ||
199 (new->back_color->green != base->back_color->green) ||
200 (new->back_color->blue != base->back_color->blue)) {
201 output_simple_chars(config,list,"background-color:",enc);
202 color(config,list,new->back_color,1,enc);
203 output_simple_chars(config,list,";",enc);
204 }
205
206 if (!base || (pad_left_new != pad_left_base)) {
207 output_simple_chars(config,list,"padding-left:",enc);
208 snprintf(tempstr,TEMPSTR_LEN,"%f",pad_left_new);
209 output_simple_chars(config,list,tempstr,enc);
210 output_simple_chars(config,list,"cm;",enc);
211 }
212
213 if (!base || (new->indent_right != base->indent_right)) {
214 output_simple_chars(config,list,"padding-right:",enc);
215 snprintf(tempstr,TEMPSTR_LEN,"%f",new->indent_right);
216 output_simple_chars(config,list,tempstr,enc);
217 output_simple_chars(config,list,"cm;",enc);
218 }
219
220 if (!base || (text_indent_new != text_indent_base)) {
221 output_simple_chars(config,list,"text-indent:",enc);
222 snprintf(tempstr,TEMPSTR_LEN,"%f",text_indent_new);
223 output_simple_chars(config,list,tempstr,enc);
224 output_simple_chars(config,list,"cm;",enc);
225 }
226
227 if (!base || (new->justify_hor != base ->justify_hor)) {
228 output_simple_chars(config,list,"font-style:",enc);
229 output_simple_chars(config,list,
230 new->justify_hor==psiconv_justify_left?"left":
231 new->justify_hor==psiconv_justify_centre?"center":
232 new->justify_hor==psiconv_justify_right?"right":
233 new->justify_hor==psiconv_justify_full?"justify":
234 "",enc);
235 output_simple_chars(config,list,";",enc);
236 }
237
238 if (!base || (new->linespacing != base->linespacing)) {
239 output_simple_chars(config,list,"line-height:",enc);
240 snprintf(tempstr,TEMPSTR_LEN,"%f",new->linespacing);
241 output_simple_chars(config,list,tempstr,enc);
242 output_simple_chars(config,list,"pt;",enc);
243 }
244
245 if (!base || (new->space_above != base->space_above)) {
246 output_simple_chars(config,list,"padding-top:",enc);
247 snprintf(tempstr,TEMPSTR_LEN,"%f",new->space_above);
248 output_simple_chars(config,list,tempstr,enc);
249 output_simple_chars(config,list,"pt;",enc);
250 }
251
252 if (!base || (new->space_below != base->space_below)) {
253 output_simple_chars(config,list,"padding-bottom:",enc);
254 snprintf(tempstr,TEMPSTR_LEN,"%f",new->space_below);
255 output_simple_chars(config,list,tempstr,enc);
256 output_simple_chars(config,list,"pt;",enc);
257 }
258
259 if (!base || (new->right_border->kind != base->right_border->kind)) {
260 output_simple_chars(config,list,"border-right-style:",enc);
261 border(config,list,new->right_border->kind,enc);
262 output_simple_chars(config,list,";",enc);
263 }
264 if (!base || (new->bottom_border->kind != base->bottom_border->kind)) {
265 output_simple_chars(config,list,"border-bottom-style:",enc);
266 border(config,list,new->bottom_border->kind,enc);
267 output_simple_chars(config,list,";",enc);
268 }
269 if (!base || (new->top_border->kind != base->top_border->kind)) {
270 output_simple_chars(config,list,"border-top-style:",enc);
271 border(config,list,new->top_border->kind,enc);
272 output_simple_chars(config,list,";",enc);
273 }
274 if (!base || (new->left_border->kind != base->left_border->kind)) {
275 output_simple_chars(config,list,"border-left-style:",enc);
276 border(config,list,new->left_border->kind,enc);
277 output_simple_chars(config,list,";",enc);
278 }
279
280 if (!base ||
281 ((new->right_border->kind != psiconv_border_none) &&
282 (new->right_border->thickness != base->right_border->thickness))) {
283 output_simple_chars(config,list,"border-right-width:",enc);
284 snprintf(tempstr,TEMPSTR_LEN,"%f",new->right_border->thickness);
285 output_simple_chars(config,list,tempstr,enc);
286 output_simple_chars(config,list,"pt;",enc);
287 }
288 if (!base ||
289 ((new->bottom_border->kind != psiconv_border_none) &&
290 (new->bottom_border->thickness != base->bottom_border->thickness))) {
291 output_simple_chars(config,list,"border-bottom-width:",enc);
292 snprintf(tempstr,TEMPSTR_LEN,"%f",new->bottom_border->thickness);
293 output_simple_chars(config,list,tempstr,enc);
294 output_simple_chars(config,list,"pt;",enc);
295 }
296 if (!base ||
297 ((new->top_border->kind != psiconv_border_none) &&
298 ( new->top_border->thickness != base->top_border->thickness))) {
299 output_simple_chars(config,list,"border-top-width:",enc);
300 snprintf(tempstr,TEMPSTR_LEN,"%f",new->top_border->thickness);
301 output_simple_chars(config,list,tempstr,enc);
302 output_simple_chars(config,list,"pt;",enc);
303 }
304 if (!base ||
305 ((new->left_border->kind != psiconv_border_none) &&
306 (new->left_border->thickness != base->left_border->thickness))) {
307 output_simple_chars(config,list,"border-left-width:",enc);
308 snprintf(tempstr,TEMPSTR_LEN,"%f",new->left_border->thickness);
309 output_simple_chars(config,list,tempstr,enc);
310 output_simple_chars(config,list,"pt;",enc);
311 }
312
313 if (!base ||
314 ((new->right_border->kind != psiconv_border_none) &&
315 ((new->right_border->color->red != base->right_border->color->red) ||
316 (new->right_border->color->green != base->right_border->color->green)||
317 (new->right_border->color->blue != base->right_border->color->blue)))) {
318 output_simple_chars(config,list,"border-right-color:",enc);
319 color(config,list,new->right_border->color,0,enc);
320 output_simple_chars(config,list,";",enc);
321 }
322 if (!base ||
323 ((new->top_border->kind != psiconv_border_none) &&
324 ((new->top_border->color->red != base->top_border->color->red) ||
325 (new->top_border->color->green != base->top_border->color->green) ||
326 (new->top_border->color->blue != base->top_border->color->blue)))) {
327 output_simple_chars(config,list,"border-top-color:",enc);
328 color(config,list,new->top_border->color,0,enc);
329 output_simple_chars(config,list,";",enc);
330 }
331 if (!base ||
332 ((new->bottom_border->kind != psiconv_border_none) &&
333 ((new->bottom_border->color->red != base->bottom_border->color->red) ||
334 (new->bottom_border->color->green !=base->bottom_border->color->green)||
335 (new->bottom_border->color->blue != base->bottom_border->color->blue)))){
336 output_simple_chars(config,list,"border-bottom-color:",enc);
337 color(config,list,new->bottom_border->color,0,enc);
338 output_simple_chars(config,list,";",enc);
339 }
340 if (!base ||
341 ((new->left_border->kind != psiconv_border_none) &&
342 ((new->left_border->color->red != base->left_border->color->red) ||
343 (new->left_border->color->green != base->left_border->color->green) ||
344 (new->left_border->color->blue != base->left_border->color->blue)))) {
345 output_simple_chars(config,list,"border-left-color:",enc);
346 color(config,list,new->left_border->color,0,enc);
347 output_simple_chars(config,list,";",enc);
348 }
349 }
350
351 void style(const psiconv_config config, psiconv_list list,
352 const psiconv_word_style style,
353 const psiconv_paragraph_layout base_para,
354 const psiconv_character_layout base_char,
355 const encoding enc)
356 {
357 output_simple_chars(config,list,"*.style_",enc);
358 style_name(config,list,style->name,enc);
359 output_simple_chars(config,list," {",enc);
360 paragraph_layout_diffs(config,list,style->paragraph,base_para,enc);
361 character_layout_diffs(config,list,style->character,base_char,enc);
362 output_simple_chars(config,list,"}\n",enc);
363 }
364
365 void styles(const psiconv_config config, psiconv_list list,
366 const psiconv_word_styles_section styles_sec,const encoding enc)
367 {
368 int i;
369 psiconv_word_style styl;
370 psiconv_character_layout base_char;
371 psiconv_paragraph_layout base_para;
372
373 if (!(base_char = psiconv_basic_character_layout())) {
374 fputs("Out of memory error\n",stderr);
375 exit(1);
376 }
377 if (!(base_para = psiconv_basic_paragraph_layout())) {
378 fputs("Out of memory error\n",stderr);
379 exit(1);
380 }
381
382 output_simple_chars(config,list,"<style type=\"text/css\">\n",enc);
383 /* output_simple_chars(config,list,"<![CDATA[\n",enc); */
384
385 output_simple_chars(config,list,"body {",enc);
386 paragraph_layout_diffs(config,list,base_para,NULL,enc);
387 character_layout_diffs(config,list,base_char,NULL,enc);
388 output_simple_chars(config,list,"}\n",enc);
389
390 if (styles_sec) {
391 style(config,list,styles_sec->normal,base_para,base_char,enc);
392
393 for (i = 0; i < psiconv_list_length(styles_sec->styles); i++) {
394 if (!(styl = psiconv_list_get(styles_sec->styles,i))) {
395 fputs("Internal datastructure corruption\n",stderr);
396 exit(1);
397 }
398 style(config,list,styl,base_para,base_char,enc);
399 }
400 }
401
402 /* output_simple_chars(config,list,"]]>\n",enc); */
403 output_simple_chars(config,list,"</style>\n",enc);
404 }
405
406 void header(const psiconv_config config, psiconv_list list,
407 const psiconv_word_styles_section styles_sec,const encoding enc)
408 {
409 output_simple_chars(config,list,
410 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n",enc);
411 output_simple_chars(config,list,"<!DOCTYPE html PUBLIC ",enc);
412 output_simple_chars(config,list, "\"-//W3C//DTD XHTML 1.0 Strict//EN\" ",enc);
413 output_simple_chars(config,list,
414 "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">",
415 enc);
416 output_simple_chars(config,list,"\n<html",enc);
417 output_simple_chars(config,list,
418 " xmlns=\"http://www.w3.org/1999/xhtml\"",enc);
419 output_simple_chars(config,list,">\n",enc);
420 output_simple_chars(config,list,"<head>\n",enc);
421 output_simple_chars(config,list,"<meta http-equiv=\"Content-Type\" "
422 "content=\"text/html; charset=",enc);
423 output_simple_chars(config,list,enc==ENCODING_UTF8?"UTF-8":
424 enc==ENCODING_UCS2?"UTF-16BE":
425 enc==ENCODING_ASCII?"US-ASCII":
426 "",enc);
427 output_simple_chars(config,list,"\">\n",enc);
428 output_simple_chars(config,list,"<meta http-equiv=\"Content-Style-Type\" "
429 "content=\"text/css\">\n",enc);
430 output_simple_chars(config,list,"<title>EPOC32 file "
431 "converted by psiconv</title>\n",enc);
432 styles(config,list,styles_sec,enc);
433 output_simple_chars(config,list,"</head>\n",enc);
434 output_simple_chars(config,list,"<body>\n",enc);
435 }
436
437 void footer(const psiconv_config config, psiconv_list list, const encoding enc)
438 {
439 output_simple_chars(config,list,"</body>\n",enc);
440 output_simple_chars(config,list,"</html>\n",enc);
441 }
442
443 void characters(const psiconv_config config, psiconv_list list,
444 const psiconv_string_t textstr,
445 const psiconv_character_layout layout,
446 const psiconv_character_layout base,
447 const encoding enc)
448 {
449 psiconv_list templist;
450
451 if (!(templist = psiconv_list_new(sizeof(psiconv_u8)))) {
452 fputs("Out of memory error\n",stderr);
453 exit(1);
454 }
455 character_layout_diffs(config,templist,layout,base,enc);
456
457 if (psiconv_list_length(templist)) {
458 output_simple_chars(config,list,"<span style=\"",enc);
459 if (psiconv_list_concat(list,templist)) {
460 fputs("Out of memory error\n",stderr);
461 exit(1);
462 }
463 output_simple_chars(config,list,"\">",enc);
464 }
465
466 text(config,list,textstr,enc);
467
468 if (psiconv_list_length(templist)) {
469 output_simple_chars(config,list,"</span>",enc);
470 }
471
472 psiconv_list_free(templist);
473 }
474
475 void paragraph(const psiconv_config config, psiconv_list list,
476 const psiconv_paragraph para,
477 const psiconv_word_styles_section styles_sec,
478 const encoding enc)
479 {
480 int i,charnr;
481 psiconv_string_t text;
482 psiconv_in_line_layout layout;
483 psiconv_word_style style = NULL;
484 psiconv_paragraph_layout base_para;
485 psiconv_character_layout base_char;
486 psiconv_list templist;
487
488 if (!(templist = psiconv_list_new(sizeof(psiconv_u8)))) {
489 fputs("Out of memory error\n",stderr);
490 exit(1);
491 }
492
493 if (styles_sec) {
494 if (!(style = psiconv_get_style(styles_sec,para->base_style))) {
495 fputs("Unknown style found; data corrupt\n",stderr);
496 exit(1);
497 }
498 base_para = style->paragraph;
499 base_char = style->character;
500 } else {
501 base_para = psiconv_basic_paragraph_layout();
502 base_char = psiconv_basic_character_layout();
503 if (!base_para || !base_char) {
504 fputs("Out of memory error\n",stderr);
505 exit(1);
506 }
507 }
508
509 output_simple_chars(config,
510 list,para->base_paragraph->bullet->on?"<ul><li ":"<p ",
511 enc);
512
513 if (styles_sec) {
514 output_simple_chars(config,list,"class=\"style_",enc);
515 style_name(config,list,style->name,enc);
516 output_simple_chars(config,list,"\" ",enc);
517 }
518
519 paragraph_layout_diffs(config,templist,para->base_paragraph,base_para,enc);
520 character_layout_diffs(config,templist,para->base_character,base_char,enc);
521
522 if (psiconv_list_length(templist)) {
523 output_simple_chars(config,list,"style=\"",enc);
524 if (psiconv_list_concat(list,templist)) {
525 fputs("Out of memory error\n",stderr);
526 exit(1);
527 }
528 output_simple_chars(config,list,"\"",enc);
529 }
530 output_simple_chars(config,list,">",enc);
531
532 if (psiconv_list_length(para->in_lines) == 0) {
533 characters(config,list,para->text,para->base_character,
534 para->base_character,enc);
535 } else {
536 charnr = 0;
537 for (i = 0; i < psiconv_list_length(para->in_lines); i++) {
538 if (!(layout = psiconv_list_get(para->in_lines,i))) {
539 fputs("Internal data structures corruption\n",stderr);
540 exit(1);
541 }
542 if (!(text = malloc(sizeof (*text) * (layout->length + 1)))) {
543 fputs("Out of memory error\n",stderr);
544 exit(1);
545 }
546 memcpy(text,para->text+charnr,layout->length * sizeof(*text));
547 text[layout->length] = 0;
548 characters(config,list,text,layout->layout,para->base_character,enc);
549 free(text);
550 charnr += layout->length;
551 }
552 }
553 output_simple_chars(config, list,
554 para->base_paragraph->bullet->on?"</li></ul>\n":"<p>\n",
555 enc);
556 if (!styles_sec) {
557 psiconv_free_paragraph_layout(base_para);
558 psiconv_free_character_layout(base_char);
559 }
560 psiconv_list_free(templist);
561 }
562
563 void paragraphs(const psiconv_config config, psiconv_list list,
564 psiconv_text_and_layout paragraphs,
565 const psiconv_word_styles_section styles,
566 const encoding enc)
567 {
568 int i;
569 psiconv_paragraph para;
570 for (i = 0; i < psiconv_list_length(paragraphs); i++) {
571 if (!(para = psiconv_list_get(paragraphs,i))) {
572 fputs("Internal datastructure corruption\n",stderr);
573 exit(1);
574 }
575 paragraph(config,list,para,styles,enc);
576 }
577 }
578
579 void gen_html_word(const psiconv_config config, psiconv_list list,
580 const psiconv_word_f file, const encoding enc)
581 {
582 if (!file)
583 return;
584
585 header(config,list,file->styles_sec,enc);
586 paragraphs(config,list,file->paragraphs,file->styles_sec,enc);
587 footer(config,list,enc);
588 }
589
590
591 void gen_html_texted(const psiconv_config config, psiconv_list list,
592 const psiconv_texted_f file, const encoding enc)
593 {
594 header(config,list,NULL,enc);
595 paragraphs(config,list,file->texted_sec->paragraphs,NULL,enc);
596 footer(config,list,enc);
597 }
598
599 int gen_html(const psiconv_config config, psiconv_list list,
600 const psiconv_file file, const char *dest,
601 const encoding enc)
602 {
603 if (enc == ENCODING_PSION) {
604 fputs("Unsupported encoding\n",stderr);
605 return -1;
606 }
607
608 if (file->type == psiconv_word_file) {
609 gen_html_word(config,list,(psiconv_word_f) file->file,enc);
610 return 0;
611 } else if (file->type == psiconv_texted_file) {
612 gen_html_texted(config,list,(psiconv_texted_f) file->file,enc);
613 return 0;
614 } else
615 return -1;
616 }
617
618
619 static struct fileformat_s ffs[] =
620 {
621 {
622 "XHTML",
623 "XHTML 1.0 Strict, using CSS for formatting",
624 gen_html
625 },
626 {
627 NULL,
628 NULL,
629 NULL
630 }
631 };
632
633
634 void init_html(void)
635 {
636 int i;
637 for (i = 0; ffs[i].name; i++)
638 psiconv_list_add(fileformat_list,ffs+i);
639 }

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26