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

Contextual limits on indentation stripping

This commit is contained in:
Aidan Woods 2016-10-11 13:38:47 +01:00 committed by GitHub
parent c4d4a6800d
commit 06c4344a71

View File

@ -585,7 +585,6 @@ class Parsedown
} }
elseif ($Block['indent'] === $Line['indent']) elseif ($Block['indent'] === $Line['indent'])
{ {
echo $Block['data']['rootItem'] ."\t" . $Block['indent'] ."\t" . $Block['data']['type'] ."\t" . $Line['indent'] . "\t". $Block['data']['matchText'] ."\t" .$Line['text'] . "\n";
return null; return null;
} }
@ -596,7 +595,7 @@ class Parsedown
if ( ! isset($Block['interrupted'])) if ( ! isset($Block['interrupted']))
{ {
$text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); $text = preg_replace('/^[ ]{0,'.($Block['indent'] + 1).'}/', '', $Line['body']);
$Block['li']['text'] []= $text; $Block['li']['text'] []= $text;
@ -607,7 +606,7 @@ class Parsedown
{ {
$Block['li']['text'] []= ''; $Block['li']['text'] []= '';
$text = preg_replace('/^[ ]{0,4}/', '', $Line['body']); $text = preg_replace('/^[ ]{0,'.($Block['indent'] + 1).'}/', '', $Line['body']);
$Block['li']['text'] []= $text; $Block['li']['text'] []= $text;