mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
d29ff18299 | |||
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;
|
||||
@ -1026,7 +1028,7 @@ class Parsedown
|
||||
|
||||
case '`':
|
||||
|
||||
if (preg_match('/^(`+)[ ]*(.+?)[ ]*\1(?!`)/', $text, $matches))
|
||||
if (preg_match('/^(`+)[ ]*(.+?)[ ]*(?<!`)\1(?!`)/', $text, $matches))
|
||||
{
|
||||
$element_text = $matches[2];
|
||||
$element_text = htmlspecialchars($element_text, ENT_NOQUOTES, 'UTF-8');
|
||||
|
@ -2,4 +2,5 @@
|
||||
<p><code>this is also a codespan</code> trailing text</p>
|
||||
<p><code>and look at this one!</code></p>
|
||||
<p>single backtick in a code span: <code>`</code></p>
|
||||
<p>backtick-delimited string in a code span: <code>`foo`</code></p>
|
||||
<p>backtick-delimited string in a code span: <code>`foo`</code></p>
|
||||
<p><code>sth `` sth</code></p>
|
@ -6,4 +6,6 @@ a `code span`
|
||||
|
||||
single backtick in a code span: `` ` ``
|
||||
|
||||
backtick-delimited string in a code span: `` `foo` ``
|
||||
backtick-delimited string in a code span: `` `foo` ``
|
||||
|
||||
`sth `` sth`
|
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