mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Extend disallowed assertion depth capabilities
I've built on the functionality of feature 1. in the previous commit to allow non nestables to be asserted indefinitely, or to a specified depth.
This commit is contained in:
parent
d6d5f53ff4
commit
4d3600f273
@ -1003,10 +1003,23 @@ class Parsedown
|
||||
|
||||
foreach ($this->InlineTypes[$marker] as $inlineType)
|
||||
{
|
||||
|
||||
if(in_array($inlineType, $non_nestables))
|
||||
foreach ($non_nestables as $key => $non_nestable)
|
||||
{
|
||||
continue;
|
||||
if (is_array($non_nestable))
|
||||
{
|
||||
|
||||
if ($non_nestable[0] === $inlineType)
|
||||
{
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($non_nestable === $inlineType)
|
||||
{
|
||||
continue 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$Inline = $this->{'inline'.$inlineType}($Excerpt);
|
||||
@ -1030,6 +1043,26 @@ class Parsedown
|
||||
$Inline['position'] = $markerPosition;
|
||||
}
|
||||
|
||||
foreach ($non_nestables as $key => $non_nestable)
|
||||
{
|
||||
if (is_array($non_nestable) && isset($non_nestable[1]) && is_int($non_nestable[1])){
|
||||
if($non_nestable[1] > 1)
|
||||
{
|
||||
$Inline['element']['non_nestables'][] = array($non_nestable[0], $non_nestable[1] -1);
|
||||
}
|
||||
|
||||
}
|
||||
elseif (is_array($non_nestable) && ! isset($non_nestable[1]))
|
||||
{
|
||||
$Inline['element']['non_nestables'][] = array($non_nestable[0]);
|
||||
}
|
||||
elseif ( ! is_array($non_nestable))
|
||||
{
|
||||
$Inline['element']['non_nestables'][] = $non_nestable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# the text that comes before the inline
|
||||
$unmarkedText = substr($text, 0, $Inline['position']);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user