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

Short spaceless-like operator #4442

Open
Seldaek opened this issue Nov 7, 2024 · 2 comments
Open

Short spaceless-like operator #4442

Seldaek opened this issue Nov 7, 2024 · 2 comments

Comments

@Seldaek
Copy link
Contributor

Seldaek commented Nov 7, 2024

Replacing the usages of spaceless due to the deprecation, I was wondering what's the shortest way to remove spaces between two tags, and right now it seems to be {#--#}. I wonder if adding {#-#} as special operator for this would make sense? Or {-} even, I don't know. Just an idea..

@stof
Copy link
Member

stof commented Nov 7, 2024

The issue is that {#-#} is already valid syntax, parsed as a comment using whitespace control on one of its side (probably on its left, but I haven't checked which side actually wins in practice).

Using {-} would be a huge BC break, as using it currently makes it part of the output of the template (it is not a Twig markup).

I think keeping {#--#} is probably the way to go here (or using {#-#} just before the second tag, so that there is no space to remove on the right)

@smnandre
Copy link
Contributor

smnandre commented Nov 9, 2024

(probably on its left, but I haven't checked which side actually wins in practice)

a
{#-#} b
c

Is rendered as

a b
c
   

Looks like letf wins, indeed.

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

No branches or pull requests

3 participants