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] Extra blank lines inserted after blank_line_after_tag tags with preserve_blank_lines #297

Closed
3 tasks done
aarongoldenthal opened this issue Jul 23, 2022 · 2 comments
Labels

Comments

@aarongoldenthal
Copy link

System Info

  • OS: Windows 10 21H2
  • Python Version (python --version): 3.10.3
  • djLint Version (djlint --version): 1.7.1
  • template language: nunjucks

Issue

Using nunjucks templates with preserve_blank_lines: true, any tag listed in blank_line_after_tag has a new blank line inserted after it on every reformat.

The expected behavior in this case is that a blank line is inserted after the identified tags in blank_line_after_tag only if there is not already a blank line.

How To Reproduce

With config:

{
  "blank_line_after_tag": "extends",
  "preserve_blank_lines": true
}

and nunjucks file:

{% extends "layouts/base.njk" %}

<!-- other content -->

run djlint --reformat **/*.njk muliple times, and each time it adds a new blank after the extends tag.

This looks like it's related to #79.

@aarongoldenthal aarongoldenthal added 🦠 bug Something isn't working 🧽 formatter labels Jul 23, 2022
@christopherpickering
Copy link
Contributor

Thanks @aarongoldenthal !

christopherpickering pushed a commit that referenced this issue Jul 25, 2022
## [1.7.2](v1.7.1...v1.7.2) (2022-07-25)

### Bug Fixes

* **white space:** prevent duplicate blank lines from being added ([67306b4](67306b4)), closes [#297](#297)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.7.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

No branches or pull requests

2 participants