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

[HTML] don't indent after DOCTYPE, add indentation tests #2473

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions HTML/Indentation Rules.tmPreferences
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
^.* (
# a valid non-self-closing HTML tag that doesn't close itself on the same line
<(?!
!-- # no comment
| [?%] # no section
!-- # no comment
| [?%] # no preprocessor section like PHP/ASP
| !DOCTYPE # no document type
| (?i:area|base|br|col|frame|hr|html|img|input|link|meta|param)[\t\n\f /<>]
)(?:
# tag name
Expand Down
24 changes: 24 additions & 0 deletions HTML/syntax_test_html_indentation.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## SYNTAX TEST reindent-unchanged "Packages/HTML/HTML.sublime-syntax"
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Page Title Here</title>
<!-- this comment's
indentation should
be unchanged
-->
</head>
<body>

<div class="main">
<span class="something">Blah</span>
<span class="something">
Foobar
</span>
</div>

<script type="text/javascript" src="/some_script.js"></script>
</body>
</html>