Skip to content

Commit 8d0bebf

Browse files
committed
fix single letter tags, apostrophes
1 parent c435298 commit 8d0bebf

File tree

5 files changed

+22
-8
lines changed

5 files changed

+22
-8
lines changed

docs/js/indent.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/indent.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ var indent = (function (root) {
5151
}
5252

5353
var NEW_LINE_REGEX = /\r*\n/;
54+
var HTML_TAG_RULES = ["tag", "void-tags", "html-tag"];
5455

5556
/**
5657
* Soft dedent: this type of dedent has the opposite effect and will actually indent every line
@@ -157,9 +158,8 @@ var indent = (function (root) {
157158
{
158159
$languages: "js html",
159160
$name: "tag",
160-
$excludeIf: ["="],
161161
$startPatterns: [function (string, rule, state) {
162-
var re = /<([A-Za-z][A-Za-z0-9\-\.]+)/;
162+
var re = /<([A-Za-z][A-Za-z0-9\-\.]*)/;
163163
var match = string.match(re);
164164
if (match) {
165165
state.openingTag = match[1];
@@ -251,6 +251,7 @@ var indent = (function (root) {
251251
{
252252
$languages: "js html",
253253
$name: "quotes",
254+
$excludeIf: HTML_TAG_RULES,
254255
$startPatterns: [/"/],
255256
$endPatterns: [/"/, NEW_LINE_REGEX],
256257
$ignoreRules: true,
@@ -259,6 +260,7 @@ var indent = (function (root) {
259260
{
260261
$languages: "js html",
261262
$name: "quotes",
263+
$excludeIf: HTML_TAG_RULES,
262264
$startPatterns: [/'/],
263265
$endPatterns: [/'/, NEW_LINE_REGEX],
264266
$ignoreRules: true,
@@ -402,7 +404,7 @@ var indent = (function (root) {
402404
{
403405
$languages: "js",
404406
$name: "=",
405-
$excludeIf: ["tag", "void-tags", "html-tag"],
407+
$excludeIf: HTML_TAG_RULES,
406408
$startPatterns: [/=/],
407409
$endPatterns: [/[,;\)\]}]/, NEW_LINE_REGEX]
408410
},

0 commit comments

Comments
 (0)