techwilk/twig-linewrap
Composer 安装命令:
composer require techwilk/twig-linewrap
包简介
TWIG filter to wrap lines exceeding the specified length.
README 文档
README
TWIG filter to wrap lines over a specified length with a newline, or optionally pass in a different separator.
Designed for wrapping iCal files to 75 chars max length, although should be useful in any application requiring line wrapping.
Installation
- Install through composer.
composer require techwilk/twig-linewrap
- Then add as an extension to TWIG:
$twig->addExtension(new \TechWilk\Twig\Extension\LineWrap());
Use
Use as a standard twig filter, passing in a maximum length after which to wrap:
{{ 'this is some text that goes on forever' | linewrap(10) }}
outputs:
this is so
me text th
at goes on
forever
Optionally pass in a different separator (such as for iCal wrapping):
{{ 'this is some text that goes on forever' | linewrap(75, "\n ") }}
统计信息
- 总下载量: 3.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-07-06