From 6635b331b5ac9c8e12b112fd993cec8b89026f93 Mon Sep 17 00:00:00 2001 From: "Fletcher T. Penney" Date: Mon, 17 Apr 2017 09:50:38 -0400 Subject: [PATCH] FIXED: Fix underscore strong/emph around punctuation --- Sources/libMultiMarkdown/mmd.c | 6 +++--- tests/MMD6Tests/Emph and Strong Star.fodt | 4 ++++ tests/MMD6Tests/Emph and Strong Star.html | 4 ++++ tests/MMD6Tests/Emph and Strong Star.htmlc | 4 ++++ tests/MMD6Tests/Emph and Strong Star.tex | 4 ++++ tests/MMD6Tests/Emph and Strong Star.text | 4 ++++ tests/MMD6Tests/Emph and Strong UL.fodt | 8 +++++++- tests/MMD6Tests/Emph and Strong UL.html | 8 +++++++- tests/MMD6Tests/Emph and Strong UL.htmlc | 8 +++++++- tests/MMD6Tests/Emph and Strong UL.tex | 8 +++++++- tests/MMD6Tests/Emph and Strong UL.text | 6 ++++++ 11 files changed, 57 insertions(+), 7 deletions(-) diff --git a/Sources/libMultiMarkdown/mmd.c b/Sources/libMultiMarkdown/mmd.c index 4e4af0f..a3ec204 100644 --- a/Sources/libMultiMarkdown/mmd.c +++ b/Sources/libMultiMarkdown/mmd.c @@ -1198,8 +1198,8 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size offset--; } - if ((offset == 0) || (char_is_whitespace_or_line_ending_or_punctuation(str[offset]))) { - // Whitespace or punctuation to left, so can't close + if ((offset == 0) || (char_is_whitespace_or_line_ending(str[offset]))) { + // Whitespace to left, so can't close t->can_close = 0; } @@ -1215,7 +1215,7 @@ void mmd_assign_ambidextrous_tokens_in_block(mmd_engine * e, token * block, size while ((str[offset] == '*') || (str[offset] == '_')) offset++; - if (char_is_whitespace_or_line_ending_or_punctuation(str[offset])) { + if (char_is_whitespace_or_line_ending(str[offset])) { // Whitespace to right, so can't open t->can_open = 0; } diff --git a/tests/MMD6Tests/Emph and Strong Star.fodt b/tests/MMD6Tests/Emph and Strong Star.fodt index 3017655..8b2a992 100644 --- a/tests/MMD6Tests/Emph and Strong Star.fodt +++ b/tests/MMD6Tests/Emph and Strong Star.fodt @@ -392,6 +392,10 @@ foo: bar +foo [bar] + +50 + *foo *foo *foo diff --git a/tests/MMD6Tests/Emph and Strong Star.html b/tests/MMD6Tests/Emph and Strong Star.html index 398dd27..55a4c19 100644 --- a/tests/MMD6Tests/Emph and Strong Star.html +++ b/tests/MMD6Tests/Emph and Strong Star.html @@ -122,6 +122,10 @@

foo: bar

+

foo [bar]

+ +

50

+

*foo *foo *foo diff --git a/tests/MMD6Tests/Emph and Strong Star.htmlc b/tests/MMD6Tests/Emph and Strong Star.htmlc index cad2f55..ed66495 100644 --- a/tests/MMD6Tests/Emph and Strong Star.htmlc +++ b/tests/MMD6Tests/Emph and Strong Star.htmlc @@ -117,6 +117,10 @@ latex config: article

foo: bar

+

foo [bar]

+ +

50

+

*foo *foo *foo diff --git a/tests/MMD6Tests/Emph and Strong Star.tex b/tests/MMD6Tests/Emph and Strong Star.tex index fd82256..5b1cf15 100644 --- a/tests/MMD6Tests/Emph and Strong Star.tex +++ b/tests/MMD6Tests/Emph and Strong Star.tex @@ -118,6 +118,10 @@ foo \textbf{1. bar} \textbf{foo:} bar +\emph{foo [bar]} + +50 + *foo *foo *foo diff --git a/tests/MMD6Tests/Emph and Strong Star.text b/tests/MMD6Tests/Emph and Strong Star.text index 74ffd59..105a8c4 100644 --- a/tests/MMD6Tests/Emph and Strong Star.text +++ b/tests/MMD6Tests/Emph and Strong Star.text @@ -117,6 +117,10 @@ foo **1. bar** **foo:** bar +*foo [bar]* + +50 + *foo *foo *foo diff --git a/tests/MMD6Tests/Emph and Strong UL.fodt b/tests/MMD6Tests/Emph and Strong UL.fodt index ab30a8a..30c33ab 100644 --- a/tests/MMD6Tests/Emph and Strong UL.fodt +++ b/tests/MMD6Tests/Emph and Strong UL.fodt @@ -386,10 +386,16 @@ foo___bar foo___bar -foo __- bar__ +foo - bar foo 1. bar +foo: bar + +foo [bar] + +50 + _foo _foo _foo diff --git a/tests/MMD6Tests/Emph and Strong UL.html b/tests/MMD6Tests/Emph and Strong UL.html index 155d28f..1a1d458 100644 --- a/tests/MMD6Tests/Emph and Strong UL.html +++ b/tests/MMD6Tests/Emph and Strong UL.html @@ -116,10 +116,16 @@

foo___bar foo___bar

-

foo __- bar__

+

foo - bar

foo 1. bar

+

foo: bar

+ +

foo [bar]

+ +

50

+

_foo _foo _foo diff --git a/tests/MMD6Tests/Emph and Strong UL.htmlc b/tests/MMD6Tests/Emph and Strong UL.htmlc index a351fe1..ab3f06e 100644 --- a/tests/MMD6Tests/Emph and Strong UL.htmlc +++ b/tests/MMD6Tests/Emph and Strong UL.htmlc @@ -111,10 +111,16 @@ latex config: article

foo___bar foo___bar

-

foo __- bar__

+

foo - bar

foo 1. bar

+

foo: bar

+ +

foo [bar]

+ +

50

+

_foo _foo _foo diff --git a/tests/MMD6Tests/Emph and Strong UL.tex b/tests/MMD6Tests/Emph and Strong UL.tex index 0940964..07a765b 100644 --- a/tests/MMD6Tests/Emph and Strong UL.tex +++ b/tests/MMD6Tests/Emph and Strong UL.tex @@ -112,10 +112,16 @@ foo\_\_\_bar foo\_\_\_bar foo\_\_\_bar -foo \_\_- bar\_\_ +foo \textbf{- bar} foo \textbf{1. bar} +\textbf{foo:} bar + +\emph{foo [bar]} + +50 + \_foo \_foo \_foo diff --git a/tests/MMD6Tests/Emph and Strong UL.text b/tests/MMD6Tests/Emph and Strong UL.text index 7f4c95e..c101873 100644 --- a/tests/MMD6Tests/Emph and Strong UL.text +++ b/tests/MMD6Tests/Emph and Strong UL.text @@ -115,6 +115,12 @@ foo __- bar__ foo __1. bar__ +__foo:__ bar + +_foo [bar]_ + +50 + _foo _foo _foo -- 2.40.0