simplify parsing of code blocks

This commit is contained in:
Emanuil Rusev 2013-11-02 02:18:13 +02:00
parent f43f54b877
commit e475602e2f
1 changed files with 3 additions and 5 deletions

View File

@ -128,8 +128,6 @@ class Parsedown
{ {
$element['interrupted'] = true; $element['interrupted'] = true;
$element['type'] === 'code' and $element['text'] .= "\n";
continue; continue;
} }
@ -251,6 +249,8 @@ class Parsedown
{ {
if ($element['type'] === 'code') if ($element['type'] === 'code')
{ {
isset($element['interrupted']) and $element['text'] .= "\n";
$element['text'] .= "\n".$matches[1]; $element['text'] .= "\n".$matches[1];
} }
else else
@ -415,9 +415,7 @@ class Parsedown
case 'code': case 'code':
$text = rtrim($element['text'], "\n"); $text = htmlentities($element['text'], ENT_NOQUOTES);
$text = htmlentities($text, ENT_NOQUOTES);
strpos($text, "\x1A\\") !== FALSE and $text = strtr($text, $this->escape_sequence_map); strpos($text, "\x1A\\") !== FALSE and $text = strtr($text, $this->escape_sequence_map);