From: Fletcher T. Penney Date: Sat, 4 Mar 2017 13:08:48 +0000 (-0500) Subject: ADDED: Add glossary support to ODF X-Git-Tag: 0.4.0-b^2~5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c3bb7d128f93c369c632200e6d5beabb501f8eab;p=multimarkdown ADDED: Add glossary support to ODF --- diff --git a/Sources/libMultiMarkdown/odf.c b/Sources/libMultiMarkdown/odf.c index e710418..46b9626 100644 --- a/Sources/libMultiMarkdown/odf.c +++ b/Sources/libMultiMarkdown/odf.c @@ -534,6 +534,7 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch break; case PAIR_BRACKET_CITATION: case PAIR_BRACKET_FOOTNOTE: + case PAIR_BRACKET_GLOSSARY: print_const(" text:style-name=\"Footnote\">"); break; default: @@ -920,6 +921,43 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch mmd_export_token_tree_odf(out, source, t->child, scratch); } break; + case PAIR_BRACKET_GLOSSARY: + if (scratch->extensions & EXT_NOTES) { + glossary_from_bracket(source, scratch, t, &temp_short); + + if (temp_short == -1) { + print_const("[?"); + mmd_export_token_tree_odf(out, source, t->child, scratch); + print_const("]"); + break; + } + + temp_short2 = scratch->odf_para_type; + scratch->odf_para_type = PAIR_BRACKET_GLOSSARY; + + if (temp_short < scratch->used_glossaries->size) { + // Re-using previous footnote + print("\\footnote{reuse"); + + print("}"); + } else { + // This is a new glossary item + temp_note = stack_peek_index(scratch->used_glossaries, temp_short - 1); + + mmd_print_string_odf(out, temp_note->clean_text); + + printf("", temp_short); + + mmd_export_token_tree_odf(out, source, temp_note->content, scratch); + print_const(""); + } + + scratch->odf_para_type = temp_short2; + } else { + // Footnotes disabled + mmd_export_token_tree_odf(out, source, t->child, scratch); + } + break; case PAIR_BRACKET_VARIABLE: temp_char = text_inside_pair(source, t); temp_char2 = extract_metadata(scratch, temp_char); diff --git a/tests/MMD6Tests/Glossaries.fodt b/tests/MMD6Tests/Glossaries.fodt new file mode 100644 index 0000000..b64c08e --- /dev/null +++ b/tests/MMD6Tests/Glossaries.fodt @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bibliography + + + + Glossaries + + + +fooReference + +barInline + +Foo BarReference + +With second para. + +\footnote{reuse} + +[?bar] + +5 + + +