Not a bug XF 2.3.6 Templater Modification bug with .less modifications

Wutime

Well-known member
Affected version
2.3.6
I've come across a strange bug whereby a template modification wants to add an extra curly brace for no apparent reason. These template modifications worked previously, and I've even gone so far as to replicate what XMFG does with it's core.less, but to no avail, the bug persists.

This bug persists across other similar .less template modifications that I've used in the past. The issue seems to lie in the fact of the save removing a line return, hence why the first "test" passes, and the following "test" fails, adding the additional unwanted curly brace.

View attachment bug-issue-templater.mov
 

Attachments

  • Screenshot 2025-02-24 at 11.02.08 PM.webp
    Screenshot 2025-02-24 at 11.02.08 PM.webp
    22.4 KB · Views: 9
  • Screenshot 2025-02-24 at 11.01.57 PM.webp
    Screenshot 2025-02-24 at 11.01.57 PM.webp
    35.3 KB · Views: 11
  • Screenshot 2025-02-24 at 10.56.50 PM.webp
    Screenshot 2025-02-24 at 10.56.50 PM.webp
    12.4 KB · Views: 10
  • Screenshot 2025-02-24 at 10.56.42 PM.webp
    Screenshot 2025-02-24 at 10.56.42 PM.webp
    11.9 KB · Views: 11
You showed two different template modifications there.

The first one, the replacement looks like this:

Code:
<empty line>
{{ include('your_template') }}
<empty line>

The second one your replacement looks like this:

Code:
{{ include('your_template') }}
<empty line>

There is no extra curly brace in either case, it's just an artefact of how the Diff calculates the different replacements you have specified (one with an empty line, one without).

Note that in the second one the Diff says it is removing } but on the next line where the include is, it's prefixed with a } so, again, no extra } it's just how the diff calculates.

There's no bug here. Both template modifications are valid and will work as intended.
 
Okay apologies. I had a customer reporting a .less template was adding an additional curly brace, and then when I got to figuring out why came upon this which seemed to explain it.
 
Back
Top Bottom