Skip to content

Commit

Permalink
Break less previously passed CommonMarkWeak tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aidantwoods authored Oct 12, 2016
1 parent 8965c78 commit 2db3199
Showing 1 changed file with 26 additions and 5 deletions.
31 changes: 26 additions & 5 deletions Parsedown.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,34 @@ protected function lines(array $lines)

# ~

$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);

#
# ~

Expand Down Expand Up @@ -589,16 +607,14 @@ protected function blockListContinue($Line, array $Block)
return null;
}

unset($placeholder);

if ($Line['text'][0] === '[' and $this->blockReference($Line))
{
return $Block;
}

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;

Expand All @@ -609,7 +625,12 @@ protected function blockListContinue($Line, array $Block)
{
$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;

Expand Down

0 comments on commit 2db3199

Please sign in to comment.