wintercms / vscode-extension

Official Winter CMS VSCode extension
https://marketplace.visualstudio.com/items?itemName=wintercms.winter-cms
MIT License
10 stars 6 forks source link

Filters have been added to Twig syntax #15

Closed WebVPF closed 9 months ago

WebVPF commented 9 months ago

Added Twig filters:

https://github.com/wintercms/winter/blob/bb79834af1690c63cc642af72a560e5f7e0d3c4a/modules/system/ServiceProvider.php#L212-L223

Screenshots

Before:

twig-filters-before

After:

twig-filters-after

Examples

Str

{{ 'test test'|camel }}

{{ 'test'|finish('/') }}

{{ 'test'|plural }}

{{ 'letters'|singular }}

{{ 'test test'|slug }}

{{ 'test test'|slug('+') }}

{{ 'test test'|snake }}

{{ 'test test'|studly }}

trans

{{ 'I love Winter CMS.'|trans }}

{{ ':name loves Winter CMS.'|trans({ name: 'Samuel' }) }}

{{ 'snowflake|snowflakes'|transchoice(8) }}

Markdown

{{ '**Text** is bold.'|md }}

{{ '**Text** is bold.'|md_line }}

{{ '    **Text** is bold.'|md_safe }}