mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
95e9878fb0 | |||
611aed179d | |||
abb88d59fa |
@ -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;
|
||||
|
1
tests/data/inline_link_title.html
Normal file
1
tests/data/inline_link_title.html
Normal 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>
|
1
tests/data/inline_link_title.md
Normal file
1
tests/data/inline_link_title.md
Normal file
@ -0,0 +1 @@
|
||||
[single quotes](http://example.com 'Title') and [double quotes](http://example.com "Title")
|
@ -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>
|
@ -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
|
Reference in New Issue
Block a user