Upgrade to 3.9.0

This commit is contained in:
Bastian Allgeier
2023-01-17 14:50:16 +01:00
parent 0ebe0c7b16
commit 6e5c9d1f48
132 changed files with 1664 additions and 1254 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);