aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2011-06-07 09:45:16 -0400
committerWaylan Limberg <waylan@gmail.com>2011-06-07 09:45:16 -0400
commitbca0d6bf8b26707431c936ed51419358b9e57749 (patch)
tree3bd09762db01666b65b03ac581d5be4d850c6495
parentee6a843c1029b52f4a0ce00ebdd8d45523535ee0 (diff)
downloadmarkdown-bca0d6bf8b26707431c936ed51419358b9e57749.tar.gz
markdown-bca0d6bf8b26707431c936ed51419358b9e57749.tar.bz2
markdown-bca0d6bf8b26707431c936ed51419358b9e57749.zip
Fixed #19. Improved Start Emphasis regex.
-rw-r--r--markdown/inlinepatterns.py2
-rw-r--r--tests/misc/em_strong.html3
-rw-r--r--tests/misc/em_strong.txt1
3 files changed, 4 insertions, 2 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index 6cec968..0267482 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -100,7 +100,7 @@ ESCAPE_RE = r'\\(.)' # \<
EMPHASIS_RE = r'(\*)([^\*]+)\2' # *emphasis*
STRONG_RE = r'(\*{2}|_{2})(.+?)\2' # **strong**
STRONG_EM_RE = r'(\*{3}|_{3})(.+?)\2' # ***strong***
-SMART_EMPHASIS_RE = r'(?<!\w)(_)(\S.+?)\2(?!\w)' # _smart_emphasis_
+SMART_EMPHASIS_RE = r'(?<!\w)(_)(?!_)(.+?)(?<!_)\2(?!\w)' # _smart_emphasis_
EMPHASIS_2_RE = r'(_)(.+?)\2' # _emphasis_
LINK_RE = NOIMG + BRK + \
r'''\(\s*(<.*?>|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12\s*)?\)'''
diff --git a/tests/misc/em_strong.html b/tests/misc/em_strong.html
index 75c92d8..776381b 100644
--- a/tests/misc/em_strong.html
+++ b/tests/misc/em_strong.html
@@ -7,4 +7,5 @@
<p>three asterisks: ***</p>
<p>with spaces: * * *</p>
<p>three underscores: ___</p>
-<p>with spaces: _ _ _</p> \ No newline at end of file
+<p>with spaces: _ _ _</p>
+<p>One char: <em>a</em></p> \ No newline at end of file
diff --git a/tests/misc/em_strong.txt b/tests/misc/em_strong.txt
index d0774ad..1285665 100644
--- a/tests/misc/em_strong.txt
+++ b/tests/misc/em_strong.txt
@@ -18,3 +18,4 @@ three underscores: ___
with spaces: _ _ _
+One char: _a_