Skip to content

Commit

Permalink
HSTS: Improved tokenization (#3277)
Browse files Browse the repository at this point in the history
  • Loading branch information
RunDevelopment committed Dec 18, 2021
1 parent a943f2b commit 3d708b9
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 35 deletions.
14 changes: 4 additions & 10 deletions components/prism-hsts.js
Expand Up @@ -6,15 +6,9 @@

Prism.languages.hsts = {
'directive': {
pattern: /\b(?:max-age=|includeSubDomains|preload)/,
alias: 'keyword'
pattern: /\b(?:includeSubDomains|max-age|preload)(?=[\s;=]|$)/i,
alias: 'property'
},
'safe': {
pattern: /\b\d{8,}\b/,
alias: 'selector'
},
'unsafe': {
pattern: /\b\d{1,7}\b/,
alias: 'function'
}
'operator': /=/,
'punctuation': /;/
};
2 changes: 1 addition & 1 deletion components/prism-hsts.min.js

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

27 changes: 27 additions & 0 deletions tests/languages/hsts/max-age_feature.test
@@ -0,0 +1,27 @@
max-age=0;
max-age="0";
max-age=31536000;
max-age="31536000"

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

[
["directive", "max-age"],
["operator", "="],
"0",
["punctuation", ";"],

["directive", "max-age"],
["operator", "="],
"\"0\"",
["punctuation", ";"],

["directive", "max-age"],
["operator", "="],
"31536000",
["punctuation", ";"],

["directive", "max-age"],
["operator", "="],
"\"31536000\""
]
12 changes: 0 additions & 12 deletions tests/languages/hsts/safe_maxage_feature.test

This file was deleted.

12 changes: 0 additions & 12 deletions tests/languages/hsts/unsafe_maxage_feature.test

This file was deleted.

0 comments on commit 3d708b9

Please sign in to comment.