Merge pull request #615 from aidantwoods/fix/old-handler-compat

Compatability fixes
This commit is contained in:
Aidan Woods 2018-04-12 22:29:29 +01:00 committed by GitHub
commit 0a842fb5b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 4 deletions

View File

@ -264,7 +264,7 @@ class Parsedown
{
if (isset($CurrentBlock))
{
$Elements[] = $CurrentBlock['element'];
$Elements[] = $this->extractElement($CurrentBlock);
}
$Block['identified'] = true;
@ -296,7 +296,7 @@ class Parsedown
{
if (isset($CurrentBlock))
{
$Elements[] = $CurrentBlock['element'];
$Elements[] = $this->extractElement($CurrentBlock);
}
$CurrentBlock = $this->paragraph($Line);
@ -316,7 +316,7 @@ class Parsedown
if (isset($CurrentBlock))
{
$Elements[] = $CurrentBlock['element'];
$Elements[] = $this->extractElement($CurrentBlock);
}
# ~
@ -324,6 +324,16 @@ class Parsedown
return $Elements;
}
protected function extractElement(array $Component)
{
if ( ! isset($Component['element']) and isset($Component['markup']))
{
$Component['element'] = array('rawHtml' => $Component['markup']);
}
return $Component['element'];
}
protected function isBlockContinuable($Type)
{
return method_exists($this, 'block'.$Type.'Continue');
@ -1169,7 +1179,7 @@ class Parsedown
$Elements[] = $InlineText['element'];
# compile the inline
$Elements[] = $Inline['element'];
$Elements[] = $this->extractElement($Inline);
# remove the examined text
$text = substr($text, $Inline['position'] + $Inline['extent']);
@ -1585,6 +1595,7 @@ class Parsedown
{
$function = $Element['handler'];
$argument = $Element['text'];
unset($Element['text']);
$destination = 'rawHtml';
}
else