mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
$pure_line » $deindented_line
This commit is contained in:
parent
d54712b989
commit
24d300ea5d
|
@ -282,16 +282,16 @@ class Parsedown
|
||||||
|
|
||||||
# ~
|
# ~
|
||||||
|
|
||||||
$pure_line = $line[0] !== ' ' ? $line : ltrim($line);
|
$deindented_line = $line[0] !== ' ' ? $line : ltrim($line);
|
||||||
|
|
||||||
if ($pure_line === '')
|
if ($deindented_line === '')
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
# reference
|
# reference
|
||||||
|
|
||||||
if ($pure_line[0] === '[' and preg_match('/^\[(.+?)\]:[ ]*([^ ]+)/', $pure_line, $matches))
|
if ($deindented_line[0] === '[' and preg_match('/^\[(.+?)\]:[ ]*([^ ]+)/', $deindented_line, $matches))
|
||||||
{
|
{
|
||||||
$label = strtolower($matches[1]);
|
$label = strtolower($matches[1]);
|
||||||
$url = trim($matches[2], '<>');
|
$url = trim($matches[2], '<>');
|
||||||
|
@ -303,7 +303,7 @@ class Parsedown
|
||||||
|
|
||||||
# blockquote
|
# blockquote
|
||||||
|
|
||||||
if ($pure_line[0] === '>' and preg_match('/^>[ ]?(.*)/', $pure_line, $matches))
|
if ($deindented_line[0] === '>' and preg_match('/^>[ ]?(.*)/', $deindented_line, $matches))
|
||||||
{
|
{
|
||||||
if ($element['type'] === 'blockquote')
|
if ($element['type'] === 'blockquote')
|
||||||
{
|
{
|
||||||
|
@ -333,17 +333,17 @@ class Parsedown
|
||||||
|
|
||||||
# markup
|
# markup
|
||||||
|
|
||||||
if ($pure_line[0] === '<')
|
if ($deindented_line[0] === '<')
|
||||||
{
|
{
|
||||||
# self-closing tag
|
# self-closing tag
|
||||||
|
|
||||||
if (preg_match('{^<.+?/>$}', $pure_line))
|
if (preg_match('{^<.+?/>$}', $deindented_line))
|
||||||
{
|
{
|
||||||
$elements []= $element;
|
$elements []= $element;
|
||||||
|
|
||||||
$element = array(
|
$element = array(
|
||||||
'type' => '',
|
'type' => '',
|
||||||
'text' => $pure_line,
|
'text' => $deindented_line,
|
||||||
);
|
);
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -351,18 +351,18 @@ class Parsedown
|
||||||
|
|
||||||
# opening tag
|
# opening tag
|
||||||
|
|
||||||
if (preg_match('{^<(\w+)(?:[ ].*?)?>}', $pure_line, $matches))
|
if (preg_match('{^<(\w+)(?:[ ].*?)?>}', $deindented_line, $matches))
|
||||||
{
|
{
|
||||||
$elements []= $element;
|
$elements []= $element;
|
||||||
|
|
||||||
$element = array(
|
$element = array(
|
||||||
'type' => 'markup',
|
'type' => 'markup',
|
||||||
'subtype' => strtolower($matches[1]),
|
'subtype' => strtolower($matches[1]),
|
||||||
'text' => $pure_line,
|
'text' => $deindented_line,
|
||||||
'depth' => 0,
|
'depth' => 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
preg_match('{</'.$matches[1].'>\s*$}', $pure_line) and $element['closed'] = true;
|
preg_match('{</'.$matches[1].'>\s*$}', $deindented_line) and $element['closed'] = true;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ class Parsedown
|
||||||
|
|
||||||
# horizontal rule
|
# horizontal rule
|
||||||
|
|
||||||
if (preg_match('/^([-*_])([ ]{0,2}\1){2,}[ ]*$/', $pure_line))
|
if (preg_match('/^([-*_])([ ]{0,2}\1){2,}[ ]*$/', $deindented_line))
|
||||||
{
|
{
|
||||||
$elements []= $element;
|
$elements []= $element;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user