mirror of
https://github.com/flextype/flextype.git
synced 2025-08-07 21:56:33 +02:00
feat(shortcodes): [strings]
shortcode - add capitalize
modifier
This commit is contained in:
@@ -100,6 +100,10 @@ parsers()->shortcodes()->addHandler('strings', static function (ShortcodeInterfa
|
||||
if ($key == 'camel') {
|
||||
$content = strings($content)->{'camel'}()->toString();
|
||||
}
|
||||
|
||||
if ($key == 'capitalize') {
|
||||
$content = strings($content)->{'capitalize'}()->toString();
|
||||
}
|
||||
}
|
||||
|
||||
return (string) $content;
|
||||
|
@@ -52,4 +52,7 @@ test('[strings] shortcode', function () {
|
||||
// camel
|
||||
$this->assertEquals("fooBar", parsers()->shortcodes()->parse('[strings camel]foo_bar[/strings]'));
|
||||
|
||||
// capitalize
|
||||
$this->assertEquals("That Country Was At The Same Stage Of Development As The United States In The 1940S", parsers()->shortcodes()->parse('[strings capitalize]that country was at the same stage of development as the United States in the 1940s[/strings]'));
|
||||
|
||||
});
|
Reference in New Issue
Block a user