From b828fe7c8de13a495aab924bf025b2c51abfd1f8 Mon Sep 17 00:00:00 2001 From: Jeff Standen Date: Tue, 3 Feb 2015 13:58:47 -0800 Subject: [PATCH] Fixes #283 --- Parsedown.php | 2 +- test/data/image_title.html | 3 ++- test/data/image_title.md | 4 +++- test/data/inline_link_title.html | 2 ++ test/data/inline_link_title.md | 4 ++++ 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 3a6ee44..9bdae22 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -1197,7 +1197,7 @@ class Parsedown return; } - if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]+"|\'[^\']+\'))?[)]/', $remainder, $matches)) + if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches)) { $Element['attributes']['href'] = $matches[1]; diff --git a/test/data/image_title.html b/test/data/image_title.html index 4fc59f6..957c950 100644 --- a/test/data/image_title.html +++ b/test/data/image_title.html @@ -1 +1,2 @@ -

alt

\ No newline at end of file +

alt

+

blank title

\ No newline at end of file diff --git a/test/data/image_title.md b/test/data/image_title.md index 3e58ee5..7ce2849 100644 --- a/test/data/image_title.md +++ b/test/data/image_title.md @@ -1 +1,3 @@ -![alt](/md.png "title") \ No newline at end of file +![alt](/md.png "title") + +![blank title](/md.png "") \ No newline at end of file diff --git a/test/data/inline_link_title.html b/test/data/inline_link_title.html index 22cf309..ecdfd03 100644 --- a/test/data/inline_link_title.html +++ b/test/data/inline_link_title.html @@ -1,4 +1,6 @@

single quotes

double quotes

+

single quotes blank

+

double quotes blank

space

parentheses

\ No newline at end of file diff --git a/test/data/inline_link_title.md b/test/data/inline_link_title.md index d756af1..6e1c5af 100644 --- a/test/data/inline_link_title.md +++ b/test/data/inline_link_title.md @@ -2,6 +2,10 @@ [double quotes](http://example.com "Title") +[single quotes blank](http://example.com '') + +[double quotes blank](http://example.com "") + [space](http://example.com "2 Words") [parentheses](http://example.com/url-(parentheses) "Title") \ No newline at end of file