Skip to content

Commit 3d708b9

Browse files
HSTS: Improved tokenization (#3277)
1 parent a943f2b commit 3d708b9

File tree

5 files changed

+32
-35
lines changed

5 files changed

+32
-35
lines changed

components/prism-hsts.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@
66

77
Prism.languages.hsts = {
88
'directive': {
9-
pattern: /\b(?:max-age=|includeSubDomains|preload)/,
10-
alias: 'keyword'
9+
pattern: /\b(?:includeSubDomains|max-age|preload)(?=[\s;=]|$)/i,
10+
alias: 'property'
1111
},
12-
'safe': {
13-
pattern: /\b\d{8,}\b/,
14-
alias: 'selector'
15-
},
16-
'unsafe': {
17-
pattern: /\b\d{1,7}\b/,
18-
alias: 'function'
19-
}
12+
'operator': /=/,
13+
'punctuation': /;/
2014
};

components/prism-hsts.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
max-age=0;
2+
max-age="0";
3+
max-age=31536000;
4+
max-age="31536000"
5+
6+
----------------------------------------------------
7+
8+
[
9+
["directive", "max-age"],
10+
["operator", "="],
11+
"0",
12+
["punctuation", ";"],
13+
14+
["directive", "max-age"],
15+
["operator", "="],
16+
"\"0\"",
17+
["punctuation", ";"],
18+
19+
["directive", "max-age"],
20+
["operator", "="],
21+
"31536000",
22+
["punctuation", ";"],
23+
24+
["directive", "max-age"],
25+
["operator", "="],
26+
"\"31536000\""
27+
]

tests/languages/hsts/safe_maxage_feature.test

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/languages/hsts/unsafe_maxage_feature.test

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)