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

Simplify match logic

This commit is contained in:
Aidan Woods 2020-01-19 15:09:44 +00:00
parent 0a6408043f
commit 13932bca9a
No known key found for this signature in database
GPG Key ID: 9A6A8EFAA512BBB9

View File

@ -173,14 +173,14 @@ final class TList implements ContinuableBlock
$Lis = $this->Lis;
if ($this->type === 'ol') {
$regex = '/^([0-9]++'.$this->markerTypeRegex.')([\t ]++.*|$)/';
} else {
$regex = '/^('.$this->markerTypeRegex.')([\t ]++.*|$)/';
}
if ($Context->line()->indent() < $requiredIndent
&& ((
$this->type === 'ol'
&& \preg_match('/^([0-9]++'.$this->markerTypeRegex.')([\t ]++.*|$)/', $Context->line()->text(), $matches)
) || (
$this->type === 'ul'
&& \preg_match('/^('.$this->markerTypeRegex.')([\t ]++.*|$)/', $Context->line()->text(), $matches)
))
&& \preg_match($regex, $Context->line()->text(), $matches)
) {
if ($Context->previousEmptyLines() > 0) {
$Lis[\count($Lis) -1] = $Lis[\count($Lis) -1]->appendingBlankLines(1);