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

@ -6,3 +6,7 @@ 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>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

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