Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark function doesn't work when capitalize filter is applied #49

Open
lenvanessen opened this issue Aug 29, 2017 · 4 comments
Open

Mark function doesn't work when capitalize filter is applied #49

lenvanessen opened this issue Aug 29, 2017 · 4 comments

Comments

@lenvanessen
Copy link

Left using capitalize, right not using capitalize
schermafbeelding 2017-08-29 om 15 01 30

@SvanteRichter
Copy link
Contributor

SvanteRichter commented Aug 29, 2017

Yeah, most string filters output strings, not twig objects. The hacky way to do this would be {{ l('reed our creed')|striptags|capitalize }}, but then you loose the mark tags.

I don't think this will be "fixed" since this is really twig core code, and it's "working as designed"

@xiaohutai
Copy link
Contributor

It usually makes more sense to do text-transform: uppercase; via CSS.

@SvanteRichter
Copy link
Contributor

@xiaohutai That'll transform the whole string, right? So not the same as |capitalize, right?

Usually capitalizing a whole string is a stylistic choice, but capitalizing the first letter is an indication of the meaning, right?

@xiaohutai
Copy link
Contributor

@SahAssar You're right! I misinterpreted it.

There's a text-transform: capitalize in CSS, but this one is different than the one in Twig: https://twig.symfony.com/doc/2.x/filters/capitalize.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants