Update to Kirby 4.7.0

This commit is contained in:
Paul Nicoué 2025-04-21 18:57:21 +02:00
parent 02a9ab387c
commit ba25a9a198
509 changed files with 26604 additions and 14872 deletions

View file

@ -1158,7 +1158,7 @@ class Parser
private function lexUnquotedString(int &$cursor): string
{
$offset = $cursor;
$cursor += strcspn($this->currentLine, '[]{},: ', $cursor);
$cursor += strcspn($this->currentLine, '[]{},:', $cursor);
if ($cursor === $offset) {
throw new ParseException('Malformed unquoted YAML string.');
@ -1167,17 +1167,17 @@ class Parser
return substr($this->currentLine, $offset, $cursor - $offset);
}
private function lexInlineMapping(int &$cursor = 0): string
private function lexInlineMapping(int &$cursor = 0, bool $consumeUntilEol = true): string
{
return $this->lexInlineStructure($cursor, '}');
return $this->lexInlineStructure($cursor, '}', $consumeUntilEol);
}
private function lexInlineSequence(int &$cursor = 0): string
private function lexInlineSequence(int &$cursor = 0, bool $consumeUntilEol = true): string
{
return $this->lexInlineStructure($cursor, ']');
return $this->lexInlineStructure($cursor, ']', $consumeUntilEol);
}
private function lexInlineStructure(int &$cursor, string $closingTag): string
private function lexInlineStructure(int &$cursor, string $closingTag, bool $consumeUntilEol = true): string
{
$value = $this->currentLine[$cursor];
++$cursor;
@ -1197,15 +1197,19 @@ class Parser
++$cursor;
break;
case '{':
$value .= $this->lexInlineMapping($cursor);
$value .= $this->lexInlineMapping($cursor, false);
break;
case '[':
$value .= $this->lexInlineSequence($cursor);
$value .= $this->lexInlineSequence($cursor, false);
break;
case $closingTag:
$value .= $this->currentLine[$cursor];
++$cursor;
if ($consumeUntilEol && isset($this->currentLine[$cursor]) && ($whitespaces = strspn($this->currentLine, ' ', $cursor) + $cursor) < strlen($this->currentLine) && '#' !== $this->currentLine[$whitespaces]) {
throw new ParseException(sprintf('Unexpected token "%s".', trim(substr($this->currentLine, $cursor))));
}
return $value;
case '#':
break 2;