Skip to content

Commit

Permalink
Prevent failure with data set 77 in CommonMarkWeak
Browse files Browse the repository at this point in the history
  • Loading branch information
aidantwoods authored Oct 13, 2016
1 parent 2db3199 commit 0a43799
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Parsedown.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function setUrlsLinked($urlsLinked)
# Blocks
#

protected function lines(array $lines)
protected function lines(array $lines, $parentType = null)
{
$CurrentBlock = null;

Expand Down Expand Up @@ -216,6 +216,12 @@ protected function lines(array $lines)

$blockTypes = array_merge($highPriority, $blockTypes);

if ( $parentType === 'List' and ($a = array_search('List', $blockTypes)) !== false and ($b = array_search('Code', $blockTypes)) !== false and $a > $b and ($placeholder = $this->blockList($Line)))
{
unset($blockTypes[$b]);
array_splice($blockTypes, $a + 1, 0, 'Code');
}

#
# ~

Expand Down Expand Up @@ -1502,7 +1508,7 @@ protected function elements(array $Elements)

protected function li($lines)
{
$markup = $this->lines($lines);
$markup = $this->lines($lines, 'List');

$trimmedMarkup = trim($markup);

Expand Down

0 comments on commit 0a43799

Please sign in to comment.