(beginning to) improve commonmark compliance:lists
These changes aren't fit for merge, nor do they work correctly (yet)
This commit is contained in:
parent
cbc4b3f612
commit
c4d4a6800d
|
@ -509,6 +509,11 @@ class Parsedown
|
||||||
$Block = array(
|
$Block = array(
|
||||||
'indent' => $Line['indent'],
|
'indent' => $Line['indent'],
|
||||||
'pattern' => $pattern,
|
'pattern' => $pattern,
|
||||||
|
'data' => array(
|
||||||
|
'type' => $name,
|
||||||
|
'matchText' => ($name === 'ul' ? stristr($matches[1], ' ', true) : stristr($matches[1], '.', true)),
|
||||||
|
'rootItem' => $matches[2]
|
||||||
|
),
|
||||||
'element' => array(
|
'element' => array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'handler' => 'elements',
|
'handler' => 'elements',
|
||||||
|
@ -541,7 +546,19 @@ class Parsedown
|
||||||
|
|
||||||
protected function blockListContinue($Line, array $Block)
|
protected function blockListContinue($Line, array $Block)
|
||||||
{
|
{
|
||||||
if ($Block['indent'] === $Line['indent'] and preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches))
|
if (
|
||||||
|
(
|
||||||
|
$Block['indent'] === $Line['indent']
|
||||||
|
and $Block['data']['type'] === 'ol'
|
||||||
|
and preg_match('/^'.$Block['pattern'].'(?:[ ]+(.*)|$)/', $Line['text'], $matches)
|
||||||
|
)
|
||||||
|
or
|
||||||
|
(
|
||||||
|
$Block['indent'] === $Line['indent']
|
||||||
|
and $Block['data']['type'] === 'ul'
|
||||||
|
and preg_match('/^'.preg_quote($Block['data']['matchText']).'(?:[ ]+(.*)|$)/', $Line['text'], $matches)
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (isset($Block['interrupted']))
|
if (isset($Block['interrupted']))
|
||||||
{
|
{
|
||||||
|
@ -566,6 +583,11 @@ class Parsedown
|
||||||
|
|
||||||
return $Block;
|
return $Block;
|
||||||
}
|
}
|
||||||
|
elseif ($Block['indent'] === $Line['indent'])
|
||||||
|
{
|
||||||
|
echo $Block['data']['rootItem'] ."\t" . $Block['indent'] ."\t" . $Block['data']['type'] ."\t" . $Line['indent'] . "\t". $Block['data']['matchText'] ."\t" .$Line['text'] . "\n";
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if ($Line['text'][0] === '[' and $this->blockReference($Line))
|
if ($Line['text'][0] === '[' and $this->blockReference($Line))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue