1
0
mirror of https://github.com/erusev/parsedown.git synced 2023-08-10 21:13:06 +03:00

improve consistency

This commit is contained in:
Emanuil Rusev 2014-09-22 02:36:42 +03:00
parent e0965ce09b
commit 59c77e706b
2 changed files with 9 additions and 18 deletions

View File

@ -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))

View File

@ -101,7 +101,7 @@ MARKDOWN_WITH_MARKUP;
<p>&lt;/style></p>
EXPECTED_HTML;
$parsedownWithNoMarkup = new Parsedown();
$parsedownWithNoMarkup->setNoMarkup(true);
$parsedownWithNoMarkup->setMarkupEscaped(true);
$this->assertEquals($expectedHtml, $parsedownWithNoMarkup->text($markdownWithHtml));
}
}