mirror of
https://github.com/flextype/flextype.git
synced 2025-08-06 05:07:41 +02:00
feat(shortcodes): [strings]
shortcode - add between
modifier
This commit is contained in:
@@ -92,6 +92,10 @@ parsers()->shortcodes()->addHandler('strings', static function (ShortcodeInterfa
|
||||
if ($key == 'base64Encode') {
|
||||
$content = strings($content)->{'base64Encode'}()->toString();
|
||||
}
|
||||
|
||||
if ($key == 'between') {
|
||||
$content = strings($content)->{'between'}(isset($values[0]) ? (string) $values[0] : '', isset($values[1]) ? (string) $values[1] : '')->toString();
|
||||
}
|
||||
}
|
||||
|
||||
return (string) $content;
|
||||
|
@@ -45,4 +45,8 @@ test('[strings] shortcode', function () {
|
||||
|
||||
// base64Encode
|
||||
$this->assertEquals("dGVzdA==", parsers()->shortcodes()->parse('[strings base64Encode]test[/strings]'));
|
||||
|
||||
// between
|
||||
$this->assertEquals("b", parsers()->shortcodes()->parse('[strings between=a|c]abc[/strings]'));
|
||||
|
||||
});
|
Reference in New Issue
Block a user