mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Break out method_exists checks into extendable methods to allow for better pluggability
This commit is contained in:
parent
b166cab9a2
commit
5ad15b87fa
@ -175,7 +175,7 @@ class Parsedown
|
||||
}
|
||||
else
|
||||
{
|
||||
if (method_exists($this, 'block'.$CurrentBlock['type'].'Complete'))
|
||||
if ($this->isBlockCompleteable($CurrentBlock['type']))
|
||||
{
|
||||
$CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
|
||||
}
|
||||
@ -216,7 +216,7 @@ class Parsedown
|
||||
$Block['identified'] = true;
|
||||
}
|
||||
|
||||
if (method_exists($this, 'block'.$blockType.'Continue'))
|
||||
if ($this->isBlockContinueable($blockType))
|
||||
{
|
||||
$Block['continuable'] = true;
|
||||
}
|
||||
@ -245,7 +245,7 @@ class Parsedown
|
||||
|
||||
# ~
|
||||
|
||||
if (isset($CurrentBlock['continuable']) and method_exists($this, 'block'.$CurrentBlock['type'].'Complete'))
|
||||
if (isset($CurrentBlock['continuable']) and $this->isBlockCompleteable($CurrentBlock['type']))
|
||||
{
|
||||
$CurrentBlock = $this->{'block'.$CurrentBlock['type'].'Complete'}($CurrentBlock);
|
||||
}
|
||||
@ -278,6 +278,19 @@ class Parsedown
|
||||
return $markup;
|
||||
}
|
||||
|
||||
#
|
||||
# Allow for plugin extensibility
|
||||
#
|
||||
protected function isBlockContinueable($Type)
|
||||
{
|
||||
return method_exists($this, 'block'.$Type.'Continue');
|
||||
}
|
||||
|
||||
protected function isBlockCompleteable($Type)
|
||||
{
|
||||
return method_exists($this, 'block'.$Type.'Complete');
|
||||
}
|
||||
|
||||
#
|
||||
# Code
|
||||
|
||||
@ -1521,8 +1534,8 @@ class Parsedown
|
||||
'q', 'rt', 'ins', 'font', 'strong',
|
||||
's', 'tt', 'sub', 'mark',
|
||||
'u', 'xm', 'sup', 'nobr',
|
||||
'var', 'ruby',
|
||||
'wbr', 'span',
|
||||
'time',
|
||||
'var', 'ruby',
|
||||
'wbr', 'span',
|
||||
'time',
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user