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

Fix ordered list start argument

See CommonMark spec examples [#226](http://spec.commonmark.org/0.26/#example-226) to #229
This commit is contained in:
Daniel Rudolf 2016-10-13 19:30:50 +02:00
parent 81025cd468
commit bdf537e9d5
No known key found for this signature in database
GPG Key ID: A061F02CD8DE4538

View File

@ -502,7 +502,7 @@ class Parsedown
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]{1,9}[.\)]');
if (preg_match('/^('.$pattern.'[ ]+)(.*)/', $Line['text'], $matches))
{
@ -521,7 +521,7 @@ class Parsedown
if($name === 'ol')
{
$listStart = stristr($matches[1], $Block['data']['marker'], true);
$listStart = ltrim(strstr($matches[1], $Block['data']['marker'], true), '0') ?: '0';
if($listStart !== '1')
{