Update Composer packages

This commit is contained in:
Paul Nicoué 2023-04-14 16:34:06 +02:00
parent 67c3d8b307
commit 83cb211fe6
219 changed files with 6487 additions and 4444 deletions

View file

@ -148,6 +148,7 @@ class KirbyTag
return $this->kirby()->file($path, null, true);
}
/**
* Returns the current Kirby instance
*/

View file

@ -25,6 +25,9 @@ class KirbyTags
array $data = [],
array $options = []
): string {
// make sure $text is a string
$text ??= '';
$regex = '!
(?=[^\]]) # positive lookahead that matches a group after the main expression without including ] in the result
(?=\([a-z0-9_-]+:) # positive lookahead that requires starts with ( and lowercase ASCII letters, digits, underscores or hyphens followed with : immediately to the right of the current location
@ -40,7 +43,10 @@ class KirbyTags
return KirbyTag::parse($match[0], $data, $options)->render();
} catch (InvalidArgumentException $e) {
// stay silent in production and ignore non-existing tags
if ($debug !== true || Str::startsWith($e->getMessage(), 'Undefined tag type:') === true) {
if (
$debug !== true ||
Str::startsWith($e->getMessage(), 'Undefined tag type:') === true
) {
return $match[0];
}
@ -52,6 +58,6 @@ class KirbyTags
return $match[0];
}
}, $text ?? '');
}, $text);
}
}

View file

@ -53,11 +53,10 @@ class Markdown
*/
public function parse(string|null $text = null, bool $inline = false): string
{
if ($this->options['extra'] === true) {
$parser = new ParsedownExtra();
} else {
$parser = new Parsedown();
}
$parser = match ($this->options['extra']) {
true => new ParsedownExtra(),
default => new Parsedown()
};
$parser->setBreaksEnabled($this->options['breaks']);
$parser->setSafeMode($this->options['safe']);

View file

@ -110,7 +110,8 @@ class SmartyPants
public function parse(string|null $text = null): string
{
// prepare the text
$text = str_replace('"', '"', $text ?? '');
$text ??= '';
$text = str_replace('"', '"', $text);
// parse the text
return $this->parser->transform($text);