mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
no need for a separate method for every special character
This commit is contained in:
parent
e5e8d02934
commit
21a3e8790a
@ -968,12 +968,12 @@ class Parsedown
|
||||
#
|
||||
|
||||
protected $InlineTypes = array(
|
||||
'"' => array('QuotationMark'),
|
||||
'"' => array('SpecialCharacter'),
|
||||
'!' => array('Image'),
|
||||
'&' => array('Ampersand'),
|
||||
'&' => array('SpecialCharacter'),
|
||||
'*' => array('Emphasis'),
|
||||
'<' => array('Url', 'Email', 'Markup', 'LessThan'),
|
||||
'>' => array('GreaterThan'),
|
||||
'<' => array('Url', 'Email', 'Markup', 'SpecialCharacter'),
|
||||
'>' => array('SpecialCharacter'),
|
||||
'[' => array('Link'),
|
||||
'_' => array('Emphasis'),
|
||||
'`' => array('Code'),
|
||||
@ -1043,17 +1043,6 @@ class Parsedown
|
||||
# ~
|
||||
#
|
||||
|
||||
protected function inlineAmpersand($excerpt)
|
||||
{
|
||||
if ( ! preg_match('/^&#?\w+;/', $excerpt))
|
||||
{
|
||||
return array(
|
||||
'markup' => '&',
|
||||
'extent' => 1,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected function inlineCode($excerpt)
|
||||
{
|
||||
$marker = $excerpt[0];
|
||||
@ -1141,14 +1130,6 @@ class Parsedown
|
||||
}
|
||||
}
|
||||
|
||||
protected function inlineGreaterThan()
|
||||
{
|
||||
return array(
|
||||
'markup' => '>',
|
||||
'extent' => 1,
|
||||
);
|
||||
}
|
||||
|
||||
protected function inlineImage($excerpt)
|
||||
{
|
||||
if ( ! isset($excerpt[1]) or $excerpt[1] !== '[')
|
||||
@ -1296,14 +1277,27 @@ class Parsedown
|
||||
}
|
||||
}
|
||||
|
||||
protected function inlineQuotationMark()
|
||||
protected function inlineSpecialCharacter($excerpt)
|
||||
{
|
||||
if ($excerpt[0] === '&' and ! preg_match('/^&#?\w+;/', $excerpt))
|
||||
{
|
||||
return array(
|
||||
'markup' => '"',
|
||||
'markup' => '&',
|
||||
'extent' => 1,
|
||||
);
|
||||
}
|
||||
|
||||
$SpecialCharacter = array('>' => 'gt', '<' => 'lt', '"' => 'quot');
|
||||
|
||||
if (isset($SpecialCharacter[$excerpt[0]]))
|
||||
{
|
||||
return array(
|
||||
'markup' => '&'.$SpecialCharacter[$excerpt[0]].';',
|
||||
'extent' => 1,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
protected function inlineStrikethrough($excerpt)
|
||||
{
|
||||
if ( ! isset($excerpt[1]))
|
||||
|
Loading…
Reference in New Issue
Block a user