break;
case PAIR_BRACKET_GLOSSARY:
if (scratch->extensions & EXT_NOTES) {
+ // Note-based syntax enabled
+
+ // Classify this use
+ temp_short2 = scratch->used_glossaries->size;
+ temp_short3 = scratch->inline_glossaries_to_free->size;
glossary_from_bracket(source, scratch, t, &temp_short);
if (temp_short == -1) {
+ // This instance is not properly formed
print_const("[?");
- mmd_export_token_tree_html(out, source, t->child, scratch);
+ mmd_export_token_tree_html(out, source, t->child->next, scratch);
print_const("]");
break;
}
+ // Get instance of the note used
temp_note = stack_peek_index(scratch->used_glossaries, temp_short - 1);
- if (temp_short < scratch->used_glossaries->size) {
- // Re-using previous glossary
+ if (temp_short2 == scratch->used_glossaries->size) {
+ // This is a re-use of a previously used note
+
printf("<a href=\"#gn:%d\" title=\"%s\" class=\"glossary\">",
temp_short, LC("see glossary"));
-
mmd_print_string_html(out, temp_note->clean_text, false);
-
print_const("</a>");
} else {
- // This is a new glossary
+ // This is the first time this note was used
+
+
printf("<a href=\"#gn:%d\" id=\"gnref:%d\" title=\"%s\" class=\"glossary\">",
temp_short, temp_short, LC("see glossary"));
-
mmd_print_string_html(out, temp_note->clean_text, false);
-
print_const("</a>");
}
} else {
- // Footnotes disabled
+ // Note-based syntax disabled
mmd_export_token_tree_html(out, source, t->child, scratch);
}
break;
break;
case PAIR_BRACKET_GLOSSARY:
if (scratch->extensions & EXT_NOTES) {
- // See whether we create an inline glossary
- temp_short2 = scratch->inline_glossaries_to_free->size;
- glossary_from_bracket(source, scratch, t, &temp_short);
+ // Note-based syntax enabled
+
+ // Classify this use
+ temp_short2 = scratch->used_glossaries->size;
temp_short3 = scratch->inline_glossaries_to_free->size;
+ glossary_from_bracket(source, scratch, t, &temp_short);
if (temp_short == -1) {
+ // This instance is not properly formed
print_const("[?");
- mmd_export_token_tree_latex(out, source, t->child, scratch);
+ mmd_export_token_tree_latex(out, source, t->child->next, scratch);
print_const("]");
break;
}
- if (temp_short2 != temp_short3)
- temp_bool = true; // This is an inline
- else
- temp_bool = false;
-
+ // Get instance of the note used
temp_note = stack_peek_index(scratch->used_glossaries, temp_short - 1);
- if (temp_short < scratch->used_glossaries->size) {
- // Re-using previous glossary
+ if (temp_short2 == scratch->used_glossaries->size) {
+ // This is a re-use of a previously used note
+
print("\\gls{");
print(temp_note->label_text);
print("}");
} else {
- // This is a new glossary
+ // This is the first time this note was used
- if (temp_bool) {
- // This is an inline glossary entry
+ if (temp_short3 == scratch->inline_glossaries_to_free->size) {
+ // This is a reference definition
+ print_const("\\gls{");
+ print(temp_note->label_text);
+ print_const("}");
+ } else {
+ // This is an inline definition
print_const("\\newglossaryentry{");
print(temp_note->label_text);
// We skip over temp_note->content, since that is the term in use
mmd_export_token_tree_latex(out, source, temp_note->content, scratch);
- print_const("}}");
+ print_const("}}\\gls{");
+ print(temp_note->label_text);
+ print_const("}");
}
- print_const("\\gls{");
- print(temp_note->label_text);
- print_const("}");
}
} else {
- // Footnotes disabled
+ // Note-based syntax disabled
mmd_export_token_tree_latex(out, source, t->child, scratch);
}
break;
break;
case PAIR_BRACKET_GLOSSARY:
if (scratch->extensions & EXT_NOTES) {
+ // Note-based syntax enabled
+
+ // Classify this use
+ temp_short2 = scratch->used_glossaries->size;
+ temp_short3 = scratch->inline_glossaries_to_free->size;
glossary_from_bracket(source, scratch, t, &temp_short);
if (temp_short == -1) {
+ // This instance is not properly formed
print_const("[?");
- mmd_export_token_tree_odf(out, source, t->child, scratch);
+ mmd_export_token_tree_odf(out, source, t->child->next, scratch);
print_const("]");
break;
}
- temp_short2 = scratch->odf_para_type;
+ // Get instance of the note used
+ temp_note = stack_peek_index(scratch->used_glossaries, temp_short - 1);
+
+ temp_short3 = 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");
+ if (temp_short2 == scratch->used_glossaries->size) {
+ // This is a re-use of a previously used note
- print("}");
+ mmd_print_string_odf(out, temp_note->clean_text);
} else {
- // This is a new glossary item
- temp_note = stack_peek_index(scratch->used_glossaries, temp_short - 1);
+ // This is the first time this note was used
mmd_print_string_odf(out, temp_note->clean_text);
printf("<text:note text:id=\"gn%d\" text:note-class=\"glossary\"><text:note-body>", temp_short);
-
mmd_export_token_tree_odf(out, source, temp_note->content, scratch);
print_const("</text:note-body></text:note>");
}
- scratch->odf_para_type = temp_short2;
+ scratch->odf_para_type = temp_short3;
} else {
- // Footnotes disabled
+ // Note-based syntax disabled
mmd_export_token_tree_odf(out, source, t->child, scratch);
}
break;
<text:p text:style-name="Footnote">With second para.</text:p></text:note-body></text:note></text:p>
-<text:p text:style-name="Standard">\footnote{reuse}</text:p>
+<text:p text:style-name="Standard">foo</text:p>
<text:p text:style-name="Standard">[?bar]</text:p>