]> granicus.if.org Git - multimarkdown/commitdiff
CHANGED: Bring HTML and ODF into line with LaTeX as to output of abbreviatinos on...
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Mon, 6 Mar 2017 14:53:51 +0000 (09:53 -0500)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Mon, 6 Mar 2017 14:53:51 +0000 (09:53 -0500)
Sources/libMultiMarkdown/html.c
Sources/libMultiMarkdown/odf.c

index c4fa0ddcde58f2cf37f2e1f5fec848ecde2482df..327ab1154d9c100e5494ba4116b37700cb543223 100644 (file)
@@ -1118,18 +1118,31 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
 
                                if (temp_short3 == scratch->inline_abbreviations_to_free->size) {
                                        // This is a reference definition
-                                       print_const("<abbr title=\"");
-                                       mmd_print_string_html(out, temp_note->clean_text, false);
-                                       print_const("\">");
-                                       mmd_export_token_tree_html(out, source, t->child, scratch);
-                                       print_const("</abbr>");
+
+                                       if (temp_short2 == scratch->used_abbreviations->size) {
+                                               // This is a re-use of a previously used note
+                                               print_const("<abbr title=\"");
+                                               mmd_print_string_html(out, temp_note->clean_text, false);
+                                               print_const("\">");
+                                               mmd_export_token_tree_html(out, source, t->child, scratch);
+                                               print_const("</abbr>");
+                                       } else {
+                                               // This is the first time this note was used
+                                               mmd_print_string_html(out, temp_note->clean_text, false);
+                                               print_const(" (<abbr title=\"");
+                                               mmd_print_string_html(out, temp_note->clean_text, false);
+                                               print_const("\">");
+                                               mmd_export_token_tree_html(out, source, t->child, scratch);
+                                               print_const("</abbr>)");
+                                       }
                                } else {
-                                       // This is an inline definition
-                                       print_const("<abbr title=\"");
+                                       // This is an inline definition (and therefore the first use)
+                                       mmd_print_string_html(out, temp_note->clean_text, false);
+                                       print_const(" (<abbr title=\"");
                                        mmd_print_string_html(out, temp_note->clean_text, false);
                                        print_const("\">");
                                        mmd_print_string_html(out, temp_note->label_text, false);
-                                       print_const("</abbr>");
+                                       print_const("</abbr>)");
                                }
                        } else {
                                // Note-based syntax disabled
index cb6d69f77b57cd3d01dc806932550b5527421bab..2e02363bc45226503445354b278b008e66c01e2d 100644 (file)
@@ -706,8 +706,12 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                case BRACE_DOUBLE_RIGHT:
                        print_const("}}");
                        break;
+               case BRACKET_ABBREVIATION_LEFT:
+                       print_const("[>");
+                       break;
                case BRACKET_CITATION_LEFT:
                        print_const("[#");
+                       break;
                case BRACKET_LEFT:
                        print_const("[");                       
                        break;
@@ -1180,16 +1184,16 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
 
                                        if (temp_short3 == scratch->inline_abbreviations_to_free->size) {
                                                // This is a reference definition
+                                               mmd_print_string_odf(out, temp_note->clean_text);
+                                               print_const(" (");
                                                mmd_print_string_odf(out, temp_note->label_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>");
+                                               print_const(")");
                                        } else {
                                                // This is an inline definition
-                                               mmd_print_string_odf(out, temp_note->label_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>");
+                                               print_const(" (");
+                                               mmd_print_string_odf(out, temp_note->label_text); 
+                                               print_const(")");
                                        }
 
                                        scratch->odf_para_type = temp_short2;