mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Swap undefined type for type === 'Paragraph' for ease of reading
The way in which we use this assumes that it is a paragraph, for example appending text into the handler argument — so there is no loss of generality here, we're simply being explicit.
This commit is contained in:
parent
5353ebb524
commit
ae8067e862
@ -302,8 +302,7 @@ class Parsedown
|
||||
|
||||
if (
|
||||
isset($CurrentBlock)
|
||||
and isset($CurrentBlock['element']['name'])
|
||||
and $CurrentBlock['element']['name'] === 'p'
|
||||
and $CurrentBlock['type'] === 'Paragraph'
|
||||
and ! isset($CurrentBlock['interrupted'])
|
||||
) {
|
||||
$CurrentBlock['element']['handler']['argument'] .= "\n".$text;
|
||||
@ -355,7 +354,7 @@ class Parsedown
|
||||
|
||||
protected function blockCode($Line, $Block = null)
|
||||
{
|
||||
if (isset($Block) and ! isset($Block['type']) and ! isset($Block['interrupted']))
|
||||
if (isset($Block) and $Block['type'] === 'Paragraph' and ! isset($Block['interrupted']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -610,7 +609,7 @@ class Parsedown
|
||||
{
|
||||
if (
|
||||
isset($CurrentBlock)
|
||||
and ! isset($CurrentBlock['type'])
|
||||
and $CurrentBlock['type'] === 'Paragraph'
|
||||
and ! isset($CurrentBlock['interrupted'])
|
||||
) {
|
||||
return;
|
||||
@ -803,7 +802,7 @@ class Parsedown
|
||||
|
||||
protected function blockSetextHeader($Line, array $Block = null)
|
||||
{
|
||||
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
|
||||
if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -890,7 +889,7 @@ class Parsedown
|
||||
|
||||
protected function blockTable($Line, array $Block = null)
|
||||
{
|
||||
if ( ! isset($Block) or isset($Block['type']) or isset($Block['interrupted']))
|
||||
if ( ! isset($Block) or $Block['type'] !== 'Paragraph' or isset($Block['interrupted']))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -1070,18 +1069,17 @@ class Parsedown
|
||||
|
||||
protected function paragraph($Line)
|
||||
{
|
||||
$Block = array(
|
||||
return array(
|
||||
'type' => 'Paragraph',
|
||||
'element' => array(
|
||||
'name' => 'p',
|
||||
'handler' => array(
|
||||
'function' => 'lineElements',
|
||||
'argument' => $Line['text'],
|
||||
'destination' => 'elements',
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return $Block;
|
||||
}
|
||||
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user