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
1 changed files with 14 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']);