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

[BUG] [Formatter] variable regex is getting expanded weirdly #1155

Open
3 tasks done
tamaralyne opened this issue Feb 21, 2025 · 0 comments
Open
3 tasks done

[BUG] [Formatter] variable regex is getting expanded weirdly #1155

tamaralyne opened this issue Feb 21, 2025 · 0 comments
Labels
🦠 bug Something isn't working 🧽 formatter

Comments

@tamaralyne
Copy link

System Info

  • OS: 6.12.10-arch1-1
  • Python Version Python 3.12.9
  • djLint Version (djlint --version)djlint, version 1.36.4
  • template language: e.g. jinja

Issue

Regular expression is getting expanded weirdly when running djlint.

For example:
example.jinja

{% macro input_pattern(pattern) %}
  pattern="^([0-9A-Fa-f]{2})$"
{% endmacro %}

{% macro input() %}
  <input {{ input_pattern(pattern) }} />
{%- endmacro %}

How To Reproduce

❯ djlint --indent 2 --max-blank-lines 1 --quiet --reformat --extension jinja example.jinja

The above example.jinja becomes

{% macro input_pattern(pattern) %}
  pattern="^([0-9A-Fa-f]{2})$"
{% endmacro %}

{% macro input() %}
  <input {{ input_pattern([ ]*)({{-?\+?)[ ]*?((?:(?!}}).)*?\w)(\((?:\"[^\"]*\"|'[^']*'|[^\)])*?\)[ ]*)((?:\[[^\]]*?\]|\.[^\s]+)[ ]*)?((?:(?!}}).)*?-?\+?}}) }} />
{%- endmacro %}

This issue first appears with djlint 1.35.4. With djlint 1.35.3 this doesn't occur.

@tamaralyne tamaralyne added 🦠 bug Something isn't working 🧽 formatter labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🦠 bug Something isn't working 🧽 formatter
Projects
None yet
Development

No branches or pull requests

1 participant