Problem/Motivation

Some Twig templates in core violate the following Twig coding standard:

Put one (and only one) space after the start of a delimiter ({{, {%, and {#) and before the end of a delimiter (}}, %}, and #})

Proposed resolution

Fix them.

Remaining tasks

Patch
Followup issue (child of #2571965: [meta] Fix PHP coding standards in core) to automate Twig CS checking

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kmonty created an issue. See original summary.

kmonty’s picture

Status: Active » Needs review
mmatsoo’s picture

Status: Needs review » Reviewed & tested by the community

Worked for me! RTBC.

star-szr’s picture

Status: Reviewed & tested by the community » Needs work

I think this is one of the very few cases in which it's safe to change Stable as well, so let's do so :)

star-szr’s picture

Issue tags: +Twig, +frontend
star-szr’s picture

Issue tags: +Novice
leolandotan’s picture

Assigned: Unassigned » leolandotan
Status: Needs work » Needs review
FileSize
978 bytes

Hi, here I have also updated the taxonomy-term.html.twig file for the Stable theme.

I also got an updated 8.1.x branch.

Thanks!

leolandotan’s picture

Assigned: leolandotan » Unassigned
gvso’s picture

Status: Needs review » Reviewed & tested by the community

Worked for me! RTBC +1

star-szr’s picture

Title: Twig coding standards violation in taxonomy-term.html.twig » Ensure Twig delimiters have correct inner spacing
Component: taxonomy.module » theme system
Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs followup
Related issues: +#2571965: [meta] Fix PHP coding standards in core

Thanks! So I did find a similar case in Bartik, we can at least fix all similar cases like this so that this issue has a bit more reasonable scope per https://www.drupal.org/core/scope#coding-standards. Expanding the title and summary accordingly. @kmonty it might be too big for trivial patch of the month but I think it's better this way :)

You can grep with your editor/IDE or via shell (with globbing):

grep -Enr "([^ -](}|%|#)}|{({|%|#)[^ -])" core/**/*.html.twig
core/modules/taxonomy/templates/taxonomy-term.html.twig:28:<div{{ attributes}}>
core/themes/bartik/templates/page.html.twig:55:    <header id="header" class="header" role="banner" aria-label="{{ 'Site header'|t}}">
core/themes/stable/templates/content/taxonomy-term.html.twig:26:<div{{ attributes}}>

We don't currently have any automated way to check Twig coding standards so we could probably use a sub-issue of #2571965: [meta] Fix PHP coding standards in core to at least discuss this, tagging for follow-up for that.

gvso’s picture

Status: Needs work » Needs review
FileSize
1.54 KB

Fixed the missing space in Bartik

johnmcc’s picture

Looks good to me and applies cleanly to 8.1.x.

mmatsoo’s picture

RTBC +1. (On both 8.1.0-dev and 8.0.4)

mmatsoo’s picture

Status: Needs review » Reviewed & tested by the community

  • Cottser committed c3707e1 on 8.1.x
    Issue #2644718 by kmonty, gvso, leolando.tan, Cottser, mmatsoo: Ensure...
star-szr’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! We need that follow-up filed, can someone please do so and add it as a related issue here?

Committed c3707e1 and pushed to 8.1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.