doefom/squeeze
最新稳定版本:0.2.0
Composer 安装命令:
composer require doefom/squeeze
包简介
Squeeze is a Statamic addon that provides a modifier named squeeze which removes a bunch of characters from a given string by replacing them with an empty string.
README 文档
README
Squeeze is a Statamic addon that provides a modifier named squeeze which removes a bunch of characters from a given
string by replacing them with an empty string.
Features
This addon removes the following characters by default:
_-/:(whitespace)
How to Install
You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or
run the following command from your project root:
composer require doefom/squeeze
How to Use
In your .yaml files you probably have some kind of string variable like this:
text: "A_string-to/test:the squeeze"
Then you can use the modifier in your antlers views like this:
{{ text | squeeze }}
Which outputs:
Astringtotestthesqueeze
Options
You may also pass your own squeezables to the modifier like so:
{{ text | squeeze:":-(" }}
Important note
It's also possible to squeeze whitespaces but they cannot be the last character of the squeezables string:
{{ text | squeeze:"-_ :(" }} // This will work
{{ text | squeeze:" -_:(" }} // This will work
{{ text | squeeze:"-_:( " }} // This will not work
Also, if you want to squeeze backslashes you'll need to escape them:
{{ text | squeeze:"\\" }} // This squeezes a backslash
统计信息
- 总下载量: 15
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-02-19