From 2a5f99547c90c806513e866a08e4324c1a12a9d4 Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Thu, 1 May 2014 01:05:31 +0300 Subject: [PATCH] resolve #162 --- Parsedown.php | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 72719a0..f4ca1d6 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -470,9 +470,18 @@ class Parsedown return $Block; } - $string = htmlspecialchars($Line['body'], ENT_NOQUOTES, 'UTF-8'); + $Block['element']['text']['text'] .= "\n".$Line['body'];; - $Block['element']['text']['text'] .= "\n".$string;; + return $Block; + } + + protected function completeFencedCode($Block) + { + $text = $Block['element']['text']['text']; + + $text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8'); + + $Block['element']['text']['text'] = $text; return $Block; } @@ -762,7 +771,6 @@ class Parsedown if ($Line['indent'] >= 4) { $text = substr($Line['body'], 4); - $text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8'); $Block = array( 'element' => array( @@ -793,7 +801,6 @@ class Parsedown $Block['element']['text']['text'] .= "\n"; $text = substr($Line['body'], 4); - $text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8'); $Block['element']['text']['text'] .= $text; @@ -801,6 +808,17 @@ class Parsedown } } + protected function completeCodeBlock($Block) + { + $text = $Block['element']['text']['text']; + + $text = htmlspecialchars($text, ENT_NOQUOTES, 'UTF-8'); + + $Block['element']['text']['text'] = $text; + + return $Block; + } + # # ~ #