EditorConfig: Swap out `property` for `key`; alias with `attr-name` (#3272)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
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.