.properties: Use `key`, `value` for token names; `attr-name`, `attr-value` as aliases (#3377)

This commit is contained in:
Wei Ting 2022-03-10 02:05:35 +08:00 committed by GitHub
parent 8a843a17e7
commit b94a664db6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 17 deletions

View File

@ -1,9 +1,13 @@
Prism.languages.properties = {
'comment': /^[ \t]*[#!].*$/m,
'attr-value': {
'value': {
pattern: /(^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?: *[=:] *(?! )| ))(?:\\(?:\r\n|[\s\S])|[^\\\r\n])+/m,
lookbehind: true
lookbehind: true,
alias: 'attr-value'
},
'key': {
pattern: /^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?= *[=:]| )/m,
alias: 'attr-name'
},
'attr-name': /^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?= *[=:]| )/m,
'punctuation': /[=:]/
};

View File

@ -1 +1 @@
Prism.languages.properties={comment:/^[ \t]*[#!].*$/m,"attr-value":{pattern:/(^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?: *[=:] *(?! )| ))(?:\\(?:\r\n|[\s\S])|[^\\\r\n])+/m,lookbehind:!0},"attr-name":/^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?= *[=:]| )/m,punctuation:/[=:]/};
Prism.languages.properties={comment:/^[ \t]*[#!].*$/m,value:{pattern:/(^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?: *[=:] *(?! )| ))(?:\\(?:\r\n|[\s\S])|[^\\\r\n])+/m,lookbehind:!0,alias:"attr-value"},key:{pattern:/^[ \t]*(?:\\(?:\r\n|[\s\S])|[^\\\s:=])+(?= *[=:]| )/m,alias:"attr-name"},punctuation:/[=:]/};

View File

@ -11,26 +11,26 @@ baz
----------------------------------------------------
[
["attr-name", "foo"],
["attr-value", "bar"],
["attr-name", "foo\\:\\=\\ bar"],
["attr-value", "bar\\:\\= \\\r\nbaz"],
["key", "foo"],
["value", "bar"],
["key", "foo\\:\\=\\ bar"],
["value", "bar\\:\\= \\\r\nbaz"],
["attr-name", "foo"],
["key", "foo"],
["punctuation", "="],
["attr-value", "bar"],
["attr-name", "foo\\:\\=\\ bar"],
["value", "bar"],
["key", "foo\\:\\=\\ bar"],
["punctuation", "="],
["attr-value", "bar\\:\\= \\\r\nbaz"],
["value", "bar\\:\\= \\\r\nbaz"],
["attr-name", "foo"],
["key", "foo"],
["punctuation", ":"],
["attr-value", "bar"],
["attr-name", "foo\\:\\=\\ bar"],
["value", "bar"],
["key", "foo\\:\\=\\ bar"],
["punctuation", ":"],
["attr-value", "bar\\:\\= \\\r\nbaz"]
["value", "bar\\:\\= \\\r\nbaz"]
]
----------------------------------------------------
Checks for keys and values.
Checks for keys and values.