1
0
mirror of https://github.com/erusev/parsedown.git synced 2025-09-02 19:32:35 +02: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

View File

@@ -1114,6 +1114,8 @@ class Parsedown
{
$Elements = array();
$nonNestables = array_combine($nonNestables, $nonNestables);
# $excerpt is based on the first occurrence of a marker
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
if ( ! empty($nonNestables) and in_array($inlineType, $nonNestables))
if (isset($nonNestables[$inlineType]))
{
continue;
}