From 59c77e706b8967b79907327e1aaa22e3f61afe68 Mon Sep 17 00:00:00 2001 From: Emanuil Rusev Date: Mon, 22 Sep 2014 02:36:42 +0300 Subject: [PATCH] improve consistency --- Parsedown.php | 25 ++++++++----------------- test/Test.php | 2 +- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Parsedown.php b/Parsedown.php index 7be569c..2ef2982 100755 --- a/Parsedown.php +++ b/Parsedown.php @@ -59,11 +59,6 @@ class Parsedown private $breaksEnabled; - /** - * @var boolean If true HTML is escaped - */ - private $noMarkup = false; - function setBreaksEnabled($breaksEnabled) { $this->breaksEnabled = $breaksEnabled; @@ -71,15 +66,11 @@ class Parsedown return $this; } - /** - * Set the `noMarkup` option - * - * @param boolean $noMarkup If true HTML is escaped - * @return $this - */ - function setNoMarkup($noMarkup) + private $markupEscaped; + + function setMarkupEscaped($markupEscaped) { - $this->noMarkup = (bool) $noMarkup; + $this->markupEscaped = $markupEscaped; return $this; } @@ -637,9 +628,9 @@ class Parsedown protected function identifyMarkup($Line) { - if ($this->noMarkup) + if ($this->markupEscaped) { - return null; + return; } if (preg_match('/^<(\w[\w\d]*)(?:[ ][^>]*)?(\/?)[ ]*>/', $Line['text'], $matches)) @@ -1167,9 +1158,9 @@ class Parsedown protected function identifyTag($Excerpt) { - if ($this->noMarkup) + if ($this->markupEscaped) { - return null; + return; } if (strpos($Excerpt['text'], '>') !== false and preg_match('/^<\/?\w.*?>/', $Excerpt['text'], $matches)) diff --git a/test/Test.php b/test/Test.php index 7b60def..c0818a9 100644 --- a/test/Test.php +++ b/test/Test.php @@ -101,7 +101,7 @@ MARKDOWN_WITH_MARKUP;

</style>

EXPECTED_HTML; $parsedownWithNoMarkup = new Parsedown(); - $parsedownWithNoMarkup->setNoMarkup(true); + $parsedownWithNoMarkup->setMarkupEscaped(true); $this->assertEquals($expectedHtml, $parsedownWithNoMarkup->text($markdownWithHtml)); } }