From: Fletcher T. Penney Date: Wed, 10 Jan 2018 16:30:42 +0000 (-0500) Subject: FIXED: Properly assign ambidextrous tokens in tables X-Git-Tag: 6.3.0^2~7^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7a90534908cd58a2ff4572b2a5950c7d10b1353c;p=multimarkdown FIXED: Properly assign ambidextrous tokens in tables --- diff --git a/Sources/libMultiMarkdown/html.c b/Sources/libMultiMarkdown/html.c index 0fa1f28..fa782f8 100644 --- a/Sources/libMultiMarkdown/html.c +++ b/Sources/libMultiMarkdown/html.c @@ -368,12 +368,12 @@ void mmd_export_image_html(DString * out, const char * source, token * text, lin if (strcmp(a->key, "width") == 0) { width = strip_dimension_units(a->value); - if (strlen(width) + 2 == strlen(a->value)) { - if (strcmp(&(a->value[strlen(width)]), "px") == 0) { - a->value[strlen(width)] = '\0'; - } - } - + if (strlen(width) + 2 == strlen(a->value)) { + if (strcmp(&(a->value[strlen(width)]), "px") == 0) { + a->value[strlen(width)] = '\0'; + } + } + if (strcmp(a->value, width) == 0) { print_const(" "); print(a->key); @@ -389,12 +389,12 @@ void mmd_export_image_html(DString * out, const char * source, token * text, lin } else if (strcmp(a->key, "height") == 0) { height = strip_dimension_units(a->value); - if (strlen(height) + 2 == strlen(a->value)) { - if (strcmp(&(a->value[strlen(height)]), "px") == 0) { - a->value[strlen(height)] = '\0'; - } - } - + if (strlen(height) + 2 == strlen(a->value)) { + if (strcmp(&(a->value[strlen(height)]), "px") == 0) { + a->value[strlen(height)] = '\0'; + } + } + if (strcmp(a->value, height) == 0) { print_const(" "); print(a->key); @@ -2074,27 +2074,27 @@ void mmd_export_token_html_raw(DString * out, const char * source, token * t, sc print_const("<"); break; - case CRITIC_COM_OPEN: - print_const("{>>"); - break; - - case CRITIC_COM_CLOSE: - print_const("<<}"); - break; - - case CRITIC_SUB_DIV: - print_const("~>"); - break; - - case CRITIC_SUB_DIV_A: - print_const("~"); - break; - - case CRITIC_SUB_DIV_B: - print_const(">"); - break; - - case ESCAPED_CHARACTER: + case CRITIC_COM_OPEN: + print_const("{>>"); + break; + + case CRITIC_COM_CLOSE: + print_const("<<}"); + break; + + case CRITIC_SUB_DIV: + print_const("~>"); + break; + + case CRITIC_SUB_DIV_A: + print_const("~"); + break; + + case CRITIC_SUB_DIV_B: + print_const(">"); + break; + + case ESCAPED_CHARACTER: print_const("\\"); mmd_print_char_html(out, source[t->start + 1], false); break; diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 2ffde95..f811a60 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -1281,6 +1281,9 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size case BLOCK_SETEXT_1: case BLOCK_SETEXT_2: case BLOCK_TABLE: + case BLOCK_TABLE_SECTION: + case TABLE_ROW: + case TABLE_CELL: case BLOCK_TERM: case LINE_LIST_BULLETED: case LINE_LIST_ENUMERATED: diff --git a/tests/MMD6Tests/Tables.fodt b/tests/MMD6Tests/Tables.fodt index 1a75d8b..e3fb9d0 100644 --- a/tests/MMD6Tests/Tables.fodt +++ b/tests/MMD6Tests/Tables.fodt @@ -435,10 +435,10 @@ office:mimetype="application/vnd.oasis.opendocument.text"> - :—– + :—- - —–: + —-: diff --git a/tests/MMD6Tests/Tables.html b/tests/MMD6Tests/Tables.html index 958882d..13dde9d 100644 --- a/tests/MMD6Tests/Tables.html +++ b/tests/MMD6Tests/Tables.html @@ -127,8 +127,8 @@ bar6 - :—– - —–: + :—- + —-: foo diff --git a/tests/MMD6Tests/Tables.tex b/tests/MMD6Tests/Tables.tex index 6e6d7ba..851eb26 100644 --- a/tests/MMD6Tests/Tables.tex +++ b/tests/MMD6Tests/Tables.tex @@ -78,7 +78,7 @@ \bottomrule foo6 & bar6 \\ - :----- & -----: \\ + :---- & ----: \\ \emph{foo} & \emph{bar} \\ \multicolumn{2}{l}{ \textbf{foo bar} }\\ \bottomrule