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

Use non-nestable values as keys for O(1) lookup

This commit is contained in:
Aidan Woods 2018-04-08 20:38:21 +01:00
parent 90ad738933
commit 70f5c02d47
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -1114,6 +1114,8 @@ class Parsedown
{ {
$Elements = array(); $Elements = array();
$nonNestables = array_combine($nonNestables, $nonNestables);
# $excerpt is based on the first occurrence of a marker # $excerpt is based on the first occurrence of a marker
while ($excerpt = strpbrk($text, $this->inlineMarkerList)) while ($excerpt = strpbrk($text, $this->inlineMarkerList))
@ -1128,7 +1130,7 @@ class Parsedown
{ {
# check to see if the current inline type is nestable in the current context # check to see if the current inline type is nestable in the current context
if ( ! empty($nonNestables) and in_array($inlineType, $nonNestables)) if (isset($nonNestables[$inlineType]))
{ {
continue; continue;
} }