Skip to content

Commit dcc984e

Browse files
committed
Fix performance of InlineLexer by delaying URI scheme checking
1 parent 0dd4015 commit dcc984e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packages/guides-restructured-text/src/RestructuredText/Parser/InlineLexer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ protected function getCatchablePatterns(): array
5959
return [
6060
'\\\\``', // must be a separate case, as the next pattern would split in "\`" + "`", causing it to become a intepreted text
6161
'\\\\[\s\S]', // Escaping hell... needs escaped slash in regex, but also in php.
62-
ExternalReferenceResolver::SUPPORTED_SCHEMAS . ':[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*[-a-zA-Z0-9()@%_\\+~#&\\/=]', // standalone hyperlinks
6362
'\\S+@\\S+\\.\\S+',
6463
'[a-z0-9-]+_{2}', //Inline href.
6564
'[a-z0-9-]+_{1}(?=[\s\.+]|$)', //Inline href.
@@ -76,6 +75,7 @@ protected function getCatchablePatterns(): array
7675
'|',
7776
'\\*\\*',
7877
'\\*',
78+
'\b(?<!:)[a-z0-9\\.\-+]{2,}:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*[-a-zA-Z0-9()@%_\\+~#&\\/=]', // standalone hyperlinks
7979
];
8080
}
8181

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<p>Lorem ipsum dolor sit amet <span class="guilabel">Foo Bar</span>.</p>
2-
<p>Lorem ipsum dolor sit amet<span class="guilabel">Foo Bar</span>.</p>
2+
<p>Lorem ipsum dolor sit amet:guilabel:<code>Foo Bar</code>.</p>
33
<p>Lorem ipsum dolor sit amet <span class="guilabel">Foo-Bar</span>.</p>

tests/Functional/tests/guilabel/guilabel.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ Lorem ipsum dolor sit amet :guilabel:`Foo Bar`.
33

44
Lorem ipsum dolor sit amet:guilabel:`Foo Bar`.
55

6-
Lorem ipsum dolor sit amet :guilabel:`Foo-Bar`.
6+
Lorem ipsum dolor sit amet :guilabel:`Foo-Bar`.

0 commit comments

Comments
 (0)