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] [PR open] Small max_attribute_length combined with a custom_html regex tag breaks formatting #883

Closed
3 tasks done
oliverhaas opened this issue Aug 17, 2024 · 1 comment · Fixed by #884
Labels

Comments

@oliverhaas
Copy link
Contributor

oliverhaas commented Aug 17, 2024

System Info

  • OS: Ubuntu 22.04
  • Python 3.12.4
  • djLint 1.34.1
  • template language: all

Issue

When using small max_attribute_length combined with a custom_html regex tag, the formatter breaks the custom html tags in some cases by inserting whitespace into the tag.

How To Reproduce

  • Use max_attributes_length = 0 (or at least smaller than the last word of the custom html tag)
  • Use (e.g.) custom_html="[\w\-]+"
  • Try to format something like <tag-loooooong></tag-loooooong>
  • Result will include broken tag <tag- loooooong>

image

Fix

I've already implemented a fix and will make a PR right after this issue. The fix is basically what was already done for a similar issue (issue: #236, fix: 1ce378c), but apparently another similar regex in indent.py got overlooked, since my use-case is a very specific one :).

@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.34.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants