Commit bee6ad56d77417650e62597b001894139541f749

Wei Ting 2021-12-06T01:44:55

EditorConfig: Swap out `property` for `key`; alias with `attr-name` (#3272)

diff --git a/components/prism-editorconfig.js b/components/prism-editorconfig.js
index 5a5eeaf..e4775e7 100644
--- a/components/prism-editorconfig.js
+++ b/components/prism-editorconfig.js
@@ -1,5 +1,5 @@
 Prism.languages.editorconfig = {
-	// https://editorconfig-specification.readthedocs.io/en/latest/
+	// https://editorconfig-specification.readthedocs.io
 	'comment': /[;#].*/,
 	'section': {
 		pattern: /(^[ \t]*)\[.+\]/m,
@@ -11,13 +11,14 @@ Prism.languages.editorconfig = {
 			'punctuation': /[\[\]{},]/
 		}
 	},
-	'property': {
+	'key': {
 		pattern: /(^[ \t]*)[^\s=]+(?=[ \t]*=)/m,
-		lookbehind: true
+		lookbehind: true,
+		alias: 'attr-name'
 	},
 	'value': {
 		pattern: /=.*/,
-		alias: 'string',
+		alias: 'attr-value',
 		inside: {
 			'punctuation': /^=/
 		}
diff --git a/components/prism-editorconfig.min.js b/components/prism-editorconfig.min.js
index e360ed8..435b900 100644
--- a/components/prism-editorconfig.min.js
+++ b/components/prism-editorconfig.min.js
@@ -1 +1 @@
-Prism.languages.editorconfig={comment:/[;#].*/,section:{pattern:/(^[ \t]*)\[.+\]/m,lookbehind:!0,alias:"keyword",inside:{regex:/\\\\[\[\]{},!?.*]/,operator:/[!?]|\.\.|\*{1,2}/,punctuation:/[\[\]{},]/}},property:{pattern:/(^[ \t]*)[^\s=]+(?=[ \t]*=)/m,lookbehind:!0},value:{pattern:/=.*/,alias:"string",inside:{punctuation:/^=/}}};
\ No newline at end of file
+Prism.languages.editorconfig={comment:/[;#].*/,section:{pattern:/(^[ \t]*)\[.+\]/m,lookbehind:!0,alias:"keyword",inside:{regex:/\\\\[\[\]{},!?.*]/,operator:/[!?]|\.\.|\*{1,2}/,punctuation:/[\[\]{},]/}},key:{pattern:/(^[ \t]*)[^\s=]+(?=[ \t]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/=.*/,alias:"attr-value",inside:{punctuation:/^=/}}};
\ No newline at end of file
diff --git a/tests/languages/editorconfig/key_value_feature.test b/tests/languages/editorconfig/key_value_feature.test
index dfcbd6a..545e34d 100644
--- a/tests/languages/editorconfig/key_value_feature.test
+++ b/tests/languages/editorconfig/key_value_feature.test
@@ -5,17 +5,17 @@ foobar = 42
 ----------------------------------------------------
 
 [
-	["property", "foo"],
+	["key", "foo"],
 	["value", [
 		["punctuation", "="],
 		" Bar Baz"
 	]],
-	["property", "foobar"],
+	["key", "foobar"],
 	["value", [
 		["punctuation", "="],
 		" 42"
 	]],
-	["property", "another_value"],
+	["key", "another_value"],
 	["value", [
 		["punctuation", "="],
 		" with_indent"
@@ -24,4 +24,4 @@ foobar = 42
 
 ----------------------------------------------------
 
-Checks for key/value pairs.
\ No newline at end of file
+Checks for key/value pairs.