rmultimarkdown 4.7.1.1 → 6.2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +2 -2
  3. data/README.md +7 -9
  4. data/Rakefile +33 -18
  5. data/ext/Makefile +261 -0
  6. data/ext/extconf.rb +23 -3
  7. data/ext/mmd/aho-corasick.c +596 -0
  8. data/ext/mmd/aho-corasick.h +120 -0
  9. data/ext/mmd/beamer.c +344 -0
  10. data/ext/mmd/beamer.h +72 -0
  11. data/ext/mmd/char.c +156 -0
  12. data/ext/mmd/char.h +111 -0
  13. data/ext/mmd/char_lookup.c +212 -0
  14. data/ext/mmd/critic_markup.c +330 -0
  15. data/ext/mmd/critic_markup.h +94 -0
  16. data/ext/mmd/d_string.c +402 -0
  17. data/ext/mmd/epub.c +563 -0
  18. data/ext/mmd/epub.h +69 -0
  19. data/ext/mmd/fodt.c +2288 -0
  20. data/ext/mmd/fodt.h +81 -0
  21. data/ext/mmd/html.c +2460 -0
  22. data/ext/mmd/html.h +81 -0
  23. data/ext/mmd/i18n.h +170 -0
  24. data/ext/mmd/include/d_string.h +182 -0
  25. data/ext/mmd/include/libMultiMarkdown.h +548 -0
  26. data/ext/mmd/include/token.h +233 -0
  27. data/ext/mmd/latex.c +2435 -0
  28. data/ext/mmd/latex.h +83 -0
  29. data/ext/mmd/lexer.c +3001 -0
  30. data/ext/mmd/lexer.h +75 -0
  31. data/ext/mmd/memoir.c +138 -0
  32. data/ext/mmd/memoir.h +67 -0
  33. data/ext/mmd/miniz.c +7557 -0
  34. data/ext/mmd/miniz.h +1328 -0
  35. data/ext/mmd/mmd.c +2798 -0
  36. data/ext/mmd/mmd.h +120 -0
  37. data/ext/mmd/object_pool.c +141 -0
  38. data/ext/mmd/object_pool.h +101 -0
  39. data/ext/mmd/opendocument-content.c +2071 -0
  40. data/ext/mmd/opendocument-content.h +135 -0
  41. data/ext/mmd/opendocument.c +981 -0
  42. data/ext/mmd/opendocument.h +118 -0
  43. data/ext/mmd/parser.c +1760 -0
  44. data/ext/mmd/parser.h +39 -0
  45. data/{MultiMarkdown-4 → ext/mmd}/rng.c +90 -49
  46. data/ext/mmd/scanners.c +77512 -0
  47. data/ext/mmd/scanners.h +101 -0
  48. data/ext/mmd/stack.c +142 -0
  49. data/ext/mmd/stack.h +113 -0
  50. data/ext/mmd/textbundle.c +455 -0
  51. data/ext/mmd/textbundle.h +115 -0
  52. data/ext/mmd/token.c +773 -0
  53. data/ext/mmd/token_pairs.c +263 -0
  54. data/ext/mmd/token_pairs.h +123 -0
  55. data/ext/mmd/transclude.c +549 -0
  56. data/ext/mmd/transclude.h +87 -0
  57. data/ext/mmd/uthash.h +1074 -0
  58. data/ext/mmd/uuid.c +154 -0
  59. data/ext/mmd/uuid.h +77 -0
  60. data/ext/mmd/version.h +111 -0
  61. data/ext/mmd/writer.c +2652 -0
  62. data/ext/mmd/writer.h +260 -0
  63. data/ext/mmd/zip.c +210 -0
  64. data/ext/mmd/zip.h +120 -0
  65. data/ext/{multi_markdown.c → ruby_multi_markdown.c} +87 -18
  66. data/lib/multi_markdown.bundle +0 -0
  67. data/lib/multi_markdown.rb +5 -8
  68. data/lib/multi_markdown/version.rb +1 -1
  69. data/rmultimarkdown.gemspec +2 -2
  70. data/test/{extensions_test.rb.rb → extensions_test.rb} +10 -54
  71. data/test/multi_markdown_test.rb +13 -0
  72. metadata +67 -47
  73. data/MultiMarkdown-4/GLibFacade.c +0 -310
  74. data/MultiMarkdown-4/GLibFacade.h +0 -100
  75. data/MultiMarkdown-4/beamer.c +0 -182
  76. data/MultiMarkdown-4/beamer.h +0 -11
  77. data/MultiMarkdown-4/critic.c +0 -111
  78. data/MultiMarkdown-4/critic.h +0 -15
  79. data/MultiMarkdown-4/glib.h +0 -11
  80. data/MultiMarkdown-4/html.c +0 -1117
  81. data/MultiMarkdown-4/html.h +0 -14
  82. data/MultiMarkdown-4/latex.c +0 -1217
  83. data/MultiMarkdown-4/latex.h +0 -16
  84. data/MultiMarkdown-4/libMultiMarkdown.h +0 -177
  85. data/MultiMarkdown-4/lyx.c +0 -2265
  86. data/MultiMarkdown-4/lyx.h +0 -37
  87. data/MultiMarkdown-4/lyxbeamer.c +0 -265
  88. data/MultiMarkdown-4/lyxbeamer.h +0 -11
  89. data/MultiMarkdown-4/memoir.c +0 -80
  90. data/MultiMarkdown-4/memoir.h +0 -10
  91. data/MultiMarkdown-4/multimarkdown.c +0 -518
  92. data/MultiMarkdown-4/odf.c +0 -1222
  93. data/MultiMarkdown-4/odf.h +0 -18
  94. data/MultiMarkdown-4/opml.c +0 -189
  95. data/MultiMarkdown-4/opml.h +0 -15
  96. data/MultiMarkdown-4/parse_utilities.c +0 -884
  97. data/MultiMarkdown-4/parser.c +0 -16656
  98. data/MultiMarkdown-4/parser.h +0 -188
  99. data/MultiMarkdown-4/rtf.c +0 -665
  100. data/MultiMarkdown-4/rtf.h +0 -17
  101. data/MultiMarkdown-4/strtok.c +0 -56
  102. data/MultiMarkdown-4/strtok.h +0 -9
  103. data/MultiMarkdown-4/text.c +0 -53
  104. data/MultiMarkdown-4/text.h +0 -11
  105. data/MultiMarkdown-4/toc.c +0 -142
  106. data/MultiMarkdown-4/toc.h +0 -15
  107. data/MultiMarkdown-4/transclude.c +0 -307
  108. data/MultiMarkdown-4/transclude.h +0 -28
  109. data/MultiMarkdown-4/writer.c +0 -731
  110. data/MultiMarkdown-4/writer.h +0 -38
@@ -1,1222 +0,0 @@
1
- /*
2
-
3
- odf.c -- ODF (Flat OpenDocument format) writer
4
-
5
- (c) 2013-2015 Fletcher T. Penney (http://fletcherpenney.net/).
6
-
7
- This program is free software; you can redistribute it and/or modify
8
- it under the terms of the GNU General Public License or the MIT
9
- license. See LICENSE for details.
10
-
11
- This program is distributed in the hope that it will be useful,
12
- but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- GNU General Public License for more details.
15
-
16
- */
17
-
18
- #include "odf.h"
19
-
20
- /* begin_odf_output -- handle the initial prefix, if any */
21
- void begin_odf_output(GString *out, node* list, scratch_pad *scratch) {
22
- #ifdef DEBUG_ON
23
- fprintf(stderr, "begin_odf_output\n");
24
- #endif
25
- print_odf_header(out);
26
- }
27
-
28
- /* end_odf_output -- close the document */
29
- void end_odf_output(GString *out, node* list, scratch_pad *scratch) {
30
- #ifdef DEBUG_ON
31
- fprintf(stderr, "end_odf_output\n");
32
- #endif
33
- print_odf_footer(out);
34
- }
35
-
36
- /* print_odf_node_tree -- convert node tree to LaTeX */
37
- void print_odf_node_tree(GString *out, node *list, scratch_pad *scratch) {
38
- #ifdef DEBUG_ON
39
- fprintf(stderr, "print_odf_node_tree\n");
40
- #endif
41
- while (list != NULL) {
42
- print_odf_node(out, list, scratch);
43
- list = list->next;
44
- }
45
- }
46
-
47
- /* print_odf_node -- convert given node to odf and append */
48
- void print_odf_node(GString *out, node *n, scratch_pad *scratch) {
49
- node *temp_node;
50
- link_data *temp_link_data = NULL;
51
- char *temp;
52
- int lev;
53
- int old_type;
54
- char *width = NULL;
55
- char *height = NULL;
56
- GString *temp_str;
57
- int i;
58
-
59
- if (n == NULL)
60
- return;
61
-
62
- /* debugging statement */
63
- #ifdef DEBUG_ON
64
- fprintf(stderr, "print_odf_node: %d\n",n->key);
65
- #endif
66
-
67
- /* If we are forcing a complete document, and METADATA isn't the first thing,
68
- we need to close <head> */
69
- if (!(scratch->extensions & EXT_HEAD_CLOSED) &&
70
- !((n->key == FOOTER) || (n->key == METADATA))) {
71
- g_string_append_printf(out, "<office:body>\n<office:text>\n");
72
- scratch->extensions = scratch->extensions | EXT_HEAD_CLOSED;
73
- }
74
-
75
- switch (n->key) {
76
- case NO_TYPE:
77
- case ABBREVIATION:
78
- break;
79
- case LIST:
80
- print_odf_node_tree(out,n->children,scratch);
81
- break;
82
- case STR:
83
- case ABBR:
84
- case ABBRSTART:
85
- case ABBRSTOP:
86
- /* TODO: Need something a bit better here for abbreviations */
87
- print_html_string(out,n->str, scratch);
88
- break;
89
- case SPACE:
90
- g_string_append_printf(out,"%s",n->str);
91
- break;
92
- case PLAIN:
93
- pad(out,1, scratch);
94
- print_odf_node_tree(out,n->children, scratch);
95
- scratch->padded = 0;
96
- break;
97
- case PARA:
98
- pad(out, 2, scratch);
99
- g_string_append_printf(out, "<text:p");
100
- switch (scratch->odf_para_type) {
101
- case DEFINITION:
102
- case BLOCKQUOTE:
103
- g_string_append_printf(out, " text:style-name=\"Quotations\"");
104
- break;
105
- case CODE:
106
- case VERBATIM:
107
- case VERBATIMFENCE:
108
- g_string_append_printf(out, " text:style-name=\"Preformatted Text\"");
109
- break;
110
- case ORDEREDLIST:
111
- g_string_append_printf(out, " text:style-name=\"P2\"");
112
- break;
113
- case BULLETLIST:
114
- g_string_append_printf(out, " text:style-name=\"P1\"");
115
- break;
116
- case NOTEREFERENCE:
117
- case NOTESOURCE:
118
- case CITATION:
119
- case NOCITATION:
120
- g_string_append_printf(out, " text:style-name=\"Footnote\"");
121
- break;
122
- default:
123
- g_string_append_printf(out, " text:style-name=\"Standard\"");
124
- break;
125
- }
126
- g_string_append_printf(out, ">");
127
- print_odf_node_tree(out,n->children,scratch);
128
- g_string_append_printf(out, "</text:p>\n");
129
- scratch->padded = 1;
130
- break;
131
- case HRULE:
132
- pad(out, 2, scratch);
133
- g_string_append_printf(out,"<text:p text:style-name=\"Horizontal_20_Line\"/>");
134
- scratch->padded = 0;
135
- break;
136
- case HTMLBLOCK:
137
- /* don't print HTML block */
138
- /* but do print HTML comments for raw LaTeX */
139
- if (strncmp(n->str,"<!--",4) == 0) {
140
- pad(out, 2, scratch);
141
- /* trim "-->" from end */
142
- n->str[strlen(n->str)-3] = '\0';
143
- g_string_append_printf(out, "<text:p text:style-name=\"Standard\">%s</text:p>", &n->str[4]);
144
- scratch->padded = 0;
145
- }
146
- break;
147
- case VERBATIM:
148
- case VERBATIMFENCE:
149
- old_type = scratch->odf_para_type;
150
- scratch->odf_para_type = VERBATIM;
151
- pad(out, 2, scratch);
152
- g_string_append_printf(out, "<text:p text:style-name=\"Preformatted Text\">");
153
- print_odf_code_string(out, n->str);
154
- g_string_append_printf(out, "</text:p>\n");
155
- scratch->padded = 0;
156
- scratch->odf_para_type = old_type;
157
- break;
158
- case BULLETLIST:
159
- case ORDEREDLIST:
160
- old_type = scratch->odf_para_type;
161
- scratch->odf_para_type = n->key;
162
- if (scratch->odf_list_needs_end_p) {
163
- g_string_append_printf(out, "</text:p>");
164
- scratch->odf_list_needs_end_p = false;
165
- }
166
- pad(out, 2, scratch);
167
- switch (n->key) {
168
- case BULLETLIST:
169
- g_string_append_printf(out, "<text:list text:style-name=\"L1\">");
170
- break;
171
- case ORDEREDLIST:
172
- g_string_append_printf(out, "<text:list text:style-name=\"L2\">");
173
- break;
174
- }
175
- scratch->padded = 1;
176
- print_odf_node_tree(out, n->children, scratch);
177
- pad(out, 1, scratch);
178
- g_string_append_printf(out, "</text:list>");
179
- scratch->padded = 0;
180
- scratch->odf_para_type = old_type;
181
- break;
182
- case LISTITEM:
183
- #ifdef DEBUG_ON
184
- fprintf(stderr, "print list item\n");
185
- #endif
186
- pad(out, 1, scratch);
187
- g_string_append_printf(out, "<text:list-item>\n");
188
- if ((n->children != NULL) && (n->children->children != NULL) && (n->children->children->key != PARA)) {
189
- switch (scratch->odf_para_type) {
190
- case BULLETLIST:
191
- g_string_append_printf(out, "<text:p text:style-name=\"P1\">");
192
- break;
193
- case ORDEREDLIST:
194
- g_string_append_printf(out, "<text:p text:style-name=\"P2\">");
195
- break;
196
- }
197
- scratch->odf_list_needs_end_p = true;
198
- }
199
- scratch->padded = 2;
200
- print_odf_node_tree(out, n->children, scratch);
201
- scratch->odf_list_needs_end_p = false;
202
- #ifdef DEBUG_ON
203
- fprintf(stderr, "print list tree\n");
204
- #endif
205
- if (!(tree_contains_key(n->children, BULLETLIST)) &&
206
- !(tree_contains_key(n->children, ORDEREDLIST))) {
207
- if ((n->children != NULL) && (n->children->children != NULL) && (n->children->children->key != PARA))
208
- g_string_append_printf(out, "</text:p>");
209
- }
210
- g_string_append_printf(out, "</text:list-item>\n");
211
- scratch->padded = 1;
212
- #ifdef DEBUG_ON
213
- fprintf(stderr, "finish print list item\n");
214
- #endif
215
- break;
216
- case METADATA:
217
- g_string_append_printf(out, "<office:meta>\n");
218
- scratch->extensions = scratch->extensions | EXT_HEAD_CLOSED;
219
- print_odf_node_tree(out, n->children, scratch);
220
- g_string_append_printf(out, "</office:meta>\n");
221
- temp_node = metadata_for_key("odfheader", n);
222
- if (temp_node != NULL) {
223
- print_raw_node(out, temp_node->children);
224
- }
225
- g_string_append_printf(out, "<office:body>\n<office:text>\n");
226
- break;
227
- case METAKEY:
228
- temp = label_from_string(n->str);
229
- if (strcmp(temp, "title") == 0) {
230
- g_string_append_printf(out, "<dc:title>");
231
- print_odf_node(out, n->children, scratch);
232
- g_string_append_printf(out, "</dc:title>\n");
233
- } else if (strcmp(temp, "css") == 0) {
234
- } else if (strcmp(temp, "xhtmlheader") == 0) {
235
- } else if (strcmp(temp, "htmlheader") == 0) {
236
- } else if (strcmp(n->str, "mmdfooter") == 0) {
237
- } else if (strcmp(temp, "baseheaderlevel") == 0) {
238
- scratch->baseheaderlevel = atoi(n->children->str);
239
- } else if (strcmp(temp, "odfheaderlevel") == 0) {
240
- scratch->baseheaderlevel = atoi(n->children->str);
241
- } else if (strcmp(temp, "htmlheaderlevel") == 0) {
242
- } else if (strcmp(temp, "latexinput") == 0) {
243
- } else if (strcmp(temp, "latexfooter") == 0) {
244
- } else if (strcmp(temp, "latexmode") == 0) {
245
- } else if (strcmp(temp, "keywords") == 0) {
246
- g_string_append_printf(out, "<meta:keyword>");
247
- print_odf_node(out, n->children, scratch);
248
- g_string_append_printf(out, "</meta:keyword>\n");
249
- } else if (strcmp(temp, "quoteslanguage") == 0) {
250
- free(temp);
251
- temp = label_from_node_tree(n->children);
252
- if ((strcmp(temp, "nl") == 0) || (strcmp(temp, "dutch") == 0)) { scratch->language = DUTCH; } else
253
- if ((strcmp(temp, "de") == 0) || (strcmp(temp, "german") == 0)) { scratch->language = GERMAN; } else
254
- if (strcmp(temp, "germanguillemets") == 0) { scratch->language = GERMANGUILL; } else
255
- if ((strcmp(temp, "fr") == 0) || (strcmp(temp, "french") == 0)) { scratch->language = FRENCH; } else
256
- if ((strcmp(temp, "sv") == 0) || (strcmp(temp, "swedish") == 0)) { scratch->language = SWEDISH; }
257
- } else {
258
- g_string_append_printf(out,"<meta:user-defined meta:name=\"");
259
- print_odf_string(out, n->str);
260
- g_string_append_printf(out, "\">");
261
- print_odf_node(out,n->children,scratch);
262
- g_string_append_printf(out,"</meta:user-defined>\n");
263
- }
264
- free(temp);
265
- break;
266
- case METAVALUE:
267
- trim_trailing_whitespace(n->str);
268
- print_odf_string(out,n->str);
269
- break;
270
- case FOOTER:
271
- break;
272
- case HEADINGSECTION:
273
- print_odf_node_tree(out,n->children,scratch);
274
- break;
275
- case H1: case H2: case H3: case H4: case H5: case H6:
276
- lev = n->key - H1 + scratch->baseheaderlevel; /* assumes H1 ... H6 are in order */
277
- pad(out, 2, scratch);
278
- g_string_append_printf(out, "<text:h text:outline-level=\"%d\">", lev);
279
- if (n->children->key == AUTOLABEL) {
280
- /* use label for header since one was specified (MMD)*/
281
- temp = label_from_string(n->children->str);
282
- g_string_append_printf(out, "<text:bookmark text:name=\"%s\"/>", temp);
283
- print_odf_node_tree(out, n->children->next, scratch);
284
- g_string_append_printf(out, "<text:bookmark-end text:name=\"%s\"/>", temp);
285
- free(temp);
286
- } else {
287
- /* generate a label by default for MMD */
288
- temp = label_from_node_tree(n->children);
289
- g_string_append_printf(out, "<text:bookmark text:name=\"%s\"/>", temp);
290
- print_odf_node_tree(out, n->children, scratch);
291
- g_string_append_printf(out, "<text:bookmark-end text:name=\"%s\"/>", temp);
292
- free(temp);
293
- }
294
- g_string_append_printf(out, "</text:h>");
295
- scratch->padded = 0;
296
- break;
297
- case APOSTROPHE:
298
- print_html_localized_typography(out, APOS, scratch);
299
- break;
300
- case ELLIPSIS:
301
- print_html_localized_typography(out, ELLIP, scratch);
302
- break;
303
- case EMDASH:
304
- print_html_localized_typography(out, MDASH, scratch);
305
- break;
306
- case ENDASH:
307
- print_html_localized_typography(out, NDASH, scratch);
308
- break;
309
- case SINGLEQUOTED:
310
- print_html_localized_typography(out, LSQUOTE, scratch);
311
- print_odf_node_tree(out, n->children, scratch);
312
- print_html_localized_typography(out, RSQUOTE, scratch);
313
- break;
314
- case DOUBLEQUOTED:
315
- print_html_localized_typography(out, LDQUOTE, scratch);
316
- print_odf_node_tree(out, n->children, scratch);
317
- print_html_localized_typography(out, RDQUOTE, scratch);
318
- break;
319
- case LINEBREAK:
320
- g_string_append_printf(out, "<text:line-break/>");
321
- break;
322
- case MATHSPAN:
323
- temp = strdup(n->str);
324
- if (temp[0] == '$') {
325
- g_string_append_printf(out, "<text:span text:style-name=\"math\">%s</text:span>",temp);
326
- } else if (temp[strlen(temp) - 1] == ']') {
327
- temp[strlen(temp) - 3] = '\0';
328
- g_string_append_printf(out, "<text:span text:style-name=\"math\">%s\\]</text:span>",temp);
329
- } else {
330
- temp[strlen(temp) - 3] = '\0';
331
- g_string_append_printf(out, "<text:span text:style-name=\"math\">%s\\)</text:span>",temp);
332
- }
333
- free(temp);
334
- break;
335
- case STRONG:
336
- g_string_append_printf(out, "<text:span text:style-name=\"MMD-Bold\">");
337
- print_odf_node_tree(out,n->children,scratch);
338
- g_string_append_printf(out, "</text:span>");
339
- break;
340
- case EMPH:
341
- g_string_append_printf(out, "<text:span text:style-name=\"MMD-Italic\">");
342
- print_odf_node_tree(out,n->children,scratch);
343
- g_string_append_printf(out, "</text:span>");
344
- break;
345
- case LINKREFERENCE:
346
- break;
347
- case LINK:
348
- #ifdef DEBUG_ON
349
- fprintf(stderr, "print odf link: '%s'\n",n->str);
350
- #endif
351
- /* Stash a copy of the link data */
352
- if (n->link_data != NULL)
353
- temp_link_data = mk_link_data(n->link_data->label, n->link_data->source, n->link_data->title, n->link_data->attr);
354
-
355
- /* Do we have proper info? */
356
- if (n->link_data == NULL) {
357
- /* NULL link_data could occur if we parsed this link before and it didn't
358
- match anything */
359
- n->link_data = mk_link_data(NULL, NULL, NULL, NULL);
360
- }
361
-
362
- if ((n->link_data->label == NULL) &&
363
- (n->link_data->source == NULL)) {
364
- #ifdef DEBUG_ON
365
- fprintf(stderr, "print odf link: '%s'\n",n->str);
366
- #endif
367
- /* we seem to be a [foo][] style link */
368
- /* so load a label */
369
- temp_str = g_string_new("");
370
- print_raw_node_tree(temp_str, n->children);
371
- free(n->link_data->label);
372
- n->link_data->label = temp_str->str;
373
- g_string_free(temp_str, FALSE);
374
- }
375
- #ifdef DEBUG_ON
376
- fprintf(stderr, "look for reference data for odf link: '%s'\n",n->str);
377
- #endif
378
- /* Load reference data */
379
- if (n->link_data->label != NULL) {
380
- #ifdef DEBUG_ON
381
- fprintf(stderr, "have label for odf link: '%s'\n",n->str);
382
- #endif
383
- temp = strdup(n->link_data->label);
384
- free_link_data(n->link_data);
385
- n->link_data = extract_link_data(temp, scratch);
386
- if (n->link_data == NULL) {
387
- /* replace original text since no definition found */
388
- g_string_append_printf(out, "[");
389
- print_odf_node(out, n->children, scratch);
390
- g_string_append_printf(out,"]");
391
- if (n->children->next != NULL) {
392
- g_string_append_printf(out, "[");
393
- print_odf_node_tree(out, n->children->next, scratch);
394
- g_string_append_printf(out,"]");
395
- } else if (n->str != NULL) {
396
- /* no title label, so see if we stashed str*/
397
- g_string_append_printf(out, "%s", n->str);
398
- } else {
399
- g_string_append_printf(out, "[%s]",temp);
400
- }
401
-
402
- free(temp);
403
-
404
- /* Restore stashed copy */
405
- n->link_data = temp_link_data;
406
-
407
- break;
408
- }
409
- free(temp);
410
- }
411
- #ifdef DEBUG_ON
412
- fprintf(stderr, "got link data for odf link: '%s'\n",n->str);
413
- #endif
414
- g_string_append_printf(out, "<text:a xlink:type=\"simple\"");
415
- if (n->link_data->source != NULL) {
416
- g_string_append_printf(out, " xlink:href=\"");
417
- print_html_string(out,n->link_data->source, scratch);
418
- g_string_append_printf(out, "\"");
419
- }
420
- if ((n->link_data->title != NULL) && (strlen(n->link_data->title) > 0)) {
421
- g_string_append_printf(out, " office:name=\"");
422
- print_html_string(out, n->link_data->title, scratch);
423
- g_string_append_printf(out, "\"");
424
- }
425
- print_odf_node_tree(out, n->link_data->attr, scratch);
426
- g_string_append_printf(out, ">");
427
- if (n->children != NULL)
428
- print_odf_node_tree(out,n->children,scratch);
429
- g_string_append_printf(out, "</text:a>");
430
-
431
- /* Restore stashed copy */
432
- n->link_data->attr = NULL;
433
- free_link_data(n->link_data);
434
- n->link_data = temp_link_data;
435
-
436
- break;
437
- case ATTRKEY:
438
- if ( (strcmp(n->str,"height") == 0) || (strcmp(n->str, "width") == 0)) {
439
- }
440
- break;
441
- case REFNAME:
442
- case SOURCE:
443
- case TITLE:
444
- break;
445
- case IMAGEBLOCK:
446
- pad(out,2, scratch);
447
- case IMAGE:
448
- #ifdef DEBUG_ON
449
- fprintf(stderr, "print image\n");
450
- #endif
451
- /* Stash a copy of the link data */
452
- if (n->link_data != NULL)
453
- temp_link_data = mk_link_data(n->link_data->label, n->link_data->source, n->link_data->title, n->link_data->attr);
454
-
455
- if (n->key == IMAGEBLOCK)
456
- g_string_append_printf(out, "<text:p>\n");
457
- /* Do we have proper info? */
458
- if ((n->link_data->label == NULL) &&
459
- (n->link_data->source == NULL)) {
460
- /* we seem to be a [foo][] style link */
461
- /* so load a label */
462
- temp_str = g_string_new("");
463
- print_raw_node_tree(temp_str, n->children);
464
- n->link_data->label = temp_str->str;
465
- g_string_free(temp_str, FALSE);
466
- }
467
- #ifdef DEBUG_ON
468
- fprintf(stderr, "load reference data\n");
469
- #endif
470
- /* Load reference data */
471
- if (n->link_data->label != NULL) {
472
- temp = strdup(n->link_data->label);
473
- free_link_data(n->link_data);
474
- n->link_data = extract_link_data(temp, scratch);
475
- if (n->link_data == NULL) {
476
- g_string_append_printf(out, "![");
477
- print_html_node_tree(out, n->children, scratch);
478
- g_string_append_printf(out,"][%s]",temp);
479
-
480
- /* Restore stashed copy */
481
- n->link_data = temp_link_data;
482
-
483
- free(temp);
484
-
485
- break;
486
- }
487
- free(temp);
488
- }
489
- #ifdef DEBUG_ON
490
- fprintf(stderr, "create img\n");
491
- #endif
492
- g_string_append_printf(out, "<draw:frame text:anchor-type=\"as-char\"\ndraw:z-index=\"0\" draw:style-name=\"fr1\" ");
493
-
494
- if (n->link_data->attr != NULL) {
495
- temp_node = node_for_attribute("height",n->link_data->attr);
496
- if (temp_node != NULL)
497
- height = correct_dimension_units(temp_node->children->str);
498
- temp_node = node_for_attribute("width",n->link_data->attr);
499
- if (temp_node != NULL)
500
- width = correct_dimension_units(temp_node->children->str);
501
- }
502
-
503
- if (width != NULL) {
504
- g_string_append_printf(out, "svg:width=\"%s\"\n", width);
505
- } else {
506
- g_string_append_printf(out, "svg:width=\"95%%\"\n");
507
- }
508
-
509
- g_string_append_printf(out, ">\n<draw:text-box><text:p><draw:frame text:anchor-type=\"as-char\" draw:z-index=\"1\" ");
510
- if ((height != NULL) && (width != NULL)) {
511
- g_string_append_printf(out, "svg:height=\"%s\"\n",height);
512
- g_string_append_printf(out, "svg:width=\"%s\"\n", width);
513
- }
514
-
515
- if (n->link_data->source != NULL)
516
- g_string_append_printf(out, "><draw:image xlink:href=\"%s\"",n->link_data->source);
517
-
518
- g_string_append_printf(out," xlink:type=\"simple\" xlink:show=\"embed\" xlink:actuate=\"onLoad\" draw:filter-name=\"&lt;All formats&gt;\"/>\n</draw:frame></text:p>");
519
-
520
- if (n->key == IMAGEBLOCK) {
521
- if (n->children != NULL) {
522
- temp_str = g_string_new("");
523
- print_odf_node_tree(temp_str,n->children,scratch);
524
- if (temp_str->currentStringLength > 0) {
525
- g_string_append_printf(out, "<text:p>Figure <text:sequence text:name=\"Figure\" text:formula=\"ooow:Figure+1\" style:num-format=\"1\"> Update Fields to calculate numbers</text:sequence>: ");
526
- g_string_append(out, temp_str->str);
527
- g_string_append_printf(out, "</text:p>");
528
- }
529
- g_string_free(temp_str, true);
530
- }
531
- g_string_append_printf(out, "</draw:text-box></draw:frame>\n</text:p>\n");
532
- } else {
533
- g_string_append_printf(out, "</draw:text-box></draw:frame>\n");
534
- }
535
- scratch->padded = 1;
536
-
537
- /* Restore stashed copy */
538
- n->link_data->attr = NULL;
539
- free_link_data(n->link_data);
540
- n->link_data = temp_link_data;
541
-
542
- free(height);
543
- free(width);
544
-
545
- break;
546
- #ifdef DEBUG_ON
547
- fprintf(stderr, "finish image\n");
548
- #endif
549
- case NOTEREFERENCE:
550
- old_type = scratch->odf_para_type;
551
- scratch->odf_para_type = NOTEREFERENCE;
552
- lev = note_number_for_node(n, scratch);
553
- temp_node = node_for_count(scratch->used_notes, lev);
554
- scratch->padded = 2;
555
- scratch->printing_notes = 1;
556
- if (temp_node->key == GLOSSARYSOURCE) {
557
- g_string_append_printf(out, "<text:note text:id=\"\" text:note-class=\"glossary\"><text:note-body>\n");
558
- print_odf_node_tree(out, temp_node->children, scratch);
559
- g_string_append_printf(out, "</text:note-body>\n</text:note>\n");
560
- } else {
561
- g_string_append_printf(out, "<text:note text:id=\"\" text:note-class=\"footnote\"><text:note-body>\n");
562
- print_odf_node_tree(out, temp_node->children, scratch);
563
- g_string_append_printf(out, "</text:note-body>\n</text:note>\n");
564
- }
565
- scratch->printing_notes = 0;
566
- scratch->padded = 1;
567
- scratch->odf_para_type = old_type;
568
- break;
569
- case NOCITATION:
570
- case CITATION:
571
- #ifdef DEBUG_ON
572
- fprintf(stderr, "print cite\n");
573
- #endif
574
- if ((n->link_data != NULL) && (strncmp(n->link_data->label,"[#",2) == 0)) {
575
- /* external citation */
576
- #ifdef DEBUG_ON
577
- fprintf(stderr, "external first??");
578
- #endif
579
- g_string_append_printf(out, "%s", n->link_data->label);
580
- } else {
581
- #ifdef DEBUG_ON
582
- fprintf(stderr, "internal cite\n");
583
- #endif
584
- /* MMD citation, so output as footnote */
585
- /* TODO: create separate stream from footnotes */
586
- scratch->printing_notes = 1;
587
- lev = 0;
588
- if (n->link_data != NULL)
589
- lev = note_number_for_label(n->link_data->label, scratch);
590
- if (lev != 0) {
591
- #ifdef DEBUG_ON
592
- fprintf(stderr, "matching cite found - %d\n", lev);
593
- #endif
594
- temp_node = node_for_count(scratch->used_notes, lev);
595
- /* flag that this is used as a citation */
596
- temp_node->key = CITATIONSOURCE;
597
- if (lev > scratch->max_footnote_num) {
598
- /* first use of this citation */
599
- scratch->max_footnote_num = lev;
600
-
601
- old_type = scratch->odf_para_type;
602
- scratch->odf_para_type = CITATION;
603
-
604
- /* change to represent cite count only */
605
- lev = cite_count_node_from_end(temp_node);
606
- g_string_append_printf(out, "<text:note text:id=\"cite%d\" text:note-class=\"endnote\"><text:note-body>\n", lev);
607
- scratch->padded = 2;
608
- if (temp_node->children != NULL) {
609
- print_odf_node(out, temp_node->children, scratch);
610
- }
611
- pad(out, 1, scratch);
612
- g_string_append_printf(out, "</text:note-body>\n</text:note>\n");
613
- scratch->odf_para_type = old_type;
614
- } else {
615
- /* We are reusing a previous citation */
616
- #ifdef DEBUG_ON
617
- fprintf(stderr, "link to existing cite %d\n", lev);
618
- #endif
619
- /* Change lev to represent cite count only */
620
- lev = cite_count_node_from_end(temp_node);
621
- #ifdef DEBUG_ON
622
- fprintf(stderr, "renumbered to %d\n", lev);
623
- #endif
624
-
625
- g_string_append_printf(out, "<text:span text:style-name=\"Footnote_20_anchor\"><text:note-ref text:note-class=\"endnote\" text:reference-format=\"text\" text:ref-name=\"cite%d\">%d</text:note-ref></text:span>", lev, lev);
626
- }
627
- } else {
628
- /* not located -- this is external cite */
629
- #ifdef DEBUG_ON
630
- fprintf(stderr, "no match for cite: '%s'\n",n->link_data->label);
631
- #endif
632
- if ((n->link_data != NULL) && (n->key == NOCITATION)) {
633
- g_string_append_printf(out, "%s", n->link_data->label);
634
- } else if (n->link_data != NULL) {
635
- g_string_append_printf(out, "[");
636
- if (n->children != NULL) {
637
- print_odf_node(out, n->children, scratch);
638
- g_string_append_printf(out, "][");
639
- }
640
- g_string_append_printf(out, "#%s]",n->link_data->label);
641
- }
642
- }
643
- }
644
- scratch->printing_notes = 0;
645
- if ((n->next != NULL) && (n->next->key == CITATION)) {
646
- g_string_append_printf(out, " ");
647
- }
648
- #ifdef DEBUG_ON
649
- fprintf(stderr, "finish cite\n");
650
- #endif
651
- break;
652
- case VARIABLE:
653
- temp = metavalue_for_key(n->str,scratch->result_tree);
654
- if (temp == NULL) {
655
- g_string_append_printf(out, "[%%%s]",n->str);
656
- } else {
657
- g_string_append_printf(out, temp);
658
- free(temp);
659
- }
660
- break;
661
- case GLOSSARYTERM:
662
- g_string_append_printf(out,"<text:p text:style-name=\"Glossary\">");
663
- print_odf_string(out, n->children->str);
664
- g_string_append_printf(out, ":</text:p>\n");
665
- break;
666
- case GLOSSARYSORTKEY:
667
- break;
668
- case CODE:
669
- g_string_append_printf(out, "<text:span text:style-name=\"Source_20_Text\">");
670
- print_html_string(out, n->str, scratch);
671
- g_string_append_printf(out, "</text:span>");
672
- break;
673
- case BLOCKQUOTEMARKER:
674
- print_odf_node_tree(out, n->children, scratch);
675
- break;
676
- case BLOCKQUOTE:
677
- pad(out,2, scratch);
678
- scratch->padded = 2;
679
- old_type = scratch->odf_para_type;
680
- scratch->odf_para_type = BLOCKQUOTE;
681
- print_odf_node_tree(out, n->children, scratch);
682
- scratch->odf_para_type = old_type;
683
- break;
684
- case RAW:
685
- /* shouldn't happen */
686
- assert(n->key != RAW);
687
- break;
688
- case HTML:
689
- /* don't print HTML */
690
- /* but do print HTML comments for raw ODF */
691
- if (strncmp(n->str,"<!--",4) == 0) {
692
- /* trim "-->" from end */
693
- n->str[strlen(n->str)-3] = '\0';
694
- g_string_append_printf(out, "%s", &n->str[4]);
695
- }
696
- break;
697
- case DEFLIST:
698
- print_odf_node_tree(out, n->children, scratch);
699
- break;
700
- case TERM:
701
- pad(out,1, scratch);
702
- g_string_append_printf(out, "<text:p><text:span text:style-name=\"MMD-Bold\">");
703
- print_odf_node_tree(out, n->children, scratch);
704
- g_string_append_printf(out, "</text:span></text:p>\n");
705
- scratch->padded = 1;
706
- break;
707
- case DEFINITION:
708
- old_type = scratch->odf_para_type;
709
- scratch->odf_para_type = DEFINITION;
710
- pad(out,1, scratch);
711
- scratch->padded = 1;
712
- g_string_append_printf(out, "<text:p text:style-name=\"Quotations\">");
713
- print_odf_node_tree(out, n->children, scratch);
714
- g_string_append_printf(out, "</text:p>\n");
715
- scratch->padded = 0;
716
- scratch->odf_para_type = old_type;
717
- break;
718
- case TABLE:
719
- pad(out,2, scratch);
720
- g_string_append_printf(out, "<table:table>\n");
721
- print_odf_node_tree(out, n->children, scratch);
722
- g_string_append_printf(out, "</table:table>\n");
723
- /* caption if present */
724
- if ((n->children != NULL) && (n->children->key == TABLECAPTION)) {
725
- if (n->children->children->key == TABLELABEL) {
726
- temp = label_from_string(n->children->children->str);
727
- } else {
728
- temp = label_from_node_tree(n->children->children);
729
- }
730
- g_string_append_printf(out,"<text:p><text:bookmark text:name=\"%s\"/>Table <text:sequence text:name=\"Table\" text:formula=\"ooow:Table+1\" style:num-format=\"1\"> Update Fields to calculate numbers</text:sequence>:", temp);
731
- print_odf_node_tree(out,n->children->children, scratch);
732
- g_string_append_printf(out, "<text:bookmark-end text:name=\"%s\"/></text:p>\n",temp);
733
- free(temp);
734
- }
735
- scratch->padded = 1;
736
- scratch->table_alignment = NULL;
737
- break;
738
- case TABLESEPARATOR:
739
- scratch->table_alignment = n->str;
740
- break;
741
- case TABLECAPTION:
742
- break;
743
- case TABLELABEL:
744
- break;
745
- case TABLEHEAD:
746
- for (i=0; i < strlen(scratch->table_alignment); i++) {
747
- g_string_append_printf(out, "<table:table-column/>\n");
748
- }
749
- scratch->cell_type = 'h';
750
- print_odf_node_tree(out, n->children, scratch);
751
- scratch->cell_type = 'd';
752
- break;
753
- case TABLEBODY:
754
- print_odf_node_tree(out, n->children, scratch);
755
- break;
756
- case TABLEROW:
757
- g_string_append_printf(out, "<table:table-row>\n");
758
- scratch->table_column = 0;
759
- print_odf_node_tree(out, n->children, scratch);
760
- g_string_append_printf(out, "</table:table-row>\n");
761
- break;
762
- case TABLECELL:
763
- temp = scratch->table_alignment;
764
- if (strncmp(&temp[scratch->table_column],"h",1) == 0) {
765
- scratch->table_column++;
766
- }
767
- lev = scratch->table_column;
768
- g_string_append_printf(out, "<table:table-cell");
769
- if ((n->children != NULL) && (n->children->key == CELLSPAN)) {
770
- g_string_append_printf(out, " table:number-columns-spanned=\"%d\"", strlen(n->children->str)+1);
771
- scratch->table_column += (int)strlen(n->children->str);
772
- }
773
- g_string_append_printf(out, ">\n<text:p");
774
- if (scratch->cell_type == 'h') {
775
- g_string_append_printf(out, " text:style-name=\"Table_20_Heading\"");
776
- } else {
777
- if ( strncmp(&temp[lev],"r",1) == 0) {
778
- g_string_append_printf(out, " text:style-name=\"MMD-Table-Right\"");
779
- } else if ( strncmp(&temp[lev],"R",1) == 0) {
780
- g_string_append_printf(out, " text:style-name=\"MMD-Table-Right\"");
781
- } else if ( strncmp(&temp[lev],"c",1) == 0) {
782
- g_string_append_printf(out, " text:style-name=\"MMD-Table-Center\"");
783
- } else if ( strncmp(&temp[lev],"C",1) == 0) {
784
- g_string_append_printf(out, " text:style-name=\"MMD-Table-Center\"");
785
- } else {
786
- g_string_append_printf(out, " text:style-name=\"MMD-Table\"");
787
- }
788
- }
789
-
790
- g_string_append_printf(out, ">");
791
- scratch->padded = 2;
792
- print_odf_node_tree(out, n->children, scratch);
793
- g_string_append_printf(out, "</text:p>\n</table:table-cell>\n", scratch->cell_type);
794
- scratch->table_column++;
795
- break;
796
- case CELLSPAN:
797
- break;
798
- case GLOSSARYSOURCE:
799
- if (scratch->printing_notes)
800
- print_odf_node_tree(out, n->children, scratch);
801
- break;
802
- case CITATIONSOURCE:
803
- case NOTESOURCE:
804
- if (scratch->printing_notes)
805
- print_odf_node(out, n->children, scratch);
806
- break;
807
- case SOURCEBRANCH:
808
- fprintf(stderr,"SOURCEBRANCH\n");
809
- break;
810
- case NOTELABEL:
811
- case GLOSSARYLABEL:
812
- break;
813
- case SUPERSCRIPT:
814
- g_string_append_printf(out, "<text:span text:style-name=\"MMD-Superscript\">");
815
- print_html_string(out,n->str, scratch);
816
- g_string_append_printf(out, "</text:span>");
817
- break;
818
- case SUBSCRIPT:
819
- g_string_append_printf(out, "<text:span text:style-name=\"MMD-Subscript\">");
820
- print_html_string(out,n->str, scratch);
821
- g_string_append_printf(out, "</text:span>");
822
- break;
823
- case KEY_COUNTER:
824
- break;
825
- case TOC:
826
- print_odf_node_tree(out,n->children, scratch);
827
- break;
828
- default:
829
- fprintf(stderr, "print_odf_node encountered unknown node key = %d\n",n->key);
830
- exit(EXIT_FAILURE);
831
- }
832
-
833
- #ifdef DEBUG_ON
834
- fprintf(stderr, "finish print_odf_node: %d\n",n->key);
835
- #endif
836
-
837
- }
838
-
839
- /* print_odf_string - print string, escaping for odf */
840
- void print_odf_string(GString *out, char *str) {
841
- char *tmp;
842
- while (*str != '\0') {
843
- switch (*str) {
844
- case '&':
845
- g_string_append_printf(out, "&amp;");
846
- break;
847
- case '<':
848
- g_string_append_printf(out, "&lt;");
849
- break;
850
- case '>':
851
- g_string_append_printf(out, "&gt;");
852
- break;
853
- case '"':
854
- g_string_append_printf(out, "&quot;");
855
- break;
856
- case '\n': case '\r':
857
- tmp = str;
858
- tmp--;
859
- if (*tmp == ' ') {
860
- tmp--;
861
- if (*tmp == ' ') {
862
- g_string_append_printf(out, "<text:line-break/>");
863
- } else {
864
- g_string_append_printf(out, "\n");
865
- }
866
- } else {
867
- g_string_append_printf(out, "\n");
868
- }
869
- break;
870
- case ' ':
871
- tmp = str;
872
- tmp++;
873
- if (*tmp == ' ') {
874
- tmp++;
875
- if (*tmp == ' ') {
876
- tmp++;
877
- if (*tmp == ' ') {
878
- g_string_append_printf(out, "<text:tab/>");
879
- str = tmp;
880
- } else {
881
- g_string_append_printf(out, " ");
882
- }
883
- } else {
884
- g_string_append_printf(out, " ");
885
- }
886
- } else {
887
- g_string_append_printf(out, " ");
888
- }
889
- break;
890
- default:
891
- g_string_append_c(out, *str);
892
- }
893
- str++;
894
- }
895
- }
896
-
897
- /* print_odf_code_string - print string, escaping for HTML and saving newlines
898
- */
899
- void print_odf_code_string(GString *out, char *str) {
900
- char *tmp;
901
- while (*str != '\0') {
902
- switch (*str) {
903
- case '&':
904
- g_string_append_printf(out, "&amp;");
905
- break;
906
- case '<':
907
- g_string_append_printf(out, "&lt;");
908
- break;
909
- case '>':
910
- g_string_append_printf(out, "&gt;");
911
- break;
912
- case '"':
913
- g_string_append_printf(out, "&quot;");
914
- break;
915
- case '\n':
916
- g_string_append_printf(out, "<text:line-break/>");
917
- break;
918
- case ' ':
919
- tmp = str;
920
- tmp++;
921
- if (*tmp == ' ') {
922
- tmp++;
923
- if (*tmp == ' ') {
924
- tmp++;
925
- if (*tmp == ' ') {
926
- g_string_append_printf(out, "<text:tab/>");
927
- str = tmp;
928
- } else {
929
- g_string_append_printf(out, " ");
930
- }
931
- } else {
932
- g_string_append_printf(out, " ");
933
- }
934
- } else {
935
- g_string_append_printf(out, " ");
936
- }
937
- break;
938
- default:
939
- g_string_append_c(out, *str);
940
- }
941
- str++;
942
- }
943
- }
944
-
945
- void print_odf_header(GString *out){
946
- /* Insert required XML header */
947
- g_string_append_printf(out,
948
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" \
949
- "<office:document xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\"\n" \
950
- " xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\"\n" \
951
- " xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\"\n" \
952
- " xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\"\n" \
953
- " xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\"\n" \
954
- " xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\"\n" \
955
- " xmlns:xlink=\"http://www.w3.org/1999/xlink\"\n" \
956
- " xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" \
957
- " xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\"\n" \
958
- " xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\"\n" \
959
- " xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\"\n" \
960
- " xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\"\n" \
961
- " xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\"\n" \
962
- " xmlns:math=\"http://www.w3.org/1998/Math/MathML\"\n" \
963
- " xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\"\n" \
964
- " xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\"\n" \
965
- " xmlns:config=\"urn:oasis:names:tc:opendocument:xmlns:config:1.0\"\n" \
966
- " xmlns:ooo=\"http://openoffice.org/2004/office\"\n" \
967
- " xmlns:ooow=\"http://openoffice.org/2004/writer\"\n" \
968
- " xmlns:oooc=\"http://openoffice.org/2004/calc\"\n" \
969
- " xmlns:dom=\"http://www.w3.org/2001/xml-events\"\n" \
970
- " xmlns:xforms=\"http://www.w3.org/2002/xforms\"\n" \
971
- " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" \
972
- " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" \
973
- " xmlns:rpt=\"http://openoffice.org/2005/report\"\n" \
974
- " xmlns:of=\"urn:oasis:names:tc:opendocument:xmlns:of:1.2\"\n" \
975
- " xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"\n" \
976
- " xmlns:grddl=\"http://www.w3.org/2003/g/data-view#\"\n" \
977
- " xmlns:tableooo=\"http://openoffice.org/2009/table\"\n" \
978
- " xmlns:field=\"urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0\"\n" \
979
- " xmlns:formx=\"urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0\"\n" \
980
- " xmlns:css3t=\"http://www.w3.org/TR/css3-text/\"\n" \
981
- " office:version=\"1.2\"\n" \
982
- " grddl:transformation=\"http://docs.oasis-open.org/office/1.2/xslt/odf2rdf.xsl\"\n" \
983
- " office:mimetype=\"application/vnd.oasis.opendocument.text\">\n");
984
-
985
- /* Font Declarations */
986
- g_string_append_printf(out, "<office:font-face-decls>\n" \
987
- " <style:font-face style:name=\"Courier New\" svg:font-family=\"'Courier New'\"\n" \
988
- " style:font-adornments=\"Regular\"\n" \
989
- " style:font-family-generic=\"modern\"\n" \
990
- " style:font-pitch=\"fixed\"/>\n" \
991
- "</office:font-face-decls>\n");
992
-
993
- /* Append basic style information */
994
- g_string_append_printf(out, "<office:styles>\n" \
995
- "<style:style style:name=\"Standard\" style:family=\"paragraph\" style:class=\"text\">\n" \
996
- " <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.15in\"" \
997
- " fo:text-align=\"justify\" style:justify-single-word=\"false\"/>\n" \
998
- " </style:style>\n" \
999
- "<style:style style:name=\"Preformatted_20_Text\" style:display-name=\"Preformatted Text\"\n" \
1000
- " style:family=\"paragraph\"\n" \
1001
- " style:parent-style-name=\"Standard\"\n" \
1002
- " style:class=\"html\">\n" \
1003
- " <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0in\" fo:text-align=\"start\"\n" \
1004
- " style:justify-single-word=\"false\"/>\n" \
1005
- " <style:text-properties style:font-name=\"Courier New\" fo:font-size=\"11pt\"\n" \
1006
- " style:font-name-asian=\"Courier New\"\n" \
1007
- " style:font-size-asian=\"11pt\"\n" \
1008
- " style:font-name-complex=\"Courier New\"\n" \
1009
- " style:font-size-complex=\"11pt\"/>\n" \
1010
- "</style:style>\n" \
1011
- "<style:style style:name=\"Source_20_Text\" style:display-name=\"Source Text\"\n" \
1012
- " style:family=\"text\">\n" \
1013
- " <style:text-properties style:font-name=\"Courier New\" style:font-name-asian=\"Courier New\"\n" \
1014
- " style:font-name-complex=\"Courier New\"\n" \
1015
- " fo:font-size=\"11pt\"/>\n" \
1016
- "</style:style>\n" \
1017
- "<style:style style:name=\"List\" style:family=\"paragraph\"\n" \
1018
- " style:parent-style-name=\"Standard\"\n" \
1019
- " style:class=\"list\">\n" \
1020
- " <style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
1021
- " <style:text-properties style:font-size-asian=\"12pt\"/>\n" \
1022
- "</style:style>\n" \
1023
- "<style:style style:name=\"Quotations\" style:family=\"paragraph\"\n" \
1024
- " style:parent-style-name=\"Standard\"\n" \
1025
- " style:class=\"html\">\n" \
1026
- " <style:paragraph-properties fo:margin-left=\"0.3937in\" fo:margin-right=\"0.3937in\" fo:margin-top=\"0in\"\n" \
1027
- " fo:margin-bottom=\"0.1965in\"\n" \
1028
- " fo:text-align=\"justify\"" \
1029
- " style:justify-single-word=\"false\"" \
1030
- " fo:text-indent=\"0in\"\n" \
1031
- " style:auto-text-indent=\"false\"/>\n" \
1032
- "</style:style>\n" \
1033
- "<style:style style:name=\"Table_20_Heading\" style:display-name=\"Table Heading\"\n" \
1034
- " style:family=\"paragraph\"\n" \
1035
- " style:parent-style-name=\"Table_20_Contents\"\n" \
1036
- " style:class=\"extra\">\n" \
1037
- " <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"\n" \
1038
- " text:number-lines=\"false\"\n" \
1039
- " text:line-number=\"0\"/>\n" \
1040
- " <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
1041
- " style:font-weight-complex=\"bold\"/>\n" \
1042
- "</style:style>\n" \
1043
- "<style:style style:name=\"Horizontal_20_Line\" style:display-name=\"Horizontal Line\"\n" \
1044
- " style:family=\"paragraph\"\n" \
1045
- " style:parent-style-name=\"Standard\"\n" \
1046
- " style:class=\"html\">\n" \
1047
- " <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.1965in\"\n" \
1048
- " style:border-line-width-bottom=\"0.0008in 0.0138in 0.0008in\"\n" \
1049
- " fo:padding=\"0in\"\n" \
1050
- " fo:border-left=\"none\"\n" \
1051
- " fo:border-right=\"none\"\n" \
1052
- " fo:border-top=\"none\"\n" \
1053
- " fo:border-bottom=\"0.0154in double #808080\"\n" \
1054
- " text:number-lines=\"false\"\n" \
1055
- " text:line-number=\"0\"\n" \
1056
- " style:join-border=\"false\"/>\n" \
1057
- " <style:text-properties fo:font-size=\"6pt\" style:font-size-asian=\"6pt\" style:font-size-complex=\"6pt\"/>\n" \
1058
- "</style:style>\n" \
1059
- "<style:style style:name=\"Footnote_20_anchor\" style:display-name=\"Footnote anchor\"" \
1060
- " style:family=\"text\">" \
1061
- " <style:text-properties style:text-position=\"super 58%%\"/>" \
1062
- " </style:style>\n" \
1063
- " <text:notes-configuration text:note-class=\"footnote\" text:default-style-name=\"Footnote\" text:citation-style-name=\"Footnote_20_Symbol\" text:citation-body-style-name=\"Footnote_20_anchor\" text:master-page-name=\"Footnote\" style:num-format=\"a\" text:start-value=\"0\" text:footnotes-position=\"page\" text:start-numbering-at=\"page\"/>\n" \
1064
- " <text:notes-configuration text:note-class=\"endnote\" text:default-style-name=\"Endnote\" text:citation-style-name=\"Endnote_20_Symbol\" text:citation-body-style-name=\"Endnote_20_anchor\" text:master-page-name=\"Endnote\" style:num-format=\"1\" text:start-value=\"0\"/>\n" \
1065
- "</office:styles>\n");
1066
-
1067
- /* Automatic style information */
1068
- g_string_append_printf(out, "<office:automatic-styles>" \
1069
- " <style:style style:name=\"MMD-Italic\" style:family=\"text\">\n" \
1070
- " <style:text-properties fo:font-style=\"italic\" style:font-style-asian=\"italic\"\n" \
1071
- " style:font-style-complex=\"italic\"/>\n" \
1072
- " </style:style>\n" \
1073
- " <style:style style:name=\"MMD-Bold\" style:family=\"text\">\n" \
1074
- " <style:text-properties fo:font-weight=\"bold\" style:font-weight-asian=\"bold\"\n" \
1075
- " style:font-weight-complex=\"bold\"/>\n" \
1076
- " </style:style>\n" \
1077
- " <style:style style:name=\"MMD-Superscript\" style:family=\"text\">\n" \
1078
- " <style:text-properties style:text-position=\"super 58%%\"/>\n" \
1079
- " </style:style>\n" \
1080
- " <style:style style:name=\"MMD-Subscript\" style:family=\"text\">\n" \
1081
- " <style:text-properties style:text-position=\"sub 58%%\"/>\n" \
1082
- " </style:style>\n" \
1083
- "<style:style style:name=\"MMD-Table\" style:family=\"paragraph\" style:parent-style-name=\"Standard\">\n" \
1084
- " <style:paragraph-properties fo:margin-top=\"0in\" fo:margin-bottom=\"0.05in\"/>\n" \
1085
- "</style:style>\n" \
1086
- "<style:style style:name=\"MMD-Table-Center\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
1087
- " <style:paragraph-properties fo:text-align=\"center\" style:justify-single-word=\"false\"/>\n" \
1088
- "</style:style>\n" \
1089
- "<style:style style:name=\"MMD-Table-Right\" style:family=\"paragraph\" style:parent-style-name=\"MMD-Table\">\n" \
1090
- " <style:paragraph-properties fo:text-align=\"right\" style:justify-single-word=\"false\"/>\n" \
1091
- "</style:style>\n" \
1092
- "<style:style style:name=\"P2\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
1093
- " style:list-style-name=\"L2\">\n" \
1094
- "<style:paragraph-properties fo:text-align=\"start\" style:justify-single-word=\"false\"/>\n" \
1095
- "</style:style>\n" \
1096
- "<style:style style:name=\"fr1\" style:family=\"graphic\" style:parent-style-name=\"Frame\">\n" \
1097
- " <style:graphic-properties style:print-content=\"false\" style:vertical-pos=\"top\"\n" \
1098
- " style:vertical-rel=\"baseline\"\n" \
1099
- " fo:padding=\"0in\"\n" \
1100
- " fo:border=\"none\"\n" \
1101
- " style:shadow=\"none\"/>\n" \
1102
- "</style:style>\n" \
1103
- "<style:style style:name=\"P1\" style:family=\"paragraph\" style:parent-style-name=\"Standard\"\n" \
1104
- " style:list-style-name=\"L1\"/>\n" \
1105
- "<text:list-style style:name=\"L1\">\n" \
1106
- " <text:list-level-style-bullet text:level=\"1\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"\">\n" \
1107
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1108
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.5in\"/>\n" \
1109
- " </style:list-level-properties>\n" \
1110
- " <style:text-properties fo:font-family=\"starbats\" style:font-charset=\"x-symbol\"/>\n" \
1111
- " </text:list-level-style-bullet>\n" \
1112
- " <text:list-level-style-bullet text:level=\"2\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"\">\n" \
1113
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1114
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.75in\"/>\n" \
1115
- " </style:list-level-properties>\n" \
1116
- " <style:text-properties fo:font-family=\"starbats\" style:font-charset=\"x-symbol\"/>\n" \
1117
- " </text:list-level-style-bullet>\n" \
1118
- " <text:list-level-style-bullet text:level=\"3\" text:style-name=\"Numbering_20_Symbols\" style:num-suffix=\".\" text:bullet-char=\"\">\n" \
1119
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1120
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1in\"/>\n" \
1121
- " </style:list-level-properties>\n" \
1122
- " <style:text-properties fo:font-family=\"starbats\" style:font-charset=\"x-symbol\"/>\n" \
1123
- " </text:list-level-style-bullet>\n" \
1124
- " <text:list-level-style-number text:level=\"4\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1125
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1126
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.25in\"/>\n" \
1127
- " </style:list-level-properties>\n" \
1128
- " </text:list-level-style-number>\n" \
1129
- " <text:list-level-style-number text:level=\"5\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1130
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1131
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.5in\"/>\n" \
1132
- " </style:list-level-properties>\n" \
1133
- " </text:list-level-style-number>\n" \
1134
- " <text:list-level-style-number text:level=\"6\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1135
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1136
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.75in\"/>\n" \
1137
- " </style:list-level-properties>\n" \
1138
- " </text:list-level-style-number>\n" \
1139
- " <text:list-level-style-number text:level=\"7\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1140
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1141
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2in\"/>\n" \
1142
- " </style:list-level-properties>\n" \
1143
- " </text:list-level-style-number>\n" \
1144
- " <text:list-level-style-number text:level=\"8\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1145
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1146
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.25in\"/>\n" \
1147
- " </style:list-level-properties>\n" \
1148
- " </text:list-level-style-number>\n" \
1149
- " <text:list-level-style-number text:level=\"9\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1150
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1151
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.5in\"/>\n" \
1152
- " </style:list-level-properties>\n" \
1153
- " </text:list-level-style-number>\n" \
1154
- " <text:list-level-style-number text:level=\"10\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1155
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1156
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.75in\"/>\n" \
1157
- " </style:list-level-properties>\n" \
1158
- " </text:list-level-style-number>\n" \
1159
- "</text:list-style>\n" \
1160
- "<text:list-style style:name=\"L2\">\n" \
1161
- " <text:list-level-style-number text:level=\"1\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1162
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1163
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.5in\"/>\n" \
1164
- " </style:list-level-properties>\n" \
1165
- " </text:list-level-style-number>\n" \
1166
- " <text:list-level-style-number text:level=\"2\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1167
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1168
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"0.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"0.75in\"/>\n" \
1169
- " </style:list-level-properties>\n" \
1170
- " </text:list-level-style-number>\n" \
1171
- " <text:list-level-style-number text:level=\"3\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1172
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1173
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1in\"/>\n" \
1174
- " </style:list-level-properties>\n" \
1175
- " </text:list-level-style-number>\n" \
1176
- " <text:list-level-style-number text:level=\"4\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1177
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1178
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.25in\"/>\n" \
1179
- " </style:list-level-properties>\n" \
1180
- " </text:list-level-style-number>\n" \
1181
- " <text:list-level-style-number text:level=\"5\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1182
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1183
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.5in\"/>\n" \
1184
- " </style:list-level-properties>\n" \
1185
- " </text:list-level-style-number>\n" \
1186
- " <text:list-level-style-number text:level=\"6\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1187
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1188
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"1.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"1.75in\"/>\n" \
1189
- " </style:list-level-properties>\n" \
1190
- " </text:list-level-style-number>\n" \
1191
- " <text:list-level-style-number text:level=\"7\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1192
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1193
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2in\"/>\n" \
1194
- " </style:list-level-properties>\n" \
1195
- " </text:list-level-style-number>\n" \
1196
- " <text:list-level-style-number text:level=\"8\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1197
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1198
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.25in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.25in\"/>\n" \
1199
- " </style:list-level-properties>\n" \
1200
- " </text:list-level-style-number>\n" \
1201
- " <text:list-level-style-number text:level=\"9\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1202
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1203
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.5in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.5in\"/>\n" \
1204
- " </style:list-level-properties>\n" \
1205
- " </text:list-level-style-number>\n" \
1206
- " <text:list-level-style-number text:level=\"10\" text:style-name=\"Standard\" style:num-suffix=\".\" style:num-format=\"1\">\n" \
1207
- " <style:list-level-properties text:list-level-position-and-space-mode=\"label-alignment\">\n" \
1208
- " <style:list-level-label-alignment text:label-followed-by=\"listtab\" text:list-tab-stop-position=\"2.75in\" fo:text-indent=\"-0.25in\" fo:margin-left=\"2.75in\"/>\n" \
1209
- " </style:list-level-properties>\n" \
1210
- " </text:list-level-style-number>\n" \
1211
- "</text:list-style>\n" \
1212
- "</office:automatic-styles>\n" \
1213
- " <office:master-styles>\n" \
1214
- " <style:master-page style:name=\"Endnote\" >\n" \
1215
- " <style:header><text:h text:outline-level=\"2\">Bibliography</text:h></style:header></style:master-page>\n" \
1216
- " <style:master-page style:name=\"Footnote\" style:page-layout-name=\"pm2\"/>\n" \
1217
- " </office:master-styles>\n") ;
1218
- }
1219
-
1220
- void print_odf_footer(GString *out) {
1221
- g_string_append_printf(out, "</office:text>\n</office:body>\n</office:document>");
1222
- }