line indent from line whitespace after marker; more leneant on condition for indent match on list start (prevents test 243 breaking)

This commit is contained in:
Aidan Woods 2017-01-24 00:37:45 +00:00
parent ab59a97161
commit 49ae7f9925
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -599,14 +599,11 @@ class Parsedown
protected function blockListContinue($Line, array $Block) protected function blockListContinue($Line, array $Block)
{ {
if (preg_match('/^('.$Block['pattern'].')(?:[ ]+(.*)|$)/', $Line['text'], $matches)) if (preg_match('/^('.$Block['pattern'].')([ ]+)(?:(.*)|$)/', $Line['text'], $matches))
{ {
if (isset($Block['markerWhitespace'])) $Line['indent'] += strlen($matches[1]) + strlen($matches[2]);
{
$Line['indent'] += strlen($matches[1]) + $Block['markerWhitespace'];
}
if ($Block['indent'] === $Line['indent']) if ($Block['indent'] - $Block['markerWhitespace'] <= $Line['indent'])
{ {
if (isset($Block['interrupted'])) if (isset($Block['interrupted']))
{ {
@ -617,7 +614,7 @@ class Parsedown
unset($Block['li']); unset($Block['li']);
$text = isset($matches[2]) ? $matches[2] : ''; $text = isset($matches[3]) ? $matches[3] : '';
$Block['li'] = array( $Block['li'] = array(
'name' => 'li', 'name' => 'li',