Skip to content

empty <script> tag wraps but doesn't indent properly #13

Closed
@AlexHowansky

Description

@AlexHowansky

Given this input file:

<!doctype html>
<html>
<head>
<title>test</title>
<link href="foo.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript" src="bar.js"></script>
</head>
<body>
</body>
</html>

I'll run tidy like this:

tidy --indent yes --indent-spaces 4 --wrap 0 --quiet yes --tidy-mark no test.html

And get:

<!DOCTYPE html>
<html>
    <head>
        <title>
            test
        </title>
        <link href="foo.css" media="screen" rel="stylesheet" type="text/css">
        <script type="text/javascript" src="bar.js">
</script>
    </head>
    <body>
    </body>
</html>

Note that the closing script tag is wrapped but not indented. If I put a comment inside the tags:

<!doctype html>
<html>
<head>
<title>test</title>
<link href="foo.css" media="screen" rel="stylesheet" type="text/css">
<script type="text/javascript" src="bar.js"><!-- nothing --></script>
</head>
<body>
</body>
</html>

Then I'll get this:

<!DOCTYPE html>
<html>
    <head>
        <title>
            test
        </title>
        <link href="foo.css" media="screen" rel="stylesheet" type="text/css">
        <script type="text/javascript" src="bar.js">
<!-- nothing -->
        </script>
    </head>
    <body>
    </body>
</html>

I'm thinking that the closing script tag should either not wrap at all (in the case where there's no content) or wrap and be indented to match the opening tag.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions