From 884d25b7aad62478ae53eb9a3759bc2617959843 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 26 Sep 2013 20:32:10 -0400 Subject: Partial fix for #253. This actually fixes the immediate problem. The method on the inlinePattern returns the correct subtree. However, for some reason, the parent element of that subtree is later stripped of all content (perhaps by the inlineplaceholder stuff). So, for example, given this input: ***foo** bar* The inlinepattern returns: foo bar However, later it is reduced to: Interestingly, this still works: ***foo*** Correctly becomes: foo I'm guessing that the tail on the `em` tag in the first instance is tripping things up some how. --- markdown/inlinepatterns.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py index de957ef..04c2351 100644 --- a/markdown/inlinepatterns.py +++ b/markdown/inlinepatterns.py @@ -75,7 +75,8 @@ def build_inlinepatterns(md_instance, **kwargs): inlinePatterns["html"] = HtmlPattern(HTML_RE, md_instance) inlinePatterns["entity"] = HtmlPattern(ENTITY_RE, md_instance) inlinePatterns["not_strong"] = SimpleTextPattern(NOT_STRONG_RE) - inlinePatterns["strong_em"] = DoubleTagPattern(STRONG_EM_RE, 'strong,em') + inlinePatterns["strong_em"] = DoubleTagPattern(A_STRONG_EM_RE, 'strong,em') + inlinePatterns["strong_em_"] = DoubleTagPattern(U_STRONG_EM_RE, 'strong,em') inlinePatterns["strong"] = SimpleTagPattern(STRONG_RE, 'strong') inlinePatterns["emphasis"] = SimpleTagPattern(EMPHASIS_RE, 'em') if md_instance.smart_emphasis: @@ -99,8 +100,9 @@ NOIMG = r'(?