mirror of https://github.com/erusev/parsedown.git
Merge 506130788f
into 6598f3860c
This commit is contained in:
commit
738c9d65c0
|
@ -81,6 +81,24 @@ class Parsedown
|
|||
return $this;
|
||||
}
|
||||
|
||||
protected $strippedElements = array();
|
||||
|
||||
public function setStrippedImages($stripImages)
|
||||
{
|
||||
$pos = array_search('img', $this->strippedElements);
|
||||
if ($stripImages)
|
||||
{
|
||||
if ($pos === false)
|
||||
$this->strippedElements[] = 'img';
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($pos !== false)
|
||||
array_splice($this->strippedElements, $pos, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected $urlsLinked = true;
|
||||
|
||||
function setSafeMode($safeMode)
|
||||
|
@ -316,6 +334,11 @@ class Parsedown
|
|||
return $Elements;
|
||||
}
|
||||
|
||||
protected function isElementStripped(array $Component)
|
||||
{
|
||||
return (isset($Component['element']['name']) && in_array($Component['element']['name'], $this->strippedElements));
|
||||
}
|
||||
|
||||
protected function extractElement(array $Component)
|
||||
{
|
||||
if ( ! isset($Component['element']))
|
||||
|
@ -1199,8 +1222,12 @@ class Parsedown
|
|||
$InlineText = $this->inlineText($unmarkedText);
|
||||
$Elements[] = $InlineText['element'];
|
||||
|
||||
# compile the inline
|
||||
$Elements[] = $this->extractElement($Inline);
|
||||
# make sure element is not stripped
|
||||
if (!$this->isElementStripped($Inline))
|
||||
{
|
||||
# compile the inline
|
||||
$Elements[] = $this->extractElement($Inline);
|
||||
}
|
||||
|
||||
# remove the examined text
|
||||
$text = substr($text, $Inline['position'] + $Inline['extent']);
|
||||
|
|
Loading…
Reference in New Issue