djlint / djLint

✨ HTML Template Linter and Formatter. Django - Jinja - Nunjucks - Handlebars - GoLang
https://djLint.com
GNU General Public License v3.0
686 stars 84 forks source link

[BUG] [Formatter] Incorrect handling of object context var creates a breaking change #784

Open rob101 opened 11 months ago

rob101 commented 11 months ago

System Info

Issue

In Django, it's common to pass object as a context var. If the object is used in {% set %} djlint will treat it as javascript, creating a breaking change:

This should be untouched:

{% set card_title_1 = object %}

Instead this occurs:

{% set card_title_1 = <class 'object'> %}

How To Reproduce

Run the formatter on any html file containing {% set card_title_1 = object %}

welcome[bot] commented 11 months ago

Thanks for opening your first issue here!

rob101 commented 11 months ago

Possibly a regression of https://github.com/Riverside-Healthcare/djLint/issues/756

haivala commented 2 months ago

I have same problem. using it in twig. This is also {{ block('content_artists', input) ?? '' }} reformatted as {{ block('content_artists', <built-in function input>) ?? '' }}