1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

Compare commits

..

3 Commits
0.9.2 ... 0.9.3

Author SHA1 Message Date
95e9878fb0 improve tests 2014-02-06 02:37:09 +02:00
611aed179d simplify reference 2014-02-06 02:36:22 +02:00
abb88d59fa fix reference 2014-02-06 02:36:11 +02:00
5 changed files with 24 additions and 14 deletions

View File

@ -438,6 +438,11 @@ class Parsedown
$substring = substr($outdented_line, $position + 2);
$substring = trim($substring);
if ($substring === '')
{
break;
}
if ($substring[0] === '<')
{
$position = strpos($substring, '>');
@ -471,22 +476,19 @@ class Parsedown
if ($substring !== false)
{
if ($substring[0] !== '"' and $substring[0] !== "'" and $substring[0] !== '(')
{
break;
}
$last_char = substr($substring, -1);
switch (true)
if ($last_char !== '"' and $last_char !== "'" and $last_char !== ')')
{
case $substring[0] === '"' and $substring[0] === $last_char:
case $substring[0] === "'" and $substring[0] === $last_char:
case $substring[0] === '(' and $last_char === ')':
$reference['#'] = substr($substring, 1, -1);
break;
default:
break 2;
break;
}
$reference['#'] = substr($substring, 1, -1);
}
$this->reference_map[$label] = $reference;

View File

@ -0,0 +1 @@
<p><a href="http://example.com" title="Title">single quotes</a> and <a href="http://example.com" title="Title">double quotes</a></p>

View File

@ -0,0 +1 @@
[single quotes](http://example.com 'Title') and [double quotes](http://example.com "Title")

View File

@ -1 +1,2 @@
<p><a href="http://example.com" title="Title">single quotes</a> and <a href="http://example.com" title="Title">double quotes</a></p>
<p><a href="http://example.com" title="example title">double quotes</a> and <a href="http://example.com" title="example title">single quotes</a> and <a href="http://example.com" title="example title">parentheses</a></p>
<p>[invalid title]: <a href="http://example.com">http://example.com</a> example title</p>

View File

@ -1 +1,6 @@
[single quotes](http://example.com 'Title') and [double quotes](http://example.com "Title")
[double quotes] and [single quotes] and [parentheses]
[double quotes]: http://example.com "example title"
[single quotes]: http://example.com 'example title'
[parentheses]: http://example.com (example title)
[invalid title]: http://example.com example title