mirror of
https://github.com/erusev/parsedown.git
synced 2023-08-10 21:13:06 +03:00
Merge pull request #587 from aidantwoods/fix/ol-interrupt
Fix ordered list interrupt
This commit is contained in:
commit
40b9da7837
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,4 +10,7 @@
|
|||||||
<p>large numbers:</p>
|
<p>large numbers:</p>
|
||||||
<ol start="123">
|
<ol start="123">
|
||||||
<li>one</li>
|
<li>one</li>
|
||||||
</ol>
|
</ol>
|
||||||
|
<p>foo 1. the following should not start a list
|
||||||
|
100.<br />
|
||||||
|
200. </p>
|
@ -8,4 +8,8 @@ repeating numbers:
|
|||||||
|
|
||||||
large numbers:
|
large numbers:
|
||||||
|
|
||||||
123. one
|
123. one
|
||||||
|
|
||||||
|
foo 1. the following should not start a list
|
||||||
|
100.
|
||||||
|
200.
|
Loading…
Reference in New Issue
Block a user