Add compat for extensions using old markup key.

This commit is contained in:
Aidan Woods 2018-04-12 21:25:50 +01:00
parent b75fd409ff
commit 2bf7ca41a0
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -264,7 +264,7 @@ class Parsedown
{ {
if (isset($CurrentBlock)) if (isset($CurrentBlock))
{ {
$Elements[] = $CurrentBlock['element']; $Elements[] = $this->extractElement($CurrentBlock);
} }
$Block['identified'] = true; $Block['identified'] = true;
@ -296,7 +296,7 @@ class Parsedown
{ {
if (isset($CurrentBlock)) if (isset($CurrentBlock))
{ {
$Elements[] = $CurrentBlock['element']; $Elements[] = $this->extractElement($CurrentBlock);
} }
$CurrentBlock = $this->paragraph($Line); $CurrentBlock = $this->paragraph($Line);
@ -316,7 +316,7 @@ class Parsedown
if (isset($CurrentBlock)) if (isset($CurrentBlock))
{ {
$Elements[] = $CurrentBlock['element']; $Elements[] = $this->extractElement($CurrentBlock);
} }
# ~ # ~
@ -324,6 +324,16 @@ class Parsedown
return $Elements; 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) protected function isBlockContinuable($Type)
{ {
return method_exists($this, 'block'.$Type.'Continue'); return method_exists($this, 'block'.$Type.'Continue');
@ -1169,7 +1179,7 @@ class Parsedown
$Elements[] = $InlineText['element']; $Elements[] = $InlineText['element'];
# compile the inline # compile the inline
$Elements[] = $Inline['element']; $Elements[] = $this->extractElement($Inline);
# remove the examined text # remove the examined text
$text = substr($text, $Inline['position'] + $Inline['extent']); $text = substr($text, $Inline['position'] + $Inline['extent']);