]> granicus.if.org Git - multimarkdown/commitdiff
ADDED: Restructure superscript
authorFletcher T. Penney <fletcher@fletcherpenney.net>
Fri, 5 May 2017 01:28:03 +0000 (21:28 -0400)
committerFletcher T. Penney <fletcher@fletcherpenney.net>
Fri, 5 May 2017 01:28:03 +0000 (21:28 -0400)
Sources/libMultiMarkdown/html.c
Sources/libMultiMarkdown/include/libMultiMarkdown.h
Sources/libMultiMarkdown/latex.c
Sources/libMultiMarkdown/mmd.c
Sources/libMultiMarkdown/odf.c

index 1a5b21b76882abb0f77accb35c37d384eac80a82..ce531d69d1e280c6e82cf4de21a7a2d4150bfa83 100644 (file)
@@ -1515,6 +1515,8 @@ void mmd_export_token_html(DString * out, const char * source, token * t, scratc
                case PAIR_QUOTE_SINGLE:
                case PAIR_STAR:
                case PAIR_STRONG:
+               case PAIR_SUBSCRIPT:
+               case PAIR_SUPERSCRIPT:
                case PAIR_UL:
                        mmd_export_token_tree_html(out, source, t->child, scratch);
                        break;
index 649706fac0c39899f076516f091ecf95153b319b..47330e88ae739713faa531fc20ff1edc0da2ae36 100644 (file)
@@ -208,6 +208,7 @@ enum token_types {
        PAIR_QUOTE_SINGLE,
        PAIR_QUOTE_DOUBLE,
        PAIR_QUOTE_ALT,
+       PAIR_SUBSCRIPT,
        PAIR_SUPERSCRIPT,
        PAIR_STAR,
        PAIR_STRONG,
index 836bdf4023e22baaa694aefd9b71bccc597464a6..93d4d94c4084046c1115472c2cf44b24bb94a0f5 100644 (file)
@@ -1467,6 +1467,8 @@ void mmd_export_token_latex(DString * out, const char * source, token * t, scrat
                case PAIR_QUOTE_SINGLE:
                case PAIR_STAR:
                case PAIR_STRONG:
+               case PAIR_SUBSCRIPT:
+               case PAIR_SUPERSCRIPT:
                case PAIR_UL:
                        mmd_export_token_tree_latex(out, source, t->child, scratch);
                        break;
index e4fe6871ca8f45e2727827cc4bcb62a69ab6d825..ee46b64ae78f1adcd54e396ab2f41f095e56450e 100644 (file)
@@ -172,8 +172,8 @@ mmd_engine * mmd_engine_create(DString * d, unsigned long extensions) {
        
                // Superscript/Subscript
                if (!(extensions & EXT_COMPATIBILITY)) {
-                       token_pair_engine_add_pairing(e->pairings4, SUPERSCRIPT, SUPERSCRIPT, PAIR_SUPERSCRIPT, 0);
-                       token_pair_engine_add_pairing(e->pairings4, SUBSCRIPT, SUBSCRIPT, PAIR_SUPERSCRIPT, 0);
+                       token_pair_engine_add_pairing(e->pairings4, SUPERSCRIPT, SUPERSCRIPT, PAIR_SUPERSCRIPT, PAIRING_PRUNE_MATCH);
+                       token_pair_engine_add_pairing(e->pairings4, SUBSCRIPT, SUBSCRIPT, PAIR_SUBSCRIPT, PAIRING_PRUNE_MATCH);
                }
 
        }
@@ -1330,8 +1330,10 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size
                                break;
                        case SUPERSCRIPT:
                        case SUBSCRIPT:
-                               if (e->extensions & EXT_COMPATIBILITY)
+                               if (e->extensions & EXT_COMPATIBILITY) {
+                                       t->type = TEXT_PLAIN;
                                        break;
+                               }
 
                                offset = t->start;
 
index dccb0b3f550ec8481b1144c2f96204d7b9e236e3..27fd11d526cad37bd12bd7509c2f6a0d701df321 100644 (file)
@@ -1391,6 +1391,8 @@ void mmd_export_token_odf(DString * out, const char * source, token * t, scratch
                case PAIR_QUOTE_SINGLE:
                case PAIR_STAR:
                case PAIR_STRONG:
+               case PAIR_SUBSCRIPT:
+               case PAIR_SUPERSCRIPT:
                case PAIR_UL:
                        mmd_export_token_tree_odf(out, source, t->child, scratch);
                        break;