Use rawHtml to provide conditional escaping for markup

This commit is contained in:
Aidan Woods 2018-03-18 22:46:55 +00:00
parent 0205a4cbe6
commit 8c14c5c239
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9
1 changed files with 7 additions and 7 deletions

View File

@ -386,7 +386,7 @@ class Parsedown
if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!') if (isset($Line['text'][3]) and $Line['text'][3] === '-' and $Line['text'][2] === '-' and $Line['text'][1] === '!')
{ {
$Block = array( $Block = array(
'markup' => $Line['body'], 'element' => array('rawHtml' => $Line['body']),
); );
if (preg_match('/-->$/', $Line['text'])) if (preg_match('/-->$/', $Line['text']))
@ -405,7 +405,7 @@ class Parsedown
return; return;
} }
$Block['markup'] .= "\n" . $Line['body']; $Block['element']['rawHtml'] .= "\n" . $Line['body'];
if (preg_match('/-->$/', $Line['text'])) if (preg_match('/-->$/', $Line['text']))
{ {
@ -734,7 +734,7 @@ class Parsedown
$Block = array( $Block = array(
'name' => $matches[1], 'name' => $matches[1],
'markup' => $Line['text'], 'element' => array('rawHtml' => $Line['text']),
); );
return $Block; return $Block;
@ -748,7 +748,7 @@ class Parsedown
return; return;
} }
$Block['markup'] .= "\n".$Line['body']; $Block['element']['rawHtml'] .= "\n".$Line['body'];
return $Block; return $Block;
} }
@ -1311,7 +1311,7 @@ class Parsedown
if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w[\w-]*[ ]*>/s', $Excerpt['text'], $matches)) if ($Excerpt['text'][1] === '/' and preg_match('/^<\/\w[\w-]*[ ]*>/s', $Excerpt['text'], $matches))
{ {
return array( return array(
'markup' => $matches[0], 'element' => array('rawHtml' => $matches[0]),
'extent' => strlen($matches[0]), 'extent' => strlen($matches[0]),
); );
} }
@ -1319,7 +1319,7 @@ class Parsedown
if ($Excerpt['text'][1] === '!' and preg_match('/^<!---?[^>-](?:-?[^-])*-->/s', $Excerpt['text'], $matches)) if ($Excerpt['text'][1] === '!' and preg_match('/^<!---?[^>-](?:-?[^-])*-->/s', $Excerpt['text'], $matches))
{ {
return array( return array(
'markup' => $matches[0], 'element' => array('rawHtml' => $matches[0]),
'extent' => strlen($matches[0]), 'extent' => strlen($matches[0]),
); );
} }
@ -1327,7 +1327,7 @@ class Parsedown
if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w[\w-]*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches)) if ($Excerpt['text'][1] !== ' ' and preg_match('/^<\w[\w-]*(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*\/?>/s', $Excerpt['text'], $matches))
{ {
return array( return array(
'markup' => $matches[0], 'element' => array('rawHtml' => $matches[0]),
'extent' => strlen($matches[0]), 'extent' => strlen($matches[0]),
); );
} }