From 043c55e4c6f6cb2bfb6b9399e2f73b56f83ddb8b Mon Sep 17 00:00:00 2001 From: Aidan Woods Date: Mon, 9 Apr 2018 15:12:17 +0100 Subject: [PATCH] Give paragraph block semantics for overloading --- Parsedown.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index e62ddd3..9e02e16 100644 --- a/Parsedown.php +++ b/Parsedown.php @@ -283,12 +283,14 @@ class Parsedown # ~ - if ( - isset($CurrentBlock) - and $CurrentBlock['type'] === 'Paragraph' - and ! isset($CurrentBlock['interrupted']) - ) { - $CurrentBlock['element']['handler']['argument'] .= "\n".$text; + if (isset($CurrentBlock) and $CurrentBlock['type'] === 'Paragraph') + { + $Block = $this->paragraphContinue($Line, $CurrentBlock); + } + + if (isset($Block)) + { + $CurrentBlock = $Block; } else { @@ -1065,6 +1067,18 @@ class Parsedown ); } + protected function paragraphContinue($Line, array $Block) + { + if (isset($Block['interrupted'])) + { + return; + } + + $Block['element']['handler']['argument'] .= "\n".$Line['text']; + + return $Block; + } + # # Inline Elements #