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] djlint:off without closing djlint:on only works when no error codes specified #655

Closed
3 tasks done
twolfson opened this issue May 19, 2023 · 5 comments
Closed
3 tasks done
Labels

Comments

@twolfson
Copy link

System Info

  • OS: Linux Mint 20.2
  • Python Version (python --version): Python 3.8.10
  • djLint Version (djlint --version): djlint, version 1.28.0
  • template language: Django

Issue

Hey y'all, I submitted #649 and you patched it super quick =D Sadly, it only half-patched my use case =/

i.e. For certain files I want to use the following at the top, without a closing djlint:on

{# djlint:off H030,H031 #}

You did an amazing job making this work for {# djlint:off #}, just not when it's also H030,H031 or some other error code =/

How To Reproduce

Setup:

index.html:

{# djlint:off H030,H031 #}
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Hello world!</title>
    </head>
    <body>
        Content
    </body>
</html>

Expected behavior:

djlint index.html
# Should see success, no error code

Actual behavior:

djlint index.html
#####
index.html
────────────────────────────────
H030 3:0 Consider adding a meta description. <html lang="en"> 
H031 3:0 Consider adding meta keywords. <html lang="en"> 

Linted 1 file, found 2 errors.
@twolfson twolfson added 🦠 bug Something isn't working 🧽 formatter labels May 19, 2023
christopherpickering pushed a commit that referenced this issue May 22, 2023
# [1.29.0](v1.28.0...v1.29.0) (2023-05-22)

### Bug Fixes

* **formatter:** fix cases where ignore was still formatting set and function code ([ab878ea](ab878ea)), closes [#659](#659)
* **formatter:** fix extra parenth being added in a function call ([faba4f4](faba4f4)), closes [#660](#660)
* **linter:** fixed missing positive on a few <img rules ([5f33d08](5f33d08))

### Features

* **formatter:** added option to disable newlines after yaml front matter ([9bf64ac](9bf64ac)), closes [#662](#662)
* **linter:** allow codes to be ignored for remainder of file ([4637a0f](4637a0f)), closes [#655](#655)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.29.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@twolfson
Copy link
Author

The latest version works great! Thanks y'all!!

@malo-malo
Copy link

Hi @christopherpickering, would it be possible to re-open this issue, or would you rather have a new one ? I think the fix works for the linter, but not always for the formatter.

I have just removed require_pragma=true from my config, and have run into a problem with the formatter modifying files which start with {# djlint:off #}, here is an example to reproduce in the online test version, with the default config :

{# djlint:off #}
<img 
/>

gets transformed into

{# djlint:off #}
<img />

The issue is not systematic however, if we keep the initial example and modify it a bit, it remains untouched :

{# djlint:off #}
<div><p>Welcome to djLint online!</p></div>

@christopherpickering
Copy link
Contributor

@malo-cayocca somehow the comment didn't come up in my notifications, sorry! Yep, I will reopen.

christopherpickering pushed a commit that referenced this issue Jun 26, 2023
## [1.31.1](v1.31.0...v1.31.1) (2023-06-26)

### Bug Fixes

* **formatter:** fixed formatter formatting ignored code ([5c75d87](5c75d87)), closes [#655](#655)
* **formatter:** fixed function formatting with nested quoted parenthesis ([6d63a6a](6d63a6a)), closes [#698](#698)
* **formatter:** fixed overgrabbing on template tag condensing ([75c3134](75c3134)), closes [#686](#686)
* **formatter:** function index was not formatted correctly ([a197200](a197200)), closes [#693](#693)
@christopherpickering
Copy link
Contributor

🎉 This issue has been resolved in version 1.31.1 🎉

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

3 participants