… | |
… | |
19 | */ |
19 | */ |
20 | |
20 | |
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 "data.h" |
24 | #include "psiconv/data.h" |
25 | #include "list.h" |
25 | #include "psiconv/list.h" |
26 | #include "gen.h" |
26 | #include "gen.h" |
27 | #include "psiconv.h" |
27 | #include "psiconv.h" |
28 | |
28 | |
29 | |
29 | |
30 | /* |
30 | /* |
… | |
… | |
94 | static void psiconv_gen_txt_texted(FILE * of, psiconv_texted_f tf) |
94 | static void psiconv_gen_txt_texted(FILE * of, psiconv_texted_f tf) |
95 | { |
95 | { |
96 | int i; |
96 | int i; |
97 | psiconv_paragraph para; |
97 | psiconv_paragraph para; |
98 | |
98 | |
|
|
99 | if (tf->page_sec->header->text) { |
99 | if (tf->page_sec->header->on_first_page) { |
100 | if (tf->page_sec->header->on_first_page) { |
100 | for (i=0; i < psiconv_list_length(tf->page_sec->header->text->paragraphs); i++) { |
101 | for (i=0; i < psiconv_list_length(tf->page_sec->header->text->paragraphs); i++) { |
101 | para = psiconv_list_get(tf->page_sec->header->text->paragraphs, i); |
102 | para = psiconv_list_get(tf->page_sec->header->text->paragraphs, i); |
102 | fput_text(of, para->text, strlen(para->text)); |
103 | fput_text(of, para->text, strlen(para->text)); |
103 | fputs("\n", of); |
104 | fputs("\n", of); |
|
|
105 | } |
104 | } |
106 | } |
105 | } |
107 | } |
106 | fputs("\n",of); |
108 | fputs("\n",of); |
107 | |
109 | |
108 | for (i=0; i < psiconv_list_length(tf->texted_sec->paragraphs); i++) { |
110 | for (i=0; i < psiconv_list_length(tf->texted_sec->paragraphs); i++) { |
109 | para = psiconv_list_get(tf->texted_sec->paragraphs, i); |
111 | para = psiconv_list_get(tf->texted_sec->paragraphs, i); |
110 | fput_para(of, para,0); |
112 | fput_para(of, para,0); |
111 | } |
113 | } |
112 | |
114 | |
113 | fputs("\n",of); |
115 | fputs("\n",of); |
|
|
116 | if (tf->page_sec->header->text) { |
114 | for (i=0; i < psiconv_list_length(tf->page_sec->footer->text->paragraphs); i++) { |
117 | for (i=0; i < psiconv_list_length(tf->page_sec->footer->text->paragraphs); i++) { |
115 | para = psiconv_list_get(tf->page_sec->footer->text->paragraphs, i); |
118 | para = psiconv_list_get(tf->page_sec->footer->text->paragraphs, i); |
116 | fput_text(of, para->text, strlen(para->text)); |
119 | fput_text(of, para->text, strlen(para->text)); |
117 | fputs("\n", of); |
120 | fputs("\n", of); |
|
|
121 | } |
118 | } |
122 | } |
119 | } |
123 | } |
120 | |
124 | |
121 | static void psiconv_gen_txt_word(FILE * of, psiconv_word_f wf) |
125 | static void psiconv_gen_txt_word(FILE * of, psiconv_word_f wf) |
122 | { |
126 | { |
… | |
… | |
161 | return -1; |
165 | return -1; |
162 | } |
166 | } |
163 | return fclose(of); |
167 | return fclose(of); |
164 | } |
168 | } |
165 | |
169 | |
166 | static struct psiconv_fileformat ff = |
170 | static struct psiconv_fileformat_s ff = |
167 | { |
171 | { |
168 | "ASCII", |
172 | "ASCII", |
169 | "Plain text without much layout", |
173 | "Plain text without much layout", |
170 | psiconv_gen_txt |
174 | psiconv_gen_txt |
171 | }; |
175 | }; |