rtts / djhtml

Django/Jinja template indenter
GNU General Public License v3.0
582 stars 32 forks source link

Added support for JavaScript switch statement. #49

Closed pawelpel closed 2 years ago

pawelpel commented 2 years ago

Solution based on newly introduced OpenHard and CloseHard tokens. When closing tag couldn't be matched then we check if there is any OpenHard token in the stack. Then level is set to its predecessor.

Ref. #41

JaapJoris commented 2 years ago

I think I found an example that breaks it:

<!-- Switch inside function -->
<script>
    function foo() {
        switch (a) {
            case b:
                break;
        }
        }
        </script>