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

Normalise link reference lookups

Ref: https://github.com/erusev/parsedown/pull/104
This commit is contained in:
Aidan Woods 2019-02-22 16:10:40 +00:00
parent 7f6127f3f8
commit 33522f0aa4
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
3 changed files with 16 additions and 2 deletions

View File

@ -79,6 +79,8 @@ final class Link implements Inline
$definition = \strtolower($label);
}
$definition = \preg_replace('/\s++/', ' ', \trim($definition));
$data = $State->get(DefinitionBook::class)->lookup($definition);
if (! isset($data)) {

View File

@ -5,4 +5,8 @@
one</a> defined on 2 lines</p>
<p><a href="http://example.com">one</a> with a mixed case label and an upper case definition</p>
<p><a href="http://example.com">one</a> with the a label on the next line</p>
<p><a href="http://example.com"><code>link</code></a></p>
<p><a href="http://example.com"><code>link</code></a></p>
<p>This one has a <a href="/foo">line
break</a>.</p>
<p>This one has a <a href="/foo">line
break</a> with a line-ending space.</p>

View File

@ -18,4 +18,12 @@ one][website] defined on 2 lines
[one]
[1] with the a label on the next line
[`link`][website]
[`link`][website]
This one has a [line
break].
This one has a [line
break] with a line-ending space.
[line break]: /foo