aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan.limberg@icloud.com>2016-07-26 22:49:08 -0400
committerGitHub <noreply@github.com>2016-07-26 22:49:08 -0400
commit655d1afbeec91ed0cbc57f36219dd1c7808ff47e (patch)
tree86b43b641da6bf341a7e7116fb17450b5e6a44cc
parent0e48b550d8d533c8cf24e5349bb9c7f6a19db1d2 (diff)
parent65170bf24268620598ef0d5a19aa945af5cb22f4 (diff)
downloadmarkdown-655d1afbeec91ed0cbc57f36219dd1c7808ff47e.tar.gz
markdown-655d1afbeec91ed0cbc57f36219dd1c7808ff47e.tar.bz2
markdown-655d1afbeec91ed0cbc57f36219dd1c7808ff47e.zip
Merge pull request #485 from facelessuser/master
Fix image titles not following spec
-rw-r--r--markdown/inlinepatterns.py2
-rw-r--r--tests/misc/image.html4
-rw-r--r--tests/misc/image.txt6
3 files changed, 9 insertions, 3 deletions
diff --git a/markdown/inlinepatterns.py b/markdown/inlinepatterns.py
index dcf4ad4..6d4c969 100644
--- a/markdown/inlinepatterns.py
+++ b/markdown/inlinepatterns.py
@@ -130,7 +130,7 @@ LINK_RE = NOIMG + BRK + \
r'''\(\s*(<.*?>|((?:(?:\(.*?\))|[^\(\)]))*?)\s*((['"])(.*?)\12\s*)?\)'''
# ![alttxt](http://x.com/) or ![alttxt](<http://x.com/>)
-IMAGE_LINK_RE = r'\!' + BRK + r'\s*\((<.*?>|([^")]+"[^"]*"|[^\)]*))\)'
+IMAGE_LINK_RE = r'\!' + BRK + r'\s*\(\s*(<.*?>|([^"\)\s]+\s*"[^"]*"|[^\)\s]*))\s*\)'
# [Google][3]
REFERENCE_RE = NOIMG + BRK + r'\s?\[([^\]]*)\]'
diff --git a/tests/misc/image.html b/tests/misc/image.html
index aa24cef..1171e4e 100644
--- a/tests/misc/image.html
+++ b/tests/misc/image.html
@@ -1,3 +1,5 @@
<p><img alt="Poster" src="http://humane_man.jpg" title="The most humane man." /></p>
<p><img alt="Poster" src="http://humane_man.jpg" title="The most humane man." /></p>
-<p><img alt="Blank" src="" /></p> \ No newline at end of file
+<p><img alt="Blank" src="" /></p>
+<p>![Fail](http://humane man.jpg "The most humane man.")</p>
+<p>![Fail](http://humane man.jpg)</p> \ No newline at end of file
diff --git a/tests/misc/image.txt b/tests/misc/image.txt
index 41a8cf7..3fae16a 100644
--- a/tests/misc/image.txt
+++ b/tests/misc/image.txt
@@ -5,4 +5,8 @@
[Poster]:http://humane_man.jpg "The most humane man."
-![Blank]() \ No newline at end of file
+![Blank]()
+
+![Fail](http://humane man.jpg "The most humane man.")
+
+![Fail](http://humane man.jpg)