Skip to content

Commit b94a664

Browse files
authoredMar 9, 2022
.properties: Use key, value for token names; attr-name, attr-value as aliases (#3377)
1 parent 8a843a1 commit b94a664

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed
 

‎components/prism-properties.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
Prism.languages.properties = {
22
'comment': /^[ \t]*[#!].*$/m,
3-
'attr-value': {
3+
'value': {
44
pattern: /(^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?: *[=:] *(?! )| ))(?:\\(?:\r\n|[\s\S])|[^\\\r\n])+/m,
5-
lookbehind: true
5+
lookbehind: true,
6+
alias: 'attr-value'
7+
},
8+
'key': {
9+
pattern: /^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?= *[=:]| )/m,
10+
alias: 'attr-name'
611
},
7-
'attr-name': /^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?= *[=:]| )/m,
812
'punctuation': /[=:]/
913
};

‎components/prism-properties.min.js

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

‎tests/languages/properties/key_value_feature.test

+13-13
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,26 @@ baz
1111
----------------------------------------------------
1212

1313
[
14-
["attr-name", "foo"],
15-
["attr-value", "bar"],
16-
["attr-name", "foo\\:\\=\\ bar"],
17-
["attr-value", "bar\\:\\= \\\r\nbaz"],
14+
["key", "foo"],
15+
["value", "bar"],
16+
["key", "foo\\:\\=\\ bar"],
17+
["value", "bar\\:\\= \\\r\nbaz"],
1818

19-
["attr-name", "foo"],
19+
["key", "foo"],
2020
["punctuation", "="],
21-
["attr-value", "bar"],
22-
["attr-name", "foo\\:\\=\\ bar"],
21+
["value", "bar"],
22+
["key", "foo\\:\\=\\ bar"],
2323
["punctuation", "="],
24-
["attr-value", "bar\\:\\= \\\r\nbaz"],
24+
["value", "bar\\:\\= \\\r\nbaz"],
2525

26-
["attr-name", "foo"],
26+
["key", "foo"],
2727
["punctuation", ":"],
28-
["attr-value", "bar"],
29-
["attr-name", "foo\\:\\=\\ bar"],
28+
["value", "bar"],
29+
["key", "foo\\:\\=\\ bar"],
3030
["punctuation", ":"],
31-
["attr-value", "bar\\:\\= \\\r\nbaz"]
31+
["value", "bar\\:\\= \\\r\nbaz"]
3232
]
3333

3434
----------------------------------------------------
3535

36-
Checks for keys and values.
36+
Checks for keys and values.

0 commit comments

Comments
 (0)
Please sign in to comment.