Break less previously passed CommonMarkWeak tests

This commit is contained in:
Aidan Woods 2016-10-12 18:10:44 +01:00 committed by GitHub
parent 8965c7864f
commit 2db3199510
1 changed files with 26 additions and 5 deletions

View File

@ -188,16 +188,34 @@ class Parsedown
# ~
$highPriority = array();
$blockTypes = $this->unmarkedBlockTypes;
if (isset($this->BlockTypes[$marker]))
{
foreach ($this->BlockTypes[$marker] as $blockType)
{
$blockTypes []= $blockType;
if
(
isset($CurrentBlock['type'])
and $CurrentBlock['type'] === $blockType
and ! isset($CurrentBlock['interrupted'])
and isset($CurrentBlock['continuable'])
and ! isset($CurrentBlock['complete'])
)
{
$highPriority[] = $CurrentBlock['type'];
}
else
{
$blockTypes []= $blockType;
}
}
}
$blockTypes = array_merge($highPriority, $blockTypes);
#
# ~
@ -589,8 +607,6 @@ class Parsedown
return null;
}
unset($placeholder);
if ($Line['text'][0] === '[' and $this->blockReference($Line))
{
return $Block;
@ -598,7 +614,7 @@ class Parsedown
if ( ! isset($Block['interrupted']))
{
$text = preg_replace('/^[ ]{0,'.min(4, $Block['indent'] + 1).'}/', '', $Line['body']);
$text = preg_replace('/^[ ]{0,'.min(4, $Block['indent']).'}/', '', $Line['body']);
$Block['li']['text'] []= $text;
@ -609,7 +625,12 @@ class Parsedown
{
$Block['li']['text'] []= '';
$text = preg_replace('/^[ ]{0,'.min(4, $Block['indent'] + 1).'}/', '', $Line['body']);
$text = preg_replace('/^[ ]{0,4}/', '', $Line['body']);
if ($placeholder = $this->blockList($Line))
{
$text = preg_replace('/^[ ]{0,'.min(4, $Block['indent']).'}/', '', $Line['body']);
}
$Block['li']['text'] []= $text;