… | |
… | |
21 | #include "config.h" |
21 | #include "config.h" |
22 | #include <stdio.h> |
22 | #include <stdio.h> |
23 | #include <string.h> |
23 | #include <string.h> |
24 | #include <ctype.h> |
24 | #include <ctype.h> |
25 | #include <stdlib.h> |
25 | #include <stdlib.h> |
26 | #include "data.h" |
26 | #include "psiconv/data.h" |
27 | #include "list.h" |
27 | #include "psiconv/list.h" |
28 | #include "gen.h" |
28 | #include "gen.h" |
|
|
29 | #include "psiconv.h" |
29 | |
30 | |
30 | #ifndef TRUE |
31 | #ifndef TRUE |
31 | #define TRUE (0==0) |
32 | #define TRUE (0==0) |
32 | #endif |
33 | #endif |
33 | |
34 | |
… | |
… | |
444 | fput_paragraph_layout(of, normal ? normal->paragraph : NULL, sty->paragraph); |
445 | fput_paragraph_layout(of, normal ? normal->paragraph : NULL, sty->paragraph); |
445 | fput_character_layout(of, normal ? normal->character : NULL, sty->character, wf); |
446 | fput_character_layout(of, normal ? normal->character : NULL, sty->character, wf); |
446 | fputs("}\n", of); |
447 | fputs("}\n", of); |
447 | } |
448 | } |
448 | |
449 | |
449 | void psiconv_gen_html4(FILE * of, psiconv_file file) |
450 | static int psiconv_gen_html4(const char *filename, const psiconv_file file, |
|
|
451 | const char *dest) |
450 | { |
452 | { |
|
|
453 | FILE * of; |
451 | int i; |
454 | int i; |
452 | psiconv_paragraph para; |
455 | psiconv_paragraph para; |
453 | psiconv_word_style normal, sty; |
456 | psiconv_word_style normal, sty; |
454 | psiconv_word_f wf; |
457 | psiconv_word_f wf; |
455 | |
458 | |
456 | if (file->type == psiconv_word_file) |
459 | if (file->type == psiconv_word_file) |
457 | wf = file->file; |
460 | wf = file->file; |
458 | else { |
461 | else { |
459 | /* Fall back on the normal HTML generator */ |
462 | /* Fall back on the normal HTML generator */ |
460 | psiconv_gen_html(of,file); |
463 | return psiconv_gen_html(filename,file,dest); |
|
|
464 | } |
|
|
465 | |
|
|
466 | if (! (of = fopen(filename,"w"))) |
461 | return; |
467 | return -1; |
462 | } |
|
|
463 | |
468 | |
464 | fputs("<!doctype html public \"-//W3C//DTD HTML 4.0 STRICT//EN\">", of); |
469 | fputs("<!doctype html public \"-//W3C//DTD HTML 4.0 STRICT//EN\">", of); |
465 | fputs("\n<HTML>\n<HEAD>\n <META NAME=\"GENERATOR\"", of); |
470 | fputs("\n<HTML>\n<HEAD>\n <META NAME=\"GENERATOR\"", of); |
466 | fputs(" CONTENT=\"psiconv-" VERSION "\">\n", of); |
471 | fputs(" CONTENT=\"psiconv-" VERSION "\">\n", of); |
467 | |
472 | |
… | |
… | |
488 | for (i = 0; i < psiconv_list_length(wf->paragraphs); i++) { |
493 | for (i = 0; i < psiconv_list_length(wf->paragraphs); i++) { |
489 | para = psiconv_list_get(wf->paragraphs, i); |
494 | para = psiconv_list_get(wf->paragraphs, i); |
490 | fput_para(of, para, wf); |
495 | fput_para(of, para, wf); |
491 | } |
496 | } |
492 | fputs("</BODY>\n</HTML>\n", of); |
497 | fputs("</BODY>\n</HTML>\n", of); |
493 | } |
|
|
494 | |
498 | |
|
|
499 | return fclose(of); |
|
|
500 | } |
|
|
501 | |
|
|
502 | static struct psiconv_fileformat_s ff = |
|
|
503 | { |
|
|
504 | "HTML4", |
|
|
505 | "HTML 4.0 with cascading style sheets", |
|
|
506 | psiconv_gen_html4 |
|
|
507 | }; |
|
|
508 | |
|
|
509 | void init_html4(void) |
|
|
510 | { |
|
|
511 | psiconv_list_add(fileformat_list,&ff); |
|
|
512 | } |
|
|
513 | |