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

Only interrupt paragraph if starting with 1

This commit is contained in:
Aidan Woods 2018-03-28 15:38:11 +01:00
parent a3e02c1d0e
commit a9c21447ce
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -523,7 +523,7 @@ class Parsedown
# #
# List # List
protected function blockList($Line) protected function blockList($Line, array $CurrentBlock = null)
{ {
list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]{1,9}[.\)]'); list($name, $pattern) = $Line['text'][0] <= '-' ? array('ul', '[*+-]') : array('ol', '[0-9]{1,9}[.\)]');
@ -556,12 +556,20 @@ class Parsedown
), ),
); );
if($name === 'ol') if ($name === 'ol')
{ {
$listStart = ltrim(strstr($matches[1], $Block['data']['markerType'], true), '0') ?: '0'; $listStart = ltrim(strstr($matches[1], $Block['data']['markerType'], true), '0') ?: '0';
if($listStart !== '1') if ($listStart !== '1')
{ {
if (
isset($CurrentBlock)
and ! isset($CurrentBlock['type'])
and ! isset($CurrentBlock['interrupted'])
) {
return;
}
$Block['element']['attributes'] = array('start' => $listStart); $Block['element']['attributes'] = array('start' => $listStart);
} }
} }