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

previousEmptyLines -> precedingEmptyLines

This commit is contained in:
Aidan Woods
2020-01-19 16:53:18 +00:00
parent 7610eacbf9
commit a6c17f449e
10 changed files with 35 additions and 35 deletions

View File

@@ -62,7 +62,7 @@ final class BlockQuote implements ContinuableBlock
*/
public function advance(Context $Context, State $State)
{
if ($Context->previousEmptyLines() > 0) {
if ($Context->precedingEmptyLines() > 0) {
return null;
}
@@ -82,7 +82,7 @@ final class BlockQuote implements ContinuableBlock
return new self($Lines);
}
if (! $Context->previousEmptyLines() > 0) {
if (! $Context->precedingEmptyLines() > 0) {
$indentOffset = $Context->line()->indentOffset() + $Context->line()->indent();
$Lines = $this->Lines->appendingTextLines($Context->line()->text(), $indentOffset);

View File

@@ -88,7 +88,7 @@ final class FencedCode implements ContinuableBlock
$newCode = $this->code;
$newCode .= $Context->previousEmptyLinesText();
$newCode .= $Context->precedingEmptyLinesText();
if (($len = \strspn($Context->line()->text(), $this->marker)) >= $this->openerLength
&& \chop(\substr($Context->line()->text(), $len), ' ') === ''

View File

@@ -35,7 +35,7 @@ final class IndentedCode implements ContinuableBlock
State $State,
Block $Block = null
) {
if (isset($Block) && $Block instanceof Paragraph && ! $Context->previousEmptyLines() > 0) {
if (isset($Block) && $Block instanceof Paragraph && ! $Context->precedingEmptyLines() > 0) {
return null;
}
@@ -61,8 +61,8 @@ final class IndentedCode implements ContinuableBlock
$offset = $Context->line()->indentOffset();
if ($Context->previousEmptyLines() > 0) {
foreach (\explode("\n", $Context->previousEmptyLinesText()) as $line) {
if ($Context->precedingEmptyLines() > 0) {
foreach (\explode("\n", $Context->precedingEmptyLinesText()) as $line) {
$newCode .= (new Line($line, $offset))->ltrimBodyUpto(4) . "\n";
}

View File

@@ -175,7 +175,7 @@ final class Markup implements ContinuableBlock
$tail = $matches[1];
if (! \array_key_exists($element, self::SPECIAL_HTML_BLOCK_TAGS)
&& ! (isset($Block) && $Block instanceof Paragraph && $Context->previousEmptyLines() < 1)
&& ! (isset($Block) && $Block instanceof Paragraph && $Context->precedingEmptyLines() < 1)
&& \preg_match('/^\s*+$/', $tail)
) {
return new self($rawLine, 7);
@@ -200,7 +200,7 @@ final class Markup implements ContinuableBlock
return null;
}
if (($type === 6 || $type === 7) && $Context->previousEmptyLines() > 0) {
if (($type === 6 || $type === 7) && $Context->precedingEmptyLines() > 0) {
return null;
}
@@ -208,7 +208,7 @@ final class Markup implements ContinuableBlock
$closed = self::closes12345TypeMarkup($type, $Context->line()->text());
}
$html = $this->html . \str_repeat("\n", $Context->previousEmptyLines() + 1);
$html = $this->html . \str_repeat("\n", $Context->precedingEmptyLines() + 1);
$html .= $Context->line()->rawLine();
return new self($html, $type, $closed);

View File

@@ -45,7 +45,7 @@ final class Paragraph implements ContinuableBlock
*/
public function advance(Context $Context, State $State)
{
if ($Context->previousEmptyLines() > 0) {
if ($Context->precedingEmptyLines() > 0) {
return null;
}

View File

@@ -40,7 +40,7 @@ final class SetextHeader implements AcquisitioningBlock
State $State,
Block $Block = null
) {
if (! isset($Block) || ! $Block instanceof Paragraph || $Context->previousEmptyLines() > 0) {
if (! isset($Block) || ! $Block instanceof Paragraph || $Context->precedingEmptyLines() > 0) {
return null;
}

View File

@@ -134,7 +134,7 @@ final class TList implements ContinuableBlock
$listStart !== 1
&& isset($Block)
&& $Block instanceof Paragraph
&& ! $Context->previousEmptyLines() > 0
&& ! $Context->precedingEmptyLines() > 0
) {
return null;
}
@@ -161,11 +161,11 @@ final class TList implements ContinuableBlock
*/
public function advance(Context $Context, State $State)
{
if ($Context->previousEmptyLines() > 0 && \end($this->Lis)->isEmpty()) {
if ($Context->precedingEmptyLines() > 0 && \end($this->Lis)->isEmpty()) {
return null;
}
$newlines = \str_repeat("\n", $Context->previousEmptyLines());
$newlines = \str_repeat("\n", $Context->precedingEmptyLines());
$requiredIndent = $this->indent + \strlen($this->marker) + $this->afterMarkerSpaces;
$isLoose = $this->isLoose;
@@ -182,7 +182,7 @@ final class TList implements ContinuableBlock
if ($Context->line()->indent() < $requiredIndent
&& \preg_match($regex, $Context->line()->text(), $matches)
) {
if ($Context->previousEmptyLines() > 0) {
if ($Context->precedingEmptyLines() > 0) {
$Lis[\count($Lis) -1] = $Lis[\count($Lis) -1]->appendingBlankLines(1);
$isLoose = true;
@@ -224,8 +224,8 @@ final class TList implements ContinuableBlock
}
if ($Context->line()->indent() >= $requiredIndent) {
if ($Context->previousEmptyLines() > 0) {
$Lis[\count($Lis) -1] = $Lis[\count($Lis) -1]->appendingBlankLines($Context->previousEmptyLines());
if ($Context->precedingEmptyLines() > 0) {
$Lis[\count($Lis) -1] = $Lis[\count($Lis) -1]->appendingBlankLines($Context->precedingEmptyLines());
$isLoose = true;
}
@@ -248,7 +248,7 @@ final class TList implements ContinuableBlock
);
}
if (! $Context->previousEmptyLines() > 0) {
if (! $Context->precedingEmptyLines() > 0) {
$text = $Context->line()->ltrimBodyUpto($requiredIndent);
$Lis[\count($Lis) -1] = $Lis[\count($Lis) -1]->appendingTextLines(

View File

@@ -96,7 +96,7 @@ final class Table implements AcquisitioningBlock, ContinuableBlock
*/
public function advance(Context $Context, State $State)
{
if ($Context->previousEmptyLines() > 0) {
if ($Context->precedingEmptyLines() > 0) {
return null;
}