Commit deb3a97f61fb4811337ab44a13ee93fb5f54af70

Wei Ting 2022-01-24T20:21:53

INI: Swap out `header` for `section` (#3304)

diff --git a/components/prism-ini.js b/components/prism-ini.js
index 3e261d3..4a40140 100644
--- a/components/prism-ini.js
+++ b/components/prism-ini.js
@@ -10,7 +10,7 @@ Prism.languages.ini = {
 		pattern: /(^[ \f\t\v]*)[#;][^\n\r]*/m,
 		lookbehind: true
 	},
-	'header': {
+	'section': {
 		pattern: /(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,
 		lookbehind: true,
 		inside: {
diff --git a/components/prism-ini.min.js b/components/prism-ini.min.js
index a4e2d8e..7e16e98 100644
--- a/components/prism-ini.min.js
+++ b/components/prism-ini.min.js
@@ -1 +1 @@
-Prism.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},header:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/};
\ No newline at end of file
+Prism.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/};
\ No newline at end of file
diff --git a/tests/languages/ini/header_feature.test b/tests/languages/ini/header_feature.test
deleted file mode 100644
index 9f0df51..0000000
--- a/tests/languages/ini/header_feature.test
+++ /dev/null
@@ -1,86 +0,0 @@
- [foo1] 
-[ "foo2" ]
-[ foo3 ]
-[" foo4 "]
-["foo5 bar5"]
-["foo6"]
-[foo7
-[foo8 bar8]
-[foo9[bar9]
-[foo10]
-[foo11]bar11]
-
-----------------------------------------------------
-
-[
-	["header", [
-		["punctuation", "["],
-		["section-name", "foo1"],
-		["punctuation", "]"]
-	]],
-
-	["header", [
-		["punctuation", "["],
-		["section-name", "\"foo2\""],
-		["punctuation", "]"]
-	]],
-
-	["header", [
-		["punctuation", "["],
-		["section-name", "foo3"],
-		["punctuation", "]"]
-	]],
-
-	["header", [
-		["punctuation", "["],
-		["section-name", "\" foo4 \""],
-		["punctuation", "]"]
-	]],
-
-	["header", [
-		["punctuation", "["],
-		["section-name", "\"foo5 bar5\""],
-		["punctuation", "]"]
-	]],
-
-	["header", [
-		["punctuation", "["],
-		["section-name", "\"foo6\""],
-		["punctuation", "]"]
-	]],
-
-	["header", [
-		["punctuation", "["],
-		["section-name", "foo7"]
-	]],
-
-	["header", [
-		["punctuation", "["],
-		["section-name", "foo8 bar8"],
-		["punctuation", "]"]
-	]],
-
-	["header", [
-		["punctuation", "["],
-		["section-name", "foo9[bar9"],
-		["punctuation", "]"]
-	]],
-
-	["header", [
-		["punctuation", "["],
-		["section-name", "foo10"],
-		["punctuation", "]"]
-	]],
-
-	["header", [
-		["punctuation", "["],
-		["section-name", "foo11"],
-		["punctuation", "]"]
-	]],
-
-	"bar11]"
-]
-
-----------------------------------------------------
-
-Checks for headers (and section names).
diff --git a/tests/languages/ini/section_feature.test b/tests/languages/ini/section_feature.test
new file mode 100644
index 0000000..386ec31
--- /dev/null
+++ b/tests/languages/ini/section_feature.test
@@ -0,0 +1,86 @@
+ [foo1] 
+[ "foo2" ]
+[ foo3 ]
+[" foo4 "]
+["foo5 bar5"]
+["foo6"]
+[foo7
+[foo8 bar8]
+[foo9[bar9]
+[foo10]
+[foo11]bar11]
+
+----------------------------------------------------
+
+[
+	["section", [
+		["punctuation", "["],
+		["section-name", "foo1"],
+		["punctuation", "]"]
+	]],
+
+	["section", [
+		["punctuation", "["],
+		["section-name", "\"foo2\""],
+		["punctuation", "]"]
+	]],
+
+	["section", [
+		["punctuation", "["],
+		["section-name", "foo3"],
+		["punctuation", "]"]
+	]],
+
+	["section", [
+		["punctuation", "["],
+		["section-name", "\" foo4 \""],
+		["punctuation", "]"]
+	]],
+
+	["section", [
+		["punctuation", "["],
+		["section-name", "\"foo5 bar5\""],
+		["punctuation", "]"]
+	]],
+
+	["section", [
+		["punctuation", "["],
+		["section-name", "\"foo6\""],
+		["punctuation", "]"]
+	]],
+
+	["section", [
+		["punctuation", "["],
+		["section-name", "foo7"]
+	]],
+
+	["section", [
+		["punctuation", "["],
+		["section-name", "foo8 bar8"],
+		["punctuation", "]"]
+	]],
+
+	["section", [
+		["punctuation", "["],
+		["section-name", "foo9[bar9"],
+		["punctuation", "]"]
+	]],
+
+	["section", [
+		["punctuation", "["],
+		["section-name", "foo10"],
+		["punctuation", "]"]
+	]],
+
+	["section", [
+		["punctuation", "["],
+		["section-name", "foo11"],
+		["punctuation", "]"]
+	]],
+
+	"bar11]"
+]
+
+----------------------------------------------------
+
+Checks for sections (and section names).