Skip to content

Releases: rtts/djhtml

3.0.6

16 Mar 21:49
47f33ed
Compare
Choose a tag to compare

What's Changed

  • Fix javascript regular expression literals by @JaapJoris in #93

Full Changelog: 3.0.5...3.0.6

3.0.5

09 Mar 09:31
Compare
Choose a tag to compare

What's Changed

Full Changelog: 3.0.4...3.0.5

3.0.4

07 Mar 21:33
Compare
Choose a tag to compare

What's Changed

  • Reset absolute offsets more aggressively in DjCSS mode

    Previous behavior:

      background: linear-gradient(
                      foo,
                      bar
                  )
    

    New behavior:

      background: linear-gradient(
          foo,
          bar
      )
    
  • Support SCSS comments
    Small life hack: if you leave out the space after //, these types of
    comments work in regular CSS too!

  • Compromise on JS regular expression literals. The compromise is that they cannot contain spaces. If they can, it becomes impossible to distinguish between

      re = / foo( // comment
    

    and

      not_re = x / foo( // comment
    

    In other words, it's impossible to distinguish between the division sign and the beginning of a regex literal. It still is, but now it will be less of problem for literals without spaces.

Full Changelog: 3.0.3...3.0.4

3.0.3

04 Mar 15:17
Compare
Choose a tag to compare

What's Changed

  • Add support for Slippers component syntax by @jnns in #87
  • Add per-file output to --check by @DeD1rk in #88
  • The -q / --quiet option has been removed in favor of printing all output to stderr. That way, the user can redirect stderr to /dev/null in order to ignore it.

New Contributors

Full Changelog: 3.0.2...3.0.3

3.0.2

24 Feb 07:50
97067bd
Compare
Choose a tag to compare

This release fixes the "bug" that DjHTML was a little too opinionated when indenting multi-line HTML elements: #82 The old behavior has been restored, but only when the character following the tagname is a newline:

<long-html-tag
    attribute1="value"
    attribute2="value"
    attribute3="value"/>

This tweak will hopefully appease existing DjHTML users that were already used to the old behavior, and gives them a way to continue using it by placing all attributes on separate lines. A special thanks to @Thutmose3 for making this suggestion!

What's Changed

Full Changelog: 3.0.1...3.0.2

3.0.1

23 Feb 09:00
Compare
Choose a tag to compare

This release fixes a DjCSS bug that was kindly reported by @GitRon moments after 3.0.0 was released.

What's Changed

Full Changelog: 3.0.0...3.0.1

DjHTML 3 is here!

23 Feb 01:07
342c61f
Compare
Choose a tag to compare

This major new release fixes all outstanding bugs in DjHTML πŸ₯³

There are no backwards-incompatible changes in the usage of DjHTML, but the indentation it produces has been improved significantly. Here is an overview of all the things that changed:

Support for Python 3.6 and 3.7 has been dropped

Sorry folks, but these Python versions are now so old it's time to drop support. If you're forced by whatever reason to use Python 3.6 or 3.7, please use DjHTML version 2 or older because they still work fine (minus all the improvements this release brings, of course).

New multiline HTML element indentation

The long-standing issue #50 has finally been solved! DjHTML not only carefully aligns the attributes of multi-line HTML elements, it even aligns the contents of multi-line attribute values! The README now starts with this very appropriate example:

<blockquote cite="Guido Van Rossum"
            style="font-style: italic;
                   {% if dark_mode %}
                       background: black;
                   {% endif %}
                  ">
    Don't you hate code that's not properly indented?
</blockquote>

Thanks again @adamchainz for reporting this issue, and also for your other contributions πŸ™

Both opening and closing comment tags are now ignored

Previous versions of DjHTML indented the opening tag, but not the closing tag of comments, which resulted in ugliness like this:

<div>
    <p>
        {# ╔══════════════════════════╗
   β•‘ Carefully laid out table β•‘
   β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β• #}
    </p>
</div>

Now, DjHTML completely leaves comments alone.

Improved CSS and JS multi-line statements

Not just multi-line HTML elements have improved, also multi-line CSS statements (#74) and multi-line JS expressions (#59) have been improved thanks to new handling of relative and absolute offsets. There have been too many improvements to list here, but if you're curious about the indentation rules, check out the files in the test suite to see how they are indented.

Improved unittests

Speaking of the test suite, the unformatted *.in files have been removed in favor of tracking new *.tokens files that contain the exact internal representation of all available source files. This will help to identify bugs more easily and will guard against unintended changes to the way source is tokenized, even if those changes do not affect the indentation.

In addition to the unittests, DjHTML has been tested thoroughly by running it over many open source codebases such as Django, Sentry, Readthedocs, and of course the awesome Wagtail. This helped to identify a number of new bugs that have all been fixed as well.

Welcoming to contributors

One thing that hasn't changed is our openness to your contributions. We'd like to thank everyone for reporting bugs and suggesting improvements, and we'd like to encourage you to keep doing so. Without your help DjHTML wouldn't be as awesome as it is now!

New Contributors

  • @jnns made their first contribution in #73

Full Changelog

v2.0.0...3.0.0

v2.0.0

31 Jan 21:53
Compare
Choose a tag to compare

Happy new year everyone! This release bumps the major version number to 2 because there has been a backwards-incompatible change: the -i command line option has been removed, because modifying files in-place is now the default.

If you have a custom pre-commit configuration with an entry key such as the following:

repos:
  - repo: https://github.com/rtts/djhtml
    rev: v2.0.0
    hooks:
      - id: djhtml
        entry: djhtml -i --tabwith 2

Please remove the -i argument for it to keep working as before:

repos:
  - repo: https://github.com/rtts/djhtml
    rev: v2.0.0
    hooks:
      - id: djhtml
        entry: djhtml --tabwith 2

Removing this argument not only made sense because modifying files is DjHTML's main use case, but also because it makes DjHTML more compatible with Windows (see #69). A big thanks to @GitRon and @spapas for figuring this out!

Note that otherwise the indentation algorithm is exactly the same. Also note that there are 2 known bugs in this algorithm: #50 and #59. We still need help to solve them. Feel free to submit your PRs and get them published in the next release!

What's Changed

Full Changelog: v1.5.2...v2.0.0

v1.5.2

04 Aug 15:15
Compare
Choose a tag to compare

What's Changed

  • Support passing directories as command-line arguments by @pgjones in #64

New Contributors

Full Changelog: v1.5.1...v1.5.2

v1.5.1

23 Jun 23:12
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.5.0...v1.5.1