Apply spaceless to templates to remove whitespaces

Created on 28 June 2022, over 2 years ago
Updated 26 March 2024, 9 months ago

Problem/Motivation

I'm using this module in combination with views_data_export and views_field_view, this still results in some whitespaces before the first item, between items and the separator and after the last item.

Steps to reproduce

Proposed resolution

Patch attached applies the spaceless filter to remove whitespaces.

Use the spaceless filter to remove whitespace between HTML tags, not whitespace within HTML tags or whitespace in plain text:

https://twig.symfony.com/doc/3.x/filters/spaceless.html

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇧🇪Belgium JeroenT 🇧🇪

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇨🇦Canada leducdubleuet Chicoutimi QC

    This is exactly what I was looking for so the module works like it was in Drupal 7. The template should not introduce any whitespace other than the one(s) specified in the parameters.

    So this patch applies cleanly and works really well, thank you very much to JeroenT!

    Would it be possible to commit this patch into the next release please?

    Thanks for this great module!

  • 🇨🇦Canada leducdubleuet Chicoutimi QC

    This patch is still needed for the new 2.0.0-alpha2 release.

    Here is a new simpler version of the patch based on 2.0.0-alpha2.

    It would be great if this could be included in a new release please.

  • 🇦🇺Australia sime Melbourne

    This works great for me. For the googlers - be warned that twig debug being switched on makes it look like its not working.

  • First commit to issue fork.
  • 🇨🇦Canada mparker17 UTC-4

    Apologies; I didn't get a notification for this issue, so I didn't realize this ticket existed or that there was a patch ready.

    I've created an issue fork, so that I can see if there are any test failures related to the changes in this ticket. I don't see any tests in the patch - but I'm not sure how one could write tests for this particular change - so I want to do some manual testing before I merge this.

  • Status changed to Needs work 9 months ago
  • 🇨🇦Canada mparker17 UTC-4

    Hmm... I'm seeing test failures, so I think we need to update the tests to account for the new functionality.

Production build 0.71.5 2024