Skip to content

Commit

Permalink
EditorConfig: Swap out property for key; alias with attr-name (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
hoonweiting committed Dec 5, 2021
1 parent 220bc40 commit bee6ad5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions 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,
Expand All @@ -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': /^=/
}
Expand Down
2 changes: 1 addition & 1 deletion components/prism-editorconfig.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/languages/editorconfig/key_value_feature.test
Expand Up @@ -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"
Expand All @@ -24,4 +24,4 @@ foobar = 42

----------------------------------------------------

Checks for key/value pairs.
Checks for key/value pairs.

0 comments on commit bee6ad5

Please sign in to comment.