Allow parsedown to specify list start attribute

Remove github added tabs on blank lines
This commit is contained in:
Aidan Woods 2016-10-05 18:17:12 +01:00 committed by GitHub
parent a37797ef34
commit 3978e33fd0
1 changed files with 5 additions and 5 deletions

View File

@ -503,7 +503,7 @@ class Parsedown
protected function blockList($Line) protected function blockList($Line)
{ {
list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]'); list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]+[.]');
if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches)) if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches))
{ {
$Block = array( $Block = array(
@ -514,7 +514,7 @@ class Parsedown
'handler' => 'elements', 'handler' => 'elements',
), ),
); );
if($name === 'ol') if($name === 'ol')
{ {
$listStart = stristr($matches[0], ".", true); $listStart = stristr($matches[0], ".", true);
@ -523,7 +523,7 @@ class Parsedown
$Block['element']['attributes'] = array('start' => $listStart); $Block['element']['attributes'] = array('start' => $listStart);
} }
} }
$Block['li'] = array( $Block['li'] = array(
'name' => 'li', 'name' => 'li',
'handler' => 'li', 'handler' => 'li',
@ -531,9 +531,9 @@ class Parsedown
$matches[2], $matches[2],
), ),
); );
$Block['element']['text'] []= & $Block['li']; $Block['element']['text'] []= & $Block['li'];
return $Block; return $Block;
} }
} }