From ac2629378fb0408223447617061102d2b0c53cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Sun, 3 May 2020 17:27:47 +0800 Subject: [PATCH 01/23] pug: Improved class(named "attr-class") and id(named "attr-id") in tag detection, and added corresponding unit test. --- components/prism-pug.js | 8 ++++++++ tests/languages/pug/tag_feature.test | 24 ++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/components/prism-pug.js b/components/prism-pug.js index b1ecd942a3..3cf7802019 100644 --- a/components/prism-pug.js +++ b/components/prism-pug.js @@ -112,6 +112,14 @@ pattern: /(^[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/m, lookbehind: true, inside: { + 'attr-id': { + pattern: /(^[\t ]*(?!-)[\w\-.]*)#[\w\-]+/, + lookbehind: true + }, + 'attr-class': { + pattern: /(^[\t ]*(?!-)[\w\-#]*)\.[\w\-]+/, + lookbehind: true + }, 'attributes': [ { pattern: /&[^(]+\([^)]+\)/, diff --git a/tests/languages/pug/tag_feature.test b/tests/languages/pug/tag_feature.test index b4dbf0348d..9f07b5fa9b 100644 --- a/tests/languages/pug/tag_feature.test +++ b/tests/languages/pug/tag_feature.test @@ -13,6 +13,9 @@ a.button a#main-link #content +div#test-id.test-class1.test-class2 +.test-class1#test-id.test-class2 + a: span ---------------------------------------------------- @@ -83,10 +86,23 @@ a: span ]] ]], - ["tag", ["a.button"]], - ["tag", [".content"]], - ["tag", ["a#main-link"]], - ["tag", ["#content"]], + ["tag", [ + "a", + ["attr-class", ".button"]]], + ["tag", [["attr-class", ".content"]]], + ["tag", [ + "a", + ["attr-id", "#main-link"]]], + ["tag", [["attr-id", "#content"]]], + ["tag", [ + "div", + ["attr-id", "#test-id"], + ["attr-class", ".test-class1"], + ["attr-class", ".test-class2"]]], + ["tag", [ + ["attr-class", ".test-class1"], + ["attr-id", "#test-id"], + ["attr-class", ".test-class2"]]], ["tag", ["a", ["punctuation", ":"]]], ["tag", ["span"]] From c48d6545b47452742fa2f014888b6a513d3b1e74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Sun, 3 May 2020 21:41:14 +0800 Subject: [PATCH 02/23] pug: rewrite the better code, run "npx gulp" and commit ".min.js" --- components/prism-pug.js | 12 +++--------- components/prism-pug.min.js | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/components/prism-pug.js b/components/prism-pug.js index 3cf7802019..6860ded5dd 100644 --- a/components/prism-pug.js +++ b/components/prism-pug.js @@ -112,14 +112,6 @@ pattern: /(^[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/m, lookbehind: true, inside: { - 'attr-id': { - pattern: /(^[\t ]*(?!-)[\w\-.]*)#[\w\-]+/, - lookbehind: true - }, - 'attr-class': { - pattern: /(^[\t ]*(?!-)[\w\-#]*)\.[\w\-]+/, - lookbehind: true - }, 'attributes': [ { pattern: /&[^(]+\([^)]+\)/, @@ -138,7 +130,9 @@ } } ], - 'punctuation': /:/ + 'punctuation': /:/, + 'attr-id': /#[\w\-]+/, + 'attr-class': /\.[\w\-]+/ } }, 'code': [ diff --git a/components/prism-pug.min.js b/components/prism-pug.min.js index b116e79089..68ccecfdc0 100644 --- a/components/prism-pug.min.js +++ b/components/prism-pug.min.js @@ -1 +1 @@ -!function(e){e.languages.pug={comment:{pattern:/(^([\t ]*))\/\/.*(?:(?:\r?\n|\r)\2[\t ]+.+)*/m,lookbehind:!0},"multiline-script":{pattern:/(^([\t ]*)script\b.*\.[\t ]*)(?:(?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/m,lookbehind:!0,inside:e.languages.javascript},filter:{pattern:/(^([\t ]*)):.+(?:(?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/m,lookbehind:!0,inside:{"filter-name":{pattern:/^:[\w-]+/,alias:"variable"}}},"multiline-plain-text":{pattern:/(^([\t ]*)[\w\-#.]+\.[\t ]*)(?:(?:\r?\n|\r(?!\n))(?:\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/m,lookbehind:!0},markup:{pattern:/(^[\t ]*)<.+/m,lookbehind:!0,inside:e.languages.markup},doctype:{pattern:/((?:^|\n)[\t ]*)doctype(?: .+)?/,lookbehind:!0},"flow-control":{pattern:/(^[\t ]*)(?:if|unless|else|case|when|default|each|while)\b(?: .+)?/m,lookbehind:!0,inside:{each:{pattern:/^each .+? in\b/,inside:{keyword:/\b(?:each|in)\b/,punctuation:/,/}},branch:{pattern:/^(?:if|unless|else|case|when|default|while)\b/,alias:"keyword"},rest:e.languages.javascript}},keyword:{pattern:/(^[\t ]*)(?:block|extends|include|append|prepend)\b.+/m,lookbehind:!0},mixin:[{pattern:/(^[\t ]*)mixin .+/m,lookbehind:!0,inside:{keyword:/^mixin/,function:/\w+(?=\s*\(|\s*$)/,punctuation:/[(),.]/}},{pattern:/(^[\t ]*)\+.+/m,lookbehind:!0,inside:{name:{pattern:/^\+\w+/,alias:"function"},rest:e.languages.javascript}}],script:{pattern:/(^[\t ]*script(?:(?:&[^(]+)?\([^)]+\))*[\t ]+).+/m,lookbehind:!0,inside:e.languages.javascript},"plain-text":{pattern:/(^[\t ]*(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?[\t ]+).+/m,lookbehind:!0},tag:{pattern:/(^[\t ]*)(?!-)[\w\-#.]*[\w\-](?:(?:&[^(]+)?\([^)]+\))*\/?:?/m,lookbehind:!0,inside:{attributes:[{pattern:/&[^(]+\([^)]+\)/,inside:e.languages.javascript},{pattern:/\([^)]+\)/,inside:{"attr-value":{pattern:/(=\s*)(?:\{[^}]*\}|[^,)\r\n]+)/,lookbehind:!0,inside:e.languages.javascript},"attr-name":/[\w-]+(?=\s*!?=|\s*[,)])/,punctuation:/[!=(),]+/}}],punctuation:/:/}},code:[{pattern:/(^[\t ]*(?:-|!?=)).+/m,lookbehind:!0,inside:e.languages.javascript}],punctuation:/[.\-!=|]+/};for(var t=[{filter:"atpl",language:"twig"},{filter:"coffee",language:"coffeescript"},"ejs","handlebars","less","livescript","markdown",{filter:"sass",language:"scss"},"stylus"],n={},a=0,i=t.length;a Date: Mon, 4 May 2020 14:24:11 +0800 Subject: [PATCH 03/23] Stylus: Fix comment-like grammar(/**/ or //) in property url() and string display --- components/prism-stylus.js | 10 ++++++- components/prism-stylus.min.js | 2 +- .../stylus/property-declaration_feature.test | 27 +++++++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/components/prism-stylus.js b/components/prism-stylus.js index 256b70f77e..f3a4cd9ae8 100644 --- a/components/prism-stylus.js +++ b/components/prism-stylus.js @@ -1,6 +1,9 @@ (function (Prism) { var inside = { - 'url': /url\((["']?).*?\1\)/i, + 'url': { + pattern: /url\((["']?).*?\1\)/i, + greedy: true + }, 'string': { pattern: /("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/, greedy: true @@ -78,6 +81,7 @@ 'property-declaration': { pattern: /((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m, lookbehind: true, + greedy: true, inside: { 'property': { pattern: /^[^\s:]+/, @@ -85,6 +89,10 @@ 'interpolation': inside.interpolation } }, + 'comment': { + pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, + lookbehind: true + }, rest: inside } }, diff --git a/components/prism-stylus.min.js b/components/prism-stylus.min.js index 08309271e9..02045fb092 100644 --- a/components/prism-stylus.min.js +++ b/components/prism-stylus.min.js @@ -1 +1 @@ -!function(n){var t={url:/url\((["']?).*?\1\)/i,string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,number:/\b\d+(?:\.\d+)?%?/,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.+|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],punctuation:/[{}()\[\];:,]/};t.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:t}},t.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:t}},n.languages.stylus={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:t}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:t}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:t}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:t.interpolation}},rest:t}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:t.interpolation,punctuation:/[{},]/}},func:t.func,string:t.string,interpolation:t.interpolation,punctuation:/[{}()\[\];:.]/}}(Prism); \ No newline at end of file +!function(n){var t={url:{pattern:/url\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,number:/\b\d+(?:\.\d+)?%?/,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.+|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],punctuation:/[{}()\[\];:,]/};t.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:t}},t.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:t}},n.languages.stylus={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:t}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:t}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:t}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,greedy:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:t.interpolation}},comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},rest:t}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:t.interpolation,punctuation:/[{},]/}},func:t.func,string:t.string,interpolation:t.interpolation,punctuation:/[{}()\[\];:.]/}}(Prism); \ No newline at end of file diff --git a/tests/languages/stylus/property-declaration_feature.test b/tests/languages/stylus/property-declaration_feature.test index 275eb43d92..ff42f035dd 100644 --- a/tests/languages/stylus/property-declaration_feature.test +++ b/tests/languages/stylus/property-declaration_feature.test @@ -10,6 +10,12 @@ background-{foo}: bar; div {foo} bar +comment + content 'http://www.example.com' // comment + background url(http://example.com) /* comment */ + background /* comment */ url("http://example.com") + content '/* this is string not comment */' + ---------------------------------------------------- [ @@ -44,6 +50,27 @@ div ]] ]], " bar" + ]], + + ["selector", ["comment"]], + ["property-declaration", [ + ["property", ["content"]], + ["string", "'http://www.example.com'"], + ["comment", "// comment"] + ]], + ["property-declaration", [ + ["property", ["background"]], + ["url", "url(http://example.com)"], + ["comment", "/* comment */"] + ]], + ["property-declaration", [ + ["property", ["background"]], + ["comment", "/* comment */"], + ["url", "url(\"http://example.com\")"] + ]], + ["property-declaration", [ + ["property", ["content"]], + ["string", "'/* this is string not comment */'"] ]] ] From c3da26ff4867a2716afba08c0ff34ac8fdd3e8f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Mon, 4 May 2020 22:19:22 +0800 Subject: [PATCH 04/23] Stylus: replace the `comment` in the `inside` object --- components/prism-stylus.js | 8 ++++---- components/prism-stylus.min.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/prism-stylus.js b/components/prism-stylus.js index f3a4cd9ae8..9ebc873632 100644 --- a/components/prism-stylus.js +++ b/components/prism-stylus.js @@ -1,5 +1,9 @@ (function (Prism) { var inside = { + 'comment': { + pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, + lookbehind: true + }, 'url': { pattern: /url\((["']?).*?\1\)/i, greedy: true @@ -89,10 +93,6 @@ 'interpolation': inside.interpolation } }, - 'comment': { - pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, - lookbehind: true - }, rest: inside } }, diff --git a/components/prism-stylus.min.js b/components/prism-stylus.min.js index 02045fb092..002e32893d 100644 --- a/components/prism-stylus.min.js +++ b/components/prism-stylus.min.js @@ -1 +1 @@ -!function(n){var t={url:{pattern:/url\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,number:/\b\d+(?:\.\d+)?%?/,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.+|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],punctuation:/[{}()\[\];:,]/};t.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:t}},t.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:t}},n.languages.stylus={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:t}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:t}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:t}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,greedy:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:t.interpolation}},comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},rest:t}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:t.interpolation,punctuation:/[{},]/}},func:t.func,string:t.string,interpolation:t.interpolation,punctuation:/[{}()\[\];:.]/}}(Prism); \ No newline at end of file +!function(n){var t={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/url\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,number:/\b\d+(?:\.\d+)?%?/,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.+|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],punctuation:/[{}()\[\];:,]/};t.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:t}},t.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:t}},n.languages.stylus={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:t}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:t}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:t}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,greedy:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:t.interpolation}},rest:t}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:t.interpolation,punctuation:/[{},]/}},func:t.func,string:t.string,interpolation:t.interpolation,punctuation:/[{}()\[\];:.]/}}(Prism); \ No newline at end of file From 2cb260f0dc192f9f8dacfbb35c729adc981cc435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Wed, 6 May 2020 20:51:14 +0800 Subject: [PATCH 05/23] Stylus: Add `color`, `entity`, `unit`, change `number` and `operator` in `inside` object, Fix relational tests. --- components/prism-stylus.js | 28 +++++++++++++++++-- components/prism-stylus.min.js | 2 +- .../stylus+pug/stylus_inclusion.test | 2 +- tests/languages/stylus/func_feature.test | 2 +- tests/languages/stylus/important_feature.test | 2 +- tests/languages/stylus/number_feature.test | 6 ++-- .../stylus/property-declaration_feature.test | 6 ++-- tests/languages/stylus/selector_feature.test | 10 +++---- 8 files changed, 42 insertions(+), 16 deletions(-) diff --git a/components/prism-stylus.js b/components/prism-stylus.js index 9ebc873632..7a732b7ea8 100644 --- a/components/prism-stylus.js +++ b/components/prism-stylus.js @@ -1,4 +1,14 @@ (function (Prism) { + var unit = { + pattern: /(\d)(?:%|[a-z]+)/, + lookbehind: true + }; + // 123 -123 .123 -.123 12.3 -12.3 + var number = { + pattern: /(^|[^\w.-]|)-?\d*\.?\d+/, + lookbehind: true + }; + var inside = { 'comment': { pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, @@ -20,13 +30,27 @@ lookbehind: true }, 'hexcode': /#[\da-f]{3,6}/i, - 'number': /\b\d+(?:\.\d+)?%?/, + 'color': [ + /\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i, + { + pattern: /\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i, + inside: { + 'unit': unit, + 'number': number, + 'function': /[\w-]+(?=\()/, + 'punctuation': /[(),]/ + } + } + ], + 'entity': /\\[\da-f]{1,8}/i, + 'unit': unit, 'boolean': /\b(?:true|false)\b/, 'operator': [ // We want non-word chars around "-" because it is // accepted in property names. - /~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.+|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/ + /~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/ ], + 'number': number, 'punctuation': /[{}()\[\];:,]/ }; diff --git a/components/prism-stylus.min.js b/components/prism-stylus.min.js index 002e32893d..7230fc8222 100644 --- a/components/prism-stylus.min.js +++ b/components/prism-stylus.min.js @@ -1 +1 @@ -!function(n){var t={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/url\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,number:/\b\d+(?:\.\d+)?%?/,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.+|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],punctuation:/[{}()\[\];:,]/};t.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:t}},t.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:t}},n.languages.stylus={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:t}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:t}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:t}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,greedy:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:t.interpolation}},rest:t}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:t.interpolation,punctuation:/[{},]/}},func:t.func,string:t.string,interpolation:t.interpolation,punctuation:/[{}()\[\];:.]/}}(Prism); \ No newline at end of file +!function(e){var n={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},r={pattern:/(^|[^\w.-]|)-?\d*\.?\d+/,lookbehind:!0},i={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/url\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:n,number:r,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:n,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:r,punctuation:/[{}()\[\];:,]/};i.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:i}},i.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:i}},e.languages.stylus={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:i}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:i}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:i}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,greedy:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:i.interpolation}},rest:i}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:i.interpolation,punctuation:/[{},]/}},func:i.func,string:i.string,interpolation:i.interpolation,punctuation:/[{}()\[\];:.]/}}(Prism); \ No newline at end of file diff --git a/tests/languages/stylus+pug/stylus_inclusion.test b/tests/languages/stylus+pug/stylus_inclusion.test index 3c7c8d2574..d154ab2e75 100644 --- a/tests/languages/stylus+pug/stylus_inclusion.test +++ b/tests/languages/stylus+pug/stylus_inclusion.test @@ -10,7 +10,7 @@ ["variable", "font-size"], ["operator", "="], ["number", "14"], - "px" + ["unit", "px"] ]] ]] ] diff --git a/tests/languages/stylus/func_feature.test b/tests/languages/stylus/func_feature.test index 7f2c346774..59ad2362c0 100644 --- a/tests/languages/stylus/func_feature.test +++ b/tests/languages/stylus/func_feature.test @@ -33,7 +33,7 @@ form input[type=button] ["function", "border-radius"], ["punctuation", "("], ["number", "5"], - "px", + ["unit", "px"], ["punctuation", ")"] ]], ["property-declaration", [ diff --git a/tests/languages/stylus/important_feature.test b/tests/languages/stylus/important_feature.test index 225c1e0539..44c9fdbe8f 100644 --- a/tests/languages/stylus/important_feature.test +++ b/tests/languages/stylus/important_feature.test @@ -7,7 +7,7 @@ color: red !important ["property-declaration", [ ["property", ["color"]], ["punctuation", ":"], - " red ", + ["color", "red"], ["important", "!important"] ]], ["atrule-declaration", [ diff --git a/tests/languages/stylus/number_feature.test b/tests/languages/stylus/number_feature.test index f3a0710903..61229b92ac 100644 --- a/tests/languages/stylus/number_feature.test +++ b/tests/languages/stylus/number_feature.test @@ -18,12 +18,14 @@ bar = 1.5% ["property-declaration", [ ["property", ["width"]], ["punctuation", ":"], - ["number", "23%"] + ["number", "23"], + ["unit", "%"] ]], ["variable-declaration", [ ["variable", "bar"], ["operator", "="], - ["number", "1.5%"] + ["number", "1.5"], + ["unit", "%"] ]] ] diff --git a/tests/languages/stylus/property-declaration_feature.test b/tests/languages/stylus/property-declaration_feature.test index ff42f035dd..cdf0aef31e 100644 --- a/tests/languages/stylus/property-declaration_feature.test +++ b/tests/languages/stylus/property-declaration_feature.test @@ -21,13 +21,13 @@ comment [ ["selector", ["div"]], ["property-declaration", [ - ["property", ["width"]], ["number", "40"], "px" + ["property", ["width"]], ["number", "40"], ["unit", "px"] ]], ["property-declaration", [ - ["property", ["color"]], ["punctuation", ":"], " red" + ["property", ["color"]], ["punctuation", ":"], ["color", "red"] ]], ["property-declaration", [ - ["property", ["background"]], ["punctuation", ":"], " blue", ["punctuation", ";"] + ["property", ["background"]], ["punctuation", ":"], ["color", "blue"], ["punctuation", ";"] ]], ["selector", ["div ", ["punctuation", "{"]]], ["property-declaration", [ diff --git a/tests/languages/stylus/selector_feature.test b/tests/languages/stylus/selector_feature.test index 1908c4bed7..3868dfcaa3 100644 --- a/tests/languages/stylus/selector_feature.test +++ b/tests/languages/stylus/selector_feature.test @@ -22,15 +22,15 @@ color red [ ["selector", ["div\r\nspan[foo=bar]"]], - ["property-declaration", [["property", ["color"]], " red"]], + ["property-declaration", [["property", ["color"]], ["color", "red"]]], ["selector", ["div input", ["punctuation", ","], "\r\ninput:nth-child(2n)"]], - ["property-declaration", [["property", ["color"]], " red"]], + ["property-declaration", [["property", ["color"]], ["color", "red"]]], ["selector", ["#foo"]], ["selector", [".bar::before"]], - ["property-declaration", [["property", ["color"]], " red"]], + ["property-declaration", [["property", ["color"]], ["color", "red"]]], ["selector", ["#foo"]], ["selector", [".bar ", ["punctuation", "{"]]], - ["property-declaration", [["property", ["color"]], " red"]], + ["property-declaration", [["property", ["color"]], ["color", "red"]]], ["punctuation", "}"], ["selector", [ ["interpolation", [ @@ -41,7 +41,7 @@ color red ]], ":hover" ]], - ["property-declaration", [["property", ["color"]], " red"]] + ["property-declaration", [["property", ["color"]], ["color", "red"]]] ] ---------------------------------------------------- From 2d162ff0ea17ddb494aea4f34dda84c60da6c752 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Thu, 7 May 2020 16:03:20 +0800 Subject: [PATCH 06/23] Stylus: remove extra `|` in `number` property and add relative tests. --- components/prism-stylus.js | 2 +- components/prism-stylus.min.js | 2 +- tests/languages/stylus/property-declaration_feature.test | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/prism-stylus.js b/components/prism-stylus.js index 7a732b7ea8..fb738429e1 100644 --- a/components/prism-stylus.js +++ b/components/prism-stylus.js @@ -5,7 +5,7 @@ }; // 123 -123 .123 -.123 12.3 -12.3 var number = { - pattern: /(^|[^\w.-]|)-?\d*\.?\d+/, + pattern: /(^|[^\w.-])-?\d*\.?\d+/, lookbehind: true }; diff --git a/components/prism-stylus.min.js b/components/prism-stylus.min.js index 7230fc8222..2c63c58159 100644 --- a/components/prism-stylus.min.js +++ b/components/prism-stylus.min.js @@ -1 +1 @@ -!function(e){var n={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},r={pattern:/(^|[^\w.-]|)-?\d*\.?\d+/,lookbehind:!0},i={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/url\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:n,number:r,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:n,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:r,punctuation:/[{}()\[\];:,]/};i.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:i}},i.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:i}},e.languages.stylus={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:i}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:i}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:i}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,greedy:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:i.interpolation}},rest:i}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:i.interpolation,punctuation:/[{},]/}},func:i.func,string:i.string,interpolation:i.interpolation,punctuation:/[{}()\[\];:.]/}}(Prism); \ No newline at end of file +!function(e){var n={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},r={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},i={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/url\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:n,number:r,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:n,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:r,punctuation:/[{}()\[\];:,]/};i.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:i}},i.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:i}},e.languages.stylus={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:i}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:i}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:i}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,greedy:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:i.interpolation}},rest:i}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:i.interpolation,punctuation:/[{},]/}},func:i.func,string:i.string,interpolation:i.interpolation,punctuation:/[{}()\[\];:.]/}}(Prism); \ No newline at end of file diff --git a/tests/languages/stylus/property-declaration_feature.test b/tests/languages/stylus/property-declaration_feature.test index cdf0aef31e..d4cd649639 100644 --- a/tests/languages/stylus/property-declaration_feature.test +++ b/tests/languages/stylus/property-declaration_feature.test @@ -2,6 +2,7 @@ div width 40px color: red background: blue; + animation-name test1, animation4 div { background-{foo}: bar; @@ -29,6 +30,8 @@ comment ["property-declaration", [ ["property", ["background"]], ["punctuation", ":"], ["color", "blue"], ["punctuation", ";"] ]], + ["property-declaration", [ + ["property", ["animation-name"]], " test1", ["punctuation", ","], " animation4"]], ["selector", ["div ", ["punctuation", "{"]]], ["property-declaration", [ ["property", [ From a37cd5efcf3cc3bd308d63f0aa1d6f6786c90fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Fri, 8 May 2020 02:59:48 +0800 Subject: [PATCH 07/23] Stylus: Put the `comment` token behind the `string` token and set the `greedy` property to `true` --- components/prism-stylus.js | 11 ++++++----- components/prism-stylus.min.js | 2 +- .../stylus/atrule-declaration_feature.test | 13 +++++++++++++ tests/languages/stylus/keyword_feature.test | 8 ++++++++ tests/languages/stylus/selector_feature.test | 7 ++++++- .../stylus/variable-declaration_feature.test | 7 +++++++ 6 files changed, 41 insertions(+), 7 deletions(-) diff --git a/components/prism-stylus.js b/components/prism-stylus.js index fb738429e1..18d014dbef 100644 --- a/components/prism-stylus.js +++ b/components/prism-stylus.js @@ -74,10 +74,6 @@ }; Prism.languages.stylus = { - 'comment': { - pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, - lookbehind: true - }, 'atrule-declaration': { pattern: /(^\s*)@.+/m, lookbehind: true, @@ -109,7 +105,6 @@ 'property-declaration': { pattern: /((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m, lookbehind: true, - greedy: true, inside: { 'property': { pattern: /^[^\s:]+/, @@ -131,12 +126,18 @@ lookbehind: true, inside: { 'interpolation': inside.interpolation, + 'comment': inside.comment, 'punctuation': /[{},]/ } }, 'func': inside.func, 'string': inside.string, + 'comment': { + pattern: /(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/, + lookbehind: true, + greedy: true + }, 'interpolation': inside.interpolation, 'punctuation': /[{}()\[\];:.]/ }; diff --git a/components/prism-stylus.min.js b/components/prism-stylus.min.js index 2c63c58159..f70528cf87 100644 --- a/components/prism-stylus.min.js +++ b/components/prism-stylus.min.js @@ -1 +1 @@ -!function(e){var n={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},r={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},i={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/url\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:n,number:r,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:n,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:r,punctuation:/[{}()\[\];:,]/};i.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:i}},i.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:i}},e.languages.stylus={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:i}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:i}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:i}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,greedy:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:i.interpolation}},rest:i}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:i.interpolation,punctuation:/[{},]/}},func:i.func,string:i.string,interpolation:i.interpolation,punctuation:/[{}()\[\];:.]/}}(Prism); \ No newline at end of file +!function(e){var n={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},r={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},i={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/url\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:if|else|for|return|unless)(?=\s+|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:n,number:r,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:n,boolean:/\b(?:true|false)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:r,punctuation:/[{}()\[\];:,]/};i.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^{|}$/,alias:"punctuation"},rest:i}},i.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:i}},e.languages.stylus={"atrule-declaration":{pattern:/(^\s*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:i}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:(?:\{[^}]*\}|.+)|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:i}},statement:{pattern:/(^[ \t]*)(?:if|else|for|return|unless)[ \t]+.+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:i}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)[^{\r\n]*(?:;|[^{\r\n,](?=$)(?!(?:\r?\n|\r)(?:\{|\2[ \t]+)))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:i.interpolation}},rest:i}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\))?|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t]+)))/m,lookbehind:!0,inside:{interpolation:i.interpolation,comment:i.comment,punctuation:/[{},]/}},func:i.func,string:i.string,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0,greedy:!0},interpolation:i.interpolation,punctuation:/[{}()\[\];:.]/}}(Prism); \ No newline at end of file diff --git a/tests/languages/stylus/atrule-declaration_feature.test b/tests/languages/stylus/atrule-declaration_feature.test index d0e6505d5f..156a553020 100644 --- a/tests/languages/stylus/atrule-declaration_feature.test +++ b/tests/languages/stylus/atrule-declaration_feature.test @@ -3,6 +3,8 @@ @font-face { @keyframes { @media (max-{foo}: bar) +@namespace url(http://www.w3.org/1999/xhtml) // comment +@namespace svg url(http://www.w3.org/2000/svg) // comment ---------------------------------------------------- @@ -23,6 +25,17 @@ ["punctuation", ":"], " bar", ["punctuation", ")"] + ]], + ["atrule-declaration", [ + ["atrule", "@namespace"], + ["url", "url(http://www.w3.org/1999/xhtml)"], + ["comment", "// comment"] + ]], + ["atrule-declaration", [ + ["atrule", "@namespace"], + " svg ", + ["url", "url(http://www.w3.org/2000/svg)"], + ["comment", "// comment"] ]] ] diff --git a/tests/languages/stylus/keyword_feature.test b/tests/languages/stylus/keyword_feature.test index 5182775191..f5ebb4f6f5 100644 --- a/tests/languages/stylus/keyword_feature.test +++ b/tests/languages/stylus/keyword_feature.test @@ -2,6 +2,7 @@ for i in 1..5 if a == 3 z-index: 1 unless @z-index; return pair[1] if pair[0] == key for pair in hash +if url == "http://example.com" // comment ---------------------------------------------------- @@ -36,6 +37,13 @@ return pair[1] if pair[0] == key for pair in hash ["operator", "=="], " key ", ["keyword", "for"], " pair ", ["operator", "in"], " hash" + ]], + ["statement", [ + ["keyword", "if"], + " url ", + ["operator", "=="], + ["string", "\"http://example.com\""], + ["comment", "// comment"] ]] ] diff --git a/tests/languages/stylus/selector_feature.test b/tests/languages/stylus/selector_feature.test index 3868dfcaa3..50912ea2f6 100644 --- a/tests/languages/stylus/selector_feature.test +++ b/tests/languages/stylus/selector_feature.test @@ -18,6 +18,9 @@ color red {foo} {bar}:hover color red +div // comment + display inline-block // comment + ---------------------------------------------------- [ @@ -41,7 +44,9 @@ color red ]], ":hover" ]], - ["property-declaration", [["property", ["color"]], ["color", "red"]]] + ["property-declaration", [["property", ["color"]], ["color", "red"]]], + ["selector", ["div ", ["comment", "// comment"]]], + ["property-declaration", [["property", ["display"]], " inline-block ", ["comment", "// comment"]]] ] ---------------------------------------------------- diff --git a/tests/languages/stylus/variable-declaration_feature.test b/tests/languages/stylus/variable-declaration_feature.test index 1d68f9dfe0..2e98e4fb0d 100644 --- a/tests/languages/stylus/variable-declaration_feature.test +++ b/tests/languages/stylus/variable-declaration_feature.test @@ -2,6 +2,7 @@ foo = 'bar' a = 4 bar-baz = 5 a += 8 +url = "http://example.com" // comment ---------------------------------------------------- @@ -25,6 +26,12 @@ a += 8 ["variable", "a"], ["operator", "+="], ["number", "8"] + ]], + ["variable-declaration", [ + ["variable", "url"], + ["operator", "="], + ["string", "\"http://example.com\""], + ["comment", "// comment"] ]] ] From 49a6edac011f03844300baeda8c439628a0f40df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Fri, 8 May 2020 12:24:10 +0800 Subject: [PATCH 08/23] CSS Extra: (1) rename `attr-name`, `attr-value` (2) change `pseudo-class` token (3) add `tag`, `selector-list`, `combinator` token --- components/prism-css-extras.js | 51 +++-- components/prism-css-extras.min.js | 2 +- .../css!+css-extras/number_feature.test | 2 +- .../selector_attribute_feature.test | 70 +++---- .../css!+css-extras/selector_feature.test | 21 ++- .../selector_n-th_feature.test | 176 ++++++++++-------- .../selector_pseudo-class_feature.test | 124 ++++++------ .../css!+css-extras/variable_feature.test | 2 +- 8 files changed, 245 insertions(+), 203 deletions(-) diff --git a/components/prism-css-extras.js b/components/prism-css-extras.js index 1b6ab8c027..81c21beff4 100644 --- a/components/prism-css-extras.js +++ b/components/prism-css-extras.js @@ -7,9 +7,32 @@ pattern: Prism.languages.css.selector, inside: selectorInside = { 'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/, - 'pseudo-class': /:[-\w]+/, + 'pseudo-class': { + pattern: /:[-\w]+((\([^\(]*\([^\)]*\)[^\)]*\))|(\(.*?\)))?/, + greedy: true, + inside: { + 'n-th': [ + { + pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/, + lookbehind: true, + inside: { + 'number': /[\dn]+/, + 'operator': /[+-]/ + } + }, + { + pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i, + lookbehind: true + } + ], + 'punctuation': /[()]/, + } + }, 'class': /\.[-:.\w]+/, 'id': /#[-:.\w]+/, + 'tag': /[-\w]+/, + 'selector-list': /,/, + 'combinator': />|\+|~|(\|\|)]/, 'attribute': { pattern: RegExp('\\[(?:[^[\\]"\']|' + string.source + ')*\\]'), greedy: true, @@ -27,11 +50,11 @@ 'punctuation': /\|$/ } }, - 'attribute': { + 'attr-name': { pattern: /^(\s*)[-\w\xA0-\uFFFF]+/, lookbehind: true }, - 'value': [ + 'attr-value': [ string, { pattern: /(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/, @@ -41,24 +64,16 @@ 'operator': /[|~*^$]?=/ } }, - 'n-th': [ - { - pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/, - lookbehind: true, - inside: { - 'number': /[\dn]+/, - 'operator': /[+-]/ - } - }, - { - pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i, - lookbehind: true - } - ], - 'punctuation': /[()]/ } }; + // TODO: support 'pseudo-class' and 'tag' token + for (var token in selectorInside) { + if (token !== 'pseudo-class' && token !== 'tag') { + selectorInside['pseudo-class'].inside[token] = selectorInside[token]; + } + } + Prism.languages.css['atrule'].inside['selector-function-argument'].inside = selectorInside; Prism.languages.insertBefore('css', 'property', { diff --git a/components/prism-css-extras.min.js b/components/prism-css-extras.min.js index 00ed486bf1..cccd1443b6 100644 --- a/components/prism-css-extras.min.js +++ b/components/prism-css-extras.min.js @@ -1 +1 @@ -!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-:.\w]+/,id:/#[-:.\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},attribute:{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},value:[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],punctuation:/[()]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var r={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},i={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:i,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:i})}(Prism); \ No newline at end of file +!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;for(var r in e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":{pattern:/:[-\w]+((\([^\(]*\([^\)]*\)[^\)]*\))|(\(.*?\)))?/,greedy:!0,inside:{"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],punctuation:/[()]/}},class:/\.[-:.\w]+/,id:/#[-:.\w]+/,tag:/[-\w]+/,"selector-list":/,/,combinator:/>|\+|~|(\|\|)]/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}}}},a)"pseudo-class"!==r&&"tag"!==r&&(a["pseudo-class"].inside[r]=a[r]);e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var i={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},t={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:i,number:t,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:i,number:t})}(Prism); \ No newline at end of file diff --git a/tests/languages/css!+css-extras/number_feature.test b/tests/languages/css!+css-extras/number_feature.test index 1ac34b99ca..6e71d4b5ae 100644 --- a/tests/languages/css!+css-extras/number_feature.test +++ b/tests/languages/css!+css-extras/number_feature.test @@ -24,7 +24,7 @@ foo { ["comment", "/* complex example */"], ["selector", [ - "foo" + ["tag", "foo"] ]], ["punctuation", "{"], diff --git a/tests/languages/css!+css-extras/selector_attribute_feature.test b/tests/languages/css!+css-extras/selector_attribute_feature.test index 25d1259f2b..fe2587b7a6 100644 --- a/tests/languages/css!+css-extras/selector_attribute_feature.test +++ b/tests/languages/css!+css-extras/selector_attribute_feature.test @@ -28,7 +28,7 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["punctuation", "]"] ]] ]], @@ -38,9 +38,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "="], - ["value", "val"], + ["attr-value", "val"], ["punctuation", "]"] ]] ]], @@ -50,9 +50,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "="], - ["value", "\"val\""], + ["attr-value", "\"val\""], ["punctuation", "]"] ]] ]], @@ -62,9 +62,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "="], - ["value", "'val'"], + ["attr-value", "'val'"], ["punctuation", "]"] ]] ]], @@ -74,9 +74,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "|="], - ["value", "val"], + ["attr-value", "val"], ["punctuation", "]"] ]] ]], @@ -86,9 +86,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "~="], - ["value", "val"], + ["attr-value", "val"], ["punctuation", "]"] ]] ]], @@ -98,9 +98,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "|="], - ["value", "val"], + ["attr-value", "val"], ["punctuation", "]"] ]] ]], @@ -110,9 +110,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "^="], - ["value", "val"], + ["attr-value", "val"], ["punctuation", "]"] ]] ]], @@ -122,9 +122,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "$="], - ["value", "val"], + ["attr-value", "val"], ["punctuation", "]"] ]] ]], @@ -134,9 +134,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "*="], - ["value", "val"], + ["attr-value", "val"], ["punctuation", "]"] ]] ]], @@ -150,7 +150,7 @@ "foo", ["punctuation", "|"] ]], - ["attribute", "attr"], + ["attr-name", "attr"], ["punctuation", "]"] ]], ["attribute", [ @@ -159,7 +159,7 @@ "*", ["punctuation", "|"] ]], - ["attribute", "attr"], + ["attr-name", "attr"], ["punctuation", "]"] ]], ["attribute", [ @@ -167,7 +167,7 @@ ["namespace", [ ["punctuation", "|"] ]], - ["attribute", "attr"], + ["attr-name", "attr"], ["punctuation", "]"] ]] ]], @@ -181,9 +181,9 @@ "foo", ["punctuation", "|"] ]], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "|="], - ["value", "val"], + ["attr-value", "val"], ["punctuation", "]"] ]] ]], @@ -193,9 +193,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "="], - ["value", "val"], + ["attr-value", "val"], ["case-sensitivity", "i"], ["punctuation", "]"] ]] @@ -206,9 +206,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "="], - ["value", "\"val\""], + ["attr-value", "\"val\""], ["case-sensitivity", "S"], ["punctuation", "]"] ]] @@ -219,7 +219,7 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["punctuation", "]"] ]] ]], @@ -229,9 +229,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "="], - ["value", "val"], + ["attr-value", "val"], ["punctuation", "]"] ]] ]], @@ -241,9 +241,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "="], - ["value", "val"], + ["attr-value", "val"], ["case-sensitivity", "i"], ["punctuation", "]"] ]] @@ -254,9 +254,9 @@ ["selector", [ ["attribute", [ ["punctuation", "["], - ["attribute", "attr"], + ["attr-name", "attr"], ["operator", "="], - ["value", "\"i#m :not(a.class)\""], + ["attr-value", "\"i#m :not(a.class)\""], ["punctuation", "]"] ]] ]], diff --git a/tests/languages/css!+css-extras/selector_feature.test b/tests/languages/css!+css-extras/selector_feature.test index d42ec7faa6..e81057427a 100644 --- a/tests/languages/css!+css-extras/selector_feature.test +++ b/tests/languages/css!+css-extras/selector_feature.test @@ -7,35 +7,44 @@ foo#bar { #foo > .bar:hover:after { +span, +div { + ---------------------------------------------------- [ ["selector", [ - "foo", + ["tag", "foo"], ["pseudo-element", ":after"] ]], ["punctuation", "{"], ["selector", [ - "foo", + ["tag", "foo"], ["pseudo-element", "::first-letter"] ]], ["punctuation", "{"], ["selector", [ - "foo", + ["tag", "foo"], ["class", ".bar"] ]], ["punctuation", "{"], ["selector", [ - "foo", + ["tag", "foo"], ["id", "#bar"] ]], ["punctuation", "{"], ["selector", [ ["id", "#foo"], - " > ", + ["combinator", ">"], ["class", ".bar"], - ["pseudo-class", ":hover"], + ["pseudo-class", [":hover"]], ["pseudo-element", ":after"] + ]], ["punctuation", "{"], + + ["selector", [ + ["tag", "span"], + ["selector-list", ","], + ["tag", "div"] ]], ["punctuation", "{"] ] diff --git a/tests/languages/css!+css-extras/selector_n-th_feature.test b/tests/languages/css!+css-extras/selector_n-th_feature.test index 64e5aa7bb5..0c27de2ef1 100644 --- a/tests/languages/css!+css-extras/selector_n-th_feature.test +++ b/tests/languages/css!+css-extras/selector_n-th_feature.test @@ -1,82 +1,94 @@ -:nth-child(2n+1) {} -:nth-child(+2n - 1) {} -:nth-child(2n) {} -:nth-child(+5) {} -:nth-child(even) {} -:nth-child(odd) {} - ----------------------------------------------------- - -[ - ["selector", [ - ["pseudo-class", ":nth-child"], - ["punctuation", "("], - ["n-th", [ - ["number", "2n"], - ["operator", "+"], - ["number", "1"] - ]], - ["punctuation", ")"] - ]], - ["punctuation", "{"], - ["punctuation", "}"], - - ["selector", [ - ["pseudo-class", ":nth-child"], - ["punctuation", "("], - ["n-th", [ - ["operator", "+"], - ["number", "2n"], - ["operator", "-"], - ["number", "1"] - ]], - ["punctuation", ")"] - ]], - ["punctuation", "{"], - ["punctuation", "}"], - - ["selector", [ - ["pseudo-class", ":nth-child"], - ["punctuation", "("], - ["n-th", [ - ["number", "2n"] - ]], - ["punctuation", ")"] - ]], - ["punctuation", "{"], - ["punctuation", "}"], - - ["selector", [ - ["pseudo-class", ":nth-child"], - ["punctuation", "("], - ["n-th", [ - ["operator", "+"], - ["number", "5"] - ]], - ["punctuation", ")"] - ]], - ["punctuation", "{"], - ["punctuation", "}"], - - ["selector", [ - ["pseudo-class", ":nth-child"], - ["punctuation", "("], - ["n-th", "even"], - ["punctuation", ")"] - ]], - ["punctuation", "{"], - ["punctuation", "}"], - - ["selector", [ - ["pseudo-class", ":nth-child"], - ["punctuation", "("], - ["n-th", "odd"], - ["punctuation", ")"] - ]], - ["punctuation", "{"], - ["punctuation", "}"] -] - ----------------------------------------------------- - -Checks for n-th expressions. +:nth-child(2n+1) {} +:nth-child(+2n - 1) {} +:nth-child(2n) {} +:nth-child(+5) {} +:nth-child(even) {} +:nth-child(odd) {} + +---------------------------------------------------- + +[ + ["selector", [ + ["pseudo-class", [ + ":nth-child", + ["punctuation", "("], + ["n-th", [ + ["number", "2n"], + ["operator", "+"], + ["number", "1"] + ]], + ["punctuation", ")"] + ] + ]]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["selector", [ + ["pseudo-class", [ + ":nth-child", + ["punctuation", "("], + ["n-th", [ + ["operator", "+"], + ["number", "2n"], + ["operator", "-"], + ["number", "1"] + ]], + ["punctuation", ")"] + ] + ]]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["selector", [ + ["pseudo-class", [ + ":nth-child", + ["punctuation", "("], + ["n-th", [ + ["number", "2n"] + ]], + ["punctuation", ")"] + ] + ]]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["selector", [ + ["pseudo-class", [ + ":nth-child", + ["punctuation", "("], + ["n-th", [ + ["operator", "+"], + ["number", "5"] + ]], + ["punctuation", ")"] + ] + ]]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["selector", [ + ["pseudo-class", [ + ":nth-child", + ["punctuation", "("], + ["n-th", "even"], + ["punctuation", ")"] + ] + ]]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["selector", [ + ["pseudo-class", [ + ":nth-child", + ["punctuation", "("], + ["n-th", "odd"], + ["punctuation", ")"] + ] + ]]], + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for n-th expressions. diff --git a/tests/languages/css!+css-extras/selector_pseudo-class_feature.test b/tests/languages/css!+css-extras/selector_pseudo-class_feature.test index e4dfe15183..6fd260cab6 100644 --- a/tests/languages/css!+css-extras/selector_pseudo-class_feature.test +++ b/tests/languages/css!+css-extras/selector_pseudo-class_feature.test @@ -1,59 +1,65 @@ -foo:hover {} - -:lang(en) {} - -.bar:not(baz:hover):not(.foo) {} - -:where(p:not(.class)) {} - ----------------------------------------------------- - -[ - ["selector", [ - "foo", - ["pseudo-class", ":hover"] - ]], - ["punctuation", "{"], - ["punctuation", "}"], - - ["selector", [ - ["pseudo-class", ":lang"], - ["punctuation", "("], - "en", - ["punctuation", ")"] - ]], - ["punctuation", "{"], - ["punctuation", "}"], - - ["selector", [ - ["class", ".bar"], - ["pseudo-class", ":not"], - ["punctuation", "("], - "baz", - ["pseudo-class", ":hover"], - ["punctuation", ")"], - ["pseudo-class", ":not"], - ["punctuation", "("], - ["class", ".foo"], - ["punctuation", ")"] - ]], - ["punctuation", "{"], - ["punctuation", "}"], - - ["selector", [ - ["pseudo-class", ":where"], - ["punctuation", "("], - "p", - ["pseudo-class", ":not"], - ["punctuation", "("], - ["class", ".class"], - ["punctuation", ")"], - ["punctuation", ")"] - ]], - ["punctuation", "{"], - ["punctuation", "}"] -] - ----------------------------------------------------- - -Checks for pseudo-classes inside selectors. +foo:hover {} + +:lang(en) {} + +.bar:not(baz:hover):not(.foo) {} + +:where(p:not(.class)) {} + +---------------------------------------------------- + +[ + ["selector", [ + ["tag", "foo"], + ["pseudo-class", [":hover"]] + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["selector", [ + ["pseudo-class", [ + ":lang", + ["punctuation", "("], + "en", + ["punctuation", ")"] + ] + ]]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["selector", [ + ["class", ".bar"], + ["pseudo-class", [ + ":not", + ["punctuation", "("], + "baz:hover", + ["punctuation", ")"] + ]], + ["pseudo-class", [ + ":not", + ["punctuation", "("], + ["class", ".foo"], + ["punctuation", ")"] + ] + ]]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["selector", [ + ["pseudo-class", [ + ":where", + ["punctuation", "("], + "p:not", + ["punctuation", "("], + ["class", ".class"], + ["punctuation", ")"], + ["punctuation", ")"] + ] + ]]], + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for pseudo-classes inside selectors. diff --git a/tests/languages/css!+css-extras/variable_feature.test b/tests/languages/css!+css-extras/variable_feature.test index 657688fcd1..5f673573de 100644 --- a/tests/languages/css!+css-extras/variable_feature.test +++ b/tests/languages/css!+css-extras/variable_feature.test @@ -10,7 +10,7 @@ calc(100% - var(--margin-size) * 2) ---------------------------------------------------- [ - ["selector", ["element"]], + ["selector", [["tag", "element"]]], ["punctuation", "{"], ["variable", "--foo"], ["punctuation", ":"], From fb011be706e23f9c169e3a8cfee7c71d9106d1fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Fri, 8 May 2020 13:16:42 +0800 Subject: [PATCH 09/23] CSS Extra: add `?:` in regex to pass the test. --- components/prism-css-extras.js | 4 ++-- components/prism-css-extras.min.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/prism-css-extras.js b/components/prism-css-extras.js index 81c21beff4..6c035d0814 100644 --- a/components/prism-css-extras.js +++ b/components/prism-css-extras.js @@ -8,7 +8,7 @@ inside: selectorInside = { 'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/, 'pseudo-class': { - pattern: /:[-\w]+((\([^\(]*\([^\)]*\)[^\)]*\))|(\(.*?\)))?/, + pattern: /:[-\w]+(?:(?:\([^\(]*\([^\)]*\)[^\)]*\))|(?:\(.*?\)))?/, greedy: true, inside: { 'n-th': [ @@ -32,7 +32,7 @@ 'id': /#[-:.\w]+/, 'tag': /[-\w]+/, 'selector-list': /,/, - 'combinator': />|\+|~|(\|\|)]/, + 'combinator': />|\+|~|(?:\|\|)]/, 'attribute': { pattern: RegExp('\\[(?:[^[\\]"\']|' + string.source + ')*\\]'), greedy: true, diff --git a/components/prism-css-extras.min.js b/components/prism-css-extras.min.js index cccd1443b6..0df44c33a9 100644 --- a/components/prism-css-extras.min.js +++ b/components/prism-css-extras.min.js @@ -1 +1 @@ -!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;for(var r in e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":{pattern:/:[-\w]+((\([^\(]*\([^\)]*\)[^\)]*\))|(\(.*?\)))?/,greedy:!0,inside:{"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],punctuation:/[()]/}},class:/\.[-:.\w]+/,id:/#[-:.\w]+/,tag:/[-\w]+/,"selector-list":/,/,combinator:/>|\+|~|(\|\|)]/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}}}},a)"pseudo-class"!==r&&"tag"!==r&&(a["pseudo-class"].inside[r]=a[r]);e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var i={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},t={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:i,number:t,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:i,number:t})}(Prism); \ No newline at end of file +!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;for(var r in e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":{pattern:/:[-\w]+(?:(?:\([^\(]*\([^\)]*\)[^\)]*\))|(?:\(.*?\)))?/,greedy:!0,inside:{"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],punctuation:/[()]/}},class:/\.[-:.\w]+/,id:/#[-:.\w]+/,tag:/[-\w]+/,"selector-list":/,/,combinator:/>|\+|~|(?:\|\|)]/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}}}},a)"pseudo-class"!==r&&"tag"!==r&&(a["pseudo-class"].inside[r]=a[r]);e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var i={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},t={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:i,number:t,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:i,number:t})}(Prism); \ No newline at end of file From 4848fda7136818e3a2b73c7b2369302bdd358dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Fri, 8 May 2020 20:43:34 +0800 Subject: [PATCH 10/23] CSS Extra: restore `pseudo-class` tokenize, put the `combinator` and `tag` behind the `n-th` token to avoid problem. --- components/prism-css-extras.js | 49 ++++----- components/prism-css-extras.min.js | 2 +- .../css!+css-extras/selector_feature.test | 4 +- .../selector_n-th_feature.test | 100 ++++++++---------- .../selector_pseudo-class_feature.test | 56 +++++----- 5 files changed, 90 insertions(+), 121 deletions(-) diff --git a/components/prism-css-extras.js b/components/prism-css-extras.js index 6c035d0814..16998b56a7 100644 --- a/components/prism-css-extras.js +++ b/components/prism-css-extras.js @@ -7,32 +7,9 @@ pattern: Prism.languages.css.selector, inside: selectorInside = { 'pseudo-element': /:(?:after|before|first-letter|first-line|selection)|::[-\w]+/, - 'pseudo-class': { - pattern: /:[-\w]+(?:(?:\([^\(]*\([^\)]*\)[^\)]*\))|(?:\(.*?\)))?/, - greedy: true, - inside: { - 'n-th': [ - { - pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/, - lookbehind: true, - inside: { - 'number': /[\dn]+/, - 'operator': /[+-]/ - } - }, - { - pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i, - lookbehind: true - } - ], - 'punctuation': /[()]/, - } - }, + 'pseudo-class': /:[-\w]+/, 'class': /\.[-:.\w]+/, 'id': /#[-:.\w]+/, - 'tag': /[-\w]+/, - 'selector-list': /,/, - 'combinator': />|\+|~|(?:\|\|)]/, 'attribute': { pattern: RegExp('\\[(?:[^[\\]"\']|' + string.source + ')*\\]'), greedy: true, @@ -64,16 +41,26 @@ 'operator': /[|~*^$]?=/ } }, + 'n-th': [ + { + pattern: /(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/, + lookbehind: true, + inside: { + 'number': /[\dn]+/, + 'operator': /[+-]/ + } + }, + { + pattern: /(\(\s*)(?:even|odd)(?=\s*\))/i, + lookbehind: true + } + ], + 'combinator': />|\+|~|(?:\|\|)]/, + 'tag': /[a-zA-Z][-\w]*/, + 'punctuation': /[(),]/, } }; - // TODO: support 'pseudo-class' and 'tag' token - for (var token in selectorInside) { - if (token !== 'pseudo-class' && token !== 'tag') { - selectorInside['pseudo-class'].inside[token] = selectorInside[token]; - } - } - Prism.languages.css['atrule'].inside['selector-function-argument'].inside = selectorInside; Prism.languages.insertBefore('css', 'property', { diff --git a/components/prism-css-extras.min.js b/components/prism-css-extras.min.js index 0df44c33a9..eec4c1bacb 100644 --- a/components/prism-css-extras.min.js +++ b/components/prism-css-extras.min.js @@ -1 +1 @@ -!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;for(var r in e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":{pattern:/:[-\w]+(?:(?:\([^\(]*\([^\)]*\)[^\)]*\))|(?:\(.*?\)))?/,greedy:!0,inside:{"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],punctuation:/[()]/}},class:/\.[-:.\w]+/,id:/#[-:.\w]+/,tag:/[-\w]+/,"selector-list":/,/,combinator:/>|\+|~|(?:\|\|)]/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}}}},a)"pseudo-class"!==r&&"tag"!==r&&(a["pseudo-class"].inside[r]=a[r]);e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var i={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},t={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:i,number:t,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:i,number:t})}(Prism); \ No newline at end of file +!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-:.\w]+/,id:/#[-:.\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|(?:\|\|)]/,tag:/[a-zA-Z][-\w]*/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var r={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},i={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:i,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:i})}(Prism); \ No newline at end of file diff --git a/tests/languages/css!+css-extras/selector_feature.test b/tests/languages/css!+css-extras/selector_feature.test index e81057427a..c55065717d 100644 --- a/tests/languages/css!+css-extras/selector_feature.test +++ b/tests/languages/css!+css-extras/selector_feature.test @@ -37,13 +37,13 @@ div { ["id", "#foo"], ["combinator", ">"], ["class", ".bar"], - ["pseudo-class", [":hover"]], + ["pseudo-class", ":hover"], ["pseudo-element", ":after"] ]], ["punctuation", "{"], ["selector", [ ["tag", "span"], - ["selector-list", ","], + ["punctuation", ","], ["tag", "div"] ]], ["punctuation", "{"] ] diff --git a/tests/languages/css!+css-extras/selector_n-th_feature.test b/tests/languages/css!+css-extras/selector_n-th_feature.test index 0c27de2ef1..0b7bcb8e9a 100644 --- a/tests/languages/css!+css-extras/selector_n-th_feature.test +++ b/tests/languages/css!+css-extras/selector_n-th_feature.test @@ -9,82 +9,70 @@ [ ["selector", [ - ["pseudo-class", [ - ":nth-child", - ["punctuation", "("], - ["n-th", [ - ["number", "2n"], - ["operator", "+"], - ["number", "1"] - ]], - ["punctuation", ")"] - ] - ]]], - ["punctuation", "{"], - ["punctuation", "}"], - - ["selector", [ - ["pseudo-class", [ - ":nth-child", - ["punctuation", "("], + ["pseudo-class", ":nth-child"], + ["punctuation", "("], ["n-th", [ - ["operator", "+"], ["number", "2n"], - ["operator", "-"], + ["operator", "+"], ["number", "1"] ]], - ["punctuation", ")"] - ] - ]]], + ["punctuation", ")"] + ]], ["punctuation", "{"], ["punctuation", "}"], ["selector", [ - ["pseudo-class", [ - ":nth-child", - ["punctuation", "("], - ["n-th", [ - ["number", "2n"] - ]], - ["punctuation", ")"] - ] - ]]], + ["pseudo-class", ":nth-child"], + ["punctuation", "("], + ["n-th", [ + ["operator", "+"], + ["number", "2n"], + ["operator", "-"], + ["number", "1"] + ]], + ["punctuation", ")"] + ]], ["punctuation", "{"], ["punctuation", "}"], ["selector", [ - ["pseudo-class", [ - ":nth-child", - ["punctuation", "("], - ["n-th", [ - ["operator", "+"], - ["number", "5"] - ]], - ["punctuation", ")"] - ] - ]]], + ["pseudo-class", ":nth-child"], + ["punctuation", "("], + ["n-th", [ + ["number", "2n"] + ]], + ["punctuation", ")"] + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["selector", [ + ["pseudo-class", ":nth-child"], + ["punctuation", "("], + ["n-th", [ + ["operator", "+"], + ["number", "5"] + ]], + ["punctuation", ")"] + ]], ["punctuation", "{"], ["punctuation", "}"], ["selector", [ - ["pseudo-class", [ - ":nth-child", - ["punctuation", "("], - ["n-th", "even"], - ["punctuation", ")"] - ] - ]]], + ["pseudo-class", ":nth-child"], + ["punctuation", "("], + ["n-th", "even"], + ["punctuation", ")"] + ]], ["punctuation", "{"], ["punctuation", "}"], ["selector", [ - ["pseudo-class", [ - ":nth-child", - ["punctuation", "("], - ["n-th", "odd"], - ["punctuation", ")"] - ] - ]]], + ["pseudo-class", ":nth-child"], + ["punctuation", "("], + ["n-th", "odd"], + ["punctuation", ")"] + ]], ["punctuation", "{"], ["punctuation", "}"] ] diff --git a/tests/languages/css!+css-extras/selector_pseudo-class_feature.test b/tests/languages/css!+css-extras/selector_pseudo-class_feature.test index 6fd260cab6..92898c50ce 100644 --- a/tests/languages/css!+css-extras/selector_pseudo-class_feature.test +++ b/tests/languages/css!+css-extras/selector_pseudo-class_feature.test @@ -11,51 +11,45 @@ foo:hover {} [ ["selector", [ ["tag", "foo"], - ["pseudo-class", [":hover"]] + ["pseudo-class", ":hover"] ]], ["punctuation", "{"], ["punctuation", "}"], ["selector", [ - ["pseudo-class", [ - ":lang", - ["punctuation", "("], - "en", - ["punctuation", ")"] - ] - ]]], + ["pseudo-class", ":lang"], + ["punctuation", "("], + ["tag", "en"], + ["punctuation", ")"] + ]], ["punctuation", "{"], ["punctuation", "}"], ["selector", [ ["class", ".bar"], - ["pseudo-class", [ - ":not", - ["punctuation", "("], - "baz:hover", - ["punctuation", ")"] - ]], - ["pseudo-class", [ - ":not", - ["punctuation", "("], - ["class", ".foo"], - ["punctuation", ")"] - ] - ]]], + ["pseudo-class", ":not"], + ["punctuation", "("], + ["tag", "baz"], + ["pseudo-class", ":hover"], + ["punctuation", ")"], + ["pseudo-class", ":not"], + ["punctuation", "("], + ["class", ".foo"], + ["punctuation", ")"] + ]], ["punctuation", "{"], ["punctuation", "}"], ["selector", [ - ["pseudo-class", [ - ":where", - ["punctuation", "("], - "p:not", - ["punctuation", "("], - ["class", ".class"], - ["punctuation", ")"], - ["punctuation", ")"] - ] - ]]], + ["pseudo-class", ":where"], + ["punctuation", "("], + ["tag", "p"], + ["pseudo-class", ":not"], + ["punctuation", "("], + ["class", ".class"], + ["punctuation", ")"], + ["punctuation", ")"] + ]], ["punctuation", "{"], ["punctuation", "}"] ] From c500ca3474f1c8bbbf12f13e35978660f51ef523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Fri, 8 May 2020 21:47:49 +0800 Subject: [PATCH 11/23] CSS Extra: rewrite the `combinator` regex and add relative tests to test every character. --- components/prism-css-extras.js | 2 +- components/prism-css-extras.min.js | 2 +- .../css!+css-extras/selector_feature.test | 23 +++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/components/prism-css-extras.js b/components/prism-css-extras.js index 16998b56a7..571d6cfaa5 100644 --- a/components/prism-css-extras.js +++ b/components/prism-css-extras.js @@ -55,7 +55,7 @@ lookbehind: true } ], - 'combinator': />|\+|~|(?:\|\|)]/, + 'combinator': />|\+|~|\|\|/, 'tag': /[a-zA-Z][-\w]*/, 'punctuation': /[(),]/, } diff --git a/components/prism-css-extras.min.js b/components/prism-css-extras.min.js index eec4c1bacb..eebf83c1a4 100644 --- a/components/prism-css-extras.min.js +++ b/components/prism-css-extras.min.js @@ -1 +1 @@ -!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-:.\w]+/,id:/#[-:.\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|(?:\|\|)]/,tag:/[a-zA-Z][-\w]*/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var r={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},i={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:i,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:i})}(Prism); \ No newline at end of file +!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-:.\w]+/,id:/#[-:.\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,tag:/[a-zA-Z][-\w]*/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var r={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},i={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:i,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:i})}(Prism); \ No newline at end of file diff --git a/tests/languages/css!+css-extras/selector_feature.test b/tests/languages/css!+css-extras/selector_feature.test index c55065717d..f46ca4cef5 100644 --- a/tests/languages/css!+css-extras/selector_feature.test +++ b/tests/languages/css!+css-extras/selector_feature.test @@ -10,6 +10,11 @@ foo#bar { span, div { +div > p, +.css-li ~ .css-li, +.previous-selector + .selector, +.selected || td { + ---------------------------------------------------- [ @@ -45,6 +50,24 @@ div { ["tag", "span"], ["punctuation", ","], ["tag", "div"] + ]], ["punctuation", "{"], + + ["selector", [ + ["tag", "div"], + ["combinator", ">"], + ["tag", "p"], + ["punctuation", ","], + ["class", ".css-li"], + ["combinator", "~"], + ["class", ".css-li"], + ["punctuation", ","], + ["class", ".previous-selector"], + ["combinator", "+"], + ["class", ".selector"], + ["punctuation", ","], + ["class", ".selected"], + ["combinator", "||"], + ["tag", "td"] ]], ["punctuation", "{"] ] From 61920bc49e42844fdc2e9698db1c72bdb1277721 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Sat, 9 May 2020 01:30:13 +0800 Subject: [PATCH 12/23] CSS Extra: remove `tag` token but left comment describing this history --- components/prism-css-extras.js | 6 +++++- components/prism-css-extras.min.js | 2 +- .../css!+css-extras/number_feature.test | 2 +- .../css!+css-extras/selector_feature.test | 18 +++++++++--------- .../selector_pseudo-class_feature.test | 8 ++++---- .../css!+css-extras/variable_feature.test | 2 +- 6 files changed, 21 insertions(+), 17 deletions(-) diff --git a/components/prism-css-extras.js b/components/prism-css-extras.js index 571d6cfaa5..f62c47bbd2 100644 --- a/components/prism-css-extras.js +++ b/components/prism-css-extras.js @@ -56,7 +56,11 @@ } ], 'combinator': />|\+|~|\|\|/, - 'tag': /[a-zA-Z][-\w]*/, + + // the `tag` token has been existed and removed. + // because we can't find a perfect tokenize to match it. + // if you want to add it, please read https://github.com/PrismJS/prism/pull/2373 first. + 'punctuation': /[(),]/, } }; diff --git a/components/prism-css-extras.min.js b/components/prism-css-extras.min.js index eebf83c1a4..81ee713413 100644 --- a/components/prism-css-extras.min.js +++ b/components/prism-css-extras.min.js @@ -1 +1 @@ -!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-:.\w]+/,id:/#[-:.\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,tag:/[a-zA-Z][-\w]*/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var r={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},i={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:i,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:i})}(Prism); \ No newline at end of file +!function(e){var a,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector,inside:a={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-:.\w]+/,id:/#[-:.\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)[-*\w\xA0-\uFFFF]*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)[-\w\xA0-\uFFFF]+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)[-\w\xA0-\uFFFF]+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=a,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*/i,lookbehind:!0}});var r={pattern:/(\d)(?:%|[a-z]+)/,lookbehind:!0},i={pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#(?:[\da-f]{1,2}){3,4}\b/i,alias:"color"},color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:rgb|hsl)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:rgb|hsl)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:i,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:i})}(Prism); \ No newline at end of file diff --git a/tests/languages/css!+css-extras/number_feature.test b/tests/languages/css!+css-extras/number_feature.test index 6e71d4b5ae..1ac34b99ca 100644 --- a/tests/languages/css!+css-extras/number_feature.test +++ b/tests/languages/css!+css-extras/number_feature.test @@ -24,7 +24,7 @@ foo { ["comment", "/* complex example */"], ["selector", [ - ["tag", "foo"] + "foo" ]], ["punctuation", "{"], diff --git a/tests/languages/css!+css-extras/selector_feature.test b/tests/languages/css!+css-extras/selector_feature.test index f46ca4cef5..ddd6961403 100644 --- a/tests/languages/css!+css-extras/selector_feature.test +++ b/tests/languages/css!+css-extras/selector_feature.test @@ -19,22 +19,22 @@ div > p, [ ["selector", [ - ["tag", "foo"], + "foo", ["pseudo-element", ":after"] ]], ["punctuation", "{"], ["selector", [ - ["tag", "foo"], + "foo", ["pseudo-element", "::first-letter"] ]], ["punctuation", "{"], ["selector", [ - ["tag", "foo"], + "foo", ["class", ".bar"] ]], ["punctuation", "{"], ["selector", [ - ["tag", "foo"], + "foo", ["id", "#bar"] ]], ["punctuation", "{"], @@ -47,15 +47,15 @@ div > p, ]], ["punctuation", "{"], ["selector", [ - ["tag", "span"], + "span", ["punctuation", ","], - ["tag", "div"] + "\r\ndiv" ]], ["punctuation", "{"], ["selector", [ - ["tag", "div"], + "div ", ["combinator", ">"], - ["tag", "p"], + " p", ["punctuation", ","], ["class", ".css-li"], ["combinator", "~"], @@ -67,7 +67,7 @@ div > p, ["punctuation", ","], ["class", ".selected"], ["combinator", "||"], - ["tag", "td"] + " td" ]], ["punctuation", "{"] ] diff --git a/tests/languages/css!+css-extras/selector_pseudo-class_feature.test b/tests/languages/css!+css-extras/selector_pseudo-class_feature.test index 92898c50ce..bf2cea6217 100644 --- a/tests/languages/css!+css-extras/selector_pseudo-class_feature.test +++ b/tests/languages/css!+css-extras/selector_pseudo-class_feature.test @@ -10,7 +10,7 @@ foo:hover {} [ ["selector", [ - ["tag", "foo"], + "foo", ["pseudo-class", ":hover"] ]], ["punctuation", "{"], @@ -19,7 +19,7 @@ foo:hover {} ["selector", [ ["pseudo-class", ":lang"], ["punctuation", "("], - ["tag", "en"], + "en", ["punctuation", ")"] ]], ["punctuation", "{"], @@ -29,7 +29,7 @@ foo:hover {} ["class", ".bar"], ["pseudo-class", ":not"], ["punctuation", "("], - ["tag", "baz"], + "baz", ["pseudo-class", ":hover"], ["punctuation", ")"], ["pseudo-class", ":not"], @@ -43,7 +43,7 @@ foo:hover {} ["selector", [ ["pseudo-class", ":where"], ["punctuation", "("], - ["tag", "p"], + "p", ["pseudo-class", ":not"], ["punctuation", "("], ["class", ".class"], diff --git a/tests/languages/css!+css-extras/variable_feature.test b/tests/languages/css!+css-extras/variable_feature.test index 5f673573de..657688fcd1 100644 --- a/tests/languages/css!+css-extras/variable_feature.test +++ b/tests/languages/css!+css-extras/variable_feature.test @@ -10,7 +10,7 @@ calc(100% - var(--margin-size) * 2) ---------------------------------------------------- [ - ["selector", [["tag", "element"]]], + ["selector", ["element"]], ["punctuation", "{"], ["variable", "--foo"], ["punctuation", ":"], From 7873e93d5586fc9b8a2d8b151628cb86de5641cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Tue, 9 Jun 2020 16:55:50 +0800 Subject: [PATCH 13/23] New Language: Keepalived configure language whose grammar like Nginx. --- components.js | 2 +- components.json | 4 + components/prism-keepalived.js | 32 +++++ components/prism-keepalived.min.js | 1 + plugins/show-language/prism-show-language.js | 1 + .../show-language/prism-show-language.min.js | 2 +- .../languages/keepalived/comment_feature.test | 13 ++ .../keepalived/constant_feature.test | 79 +++++++++++++ .../keepalived/property_feature.test | 111 ++++++++++++++++++ .../languages/keepalived/string_feature.test | 40 +++++++ 10 files changed, 283 insertions(+), 2 deletions(-) create mode 100644 components/prism-keepalived.js create mode 100644 components/prism-keepalived.min.js create mode 100644 tests/languages/keepalived/comment_feature.test create mode 100644 tests/languages/keepalived/constant_feature.test create mode 100644 tests/languages/keepalived/property_feature.test create mode 100644 tests/languages/keepalived/string_feature.test diff --git a/components.js b/components.js index ce821ff52a..7eab5033d0 100644 --- a/components.js +++ b/components.js @@ -1,2 +1,2 @@ -var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"Augmented Backus–Naur form","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"Backus–Naur form","alias":"rbnf","aliasTitles":{"rbnf":"Routing Backus–Naur form"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cil":{"title":"CIL","owner":"sbrl"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"clojure":{"title":"Clojure","owner":"troglotit"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dax":{"title":"DAX","owner":"peterbud"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"ebnf":{"title":"Extended Backus–Naur form","owner":"RunDevelopment"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","optional":["markdown"],"owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"http":{"title":"HTTP","optional":["css","javascript","json","markup"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mizar":{"title":"Mizar","owner":"Golmote"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nginx":{"title":"nginx","owner":"westonganger","require":"clike"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","markup-templating"],"owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","modify":["actionscript","coffeescript","flow","javascript","typescript","vala"],"owner":"RunDevelopment"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"vala":{"title":"Vala","require":"clike","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":"vb","owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}}; +var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"Augmented Backus–Naur form","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"eisbehr-"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"Backus–Naur form","alias":"rbnf","aliasTitles":{"rbnf":"Routing Backus–Naur form"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cil":{"title":"CIL","owner":"sbrl"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"clojure":{"title":"Clojure","owner":"troglotit"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dax":{"title":"DAX","owner":"peterbud"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"ebnf":{"title":"Extended Backus–Naur form","owner":"RunDevelopment"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","optional":["markdown"],"owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"http":{"title":"HTTP","optional":["css","javascript","json","markup"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"keepalived":{"title":"Keepalived Configure","owner":"dev-itsheng"},"kotlin":{"title":"Kotlin","require":"clike","owner":"Golmote"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mizar":{"title":"Mizar","owner":"Golmote"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nginx":{"title":"nginx","owner":"westonganger","require":"clike"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":["clike","markup-templating"],"owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","modify":["actionscript","coffeescript","flow","javascript","typescript","vala"],"owner":"RunDevelopment"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","require":"clike","owner":"chrischares"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"vala":{"title":"Vala","require":"clike","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":"vb","owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword matched in the code. For example, the keyword if will have the class keyword-if as well. You can have fine grained control over the appearance of each keyword by providing your own CSS rules.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}}; if (typeof module !== 'undefined' && module.exports) { module.exports = components; } \ No newline at end of file diff --git a/components.json b/components.json index 858656a0e9..a09683695e 100644 --- a/components.json +++ b/components.json @@ -587,6 +587,10 @@ "title": "Keyman", "owner": "mcdurdin" }, + "keepalived": { + "title": "Keepalived Configure", + "owner": "dev-itsheng" + }, "kotlin": { "title": "Kotlin", "require": "clike", diff --git a/components/prism-keepalived.js b/components/prism-keepalived.js new file mode 100644 index 0000000000..040b9a6af3 --- /dev/null +++ b/components/prism-keepalived.js @@ -0,0 +1,32 @@ +Prism.languages.keepalived = { + 'comment': { + pattern: /(^|[^"{\\])#.*/, + lookbehind: true + }, + 'property': { + pattern: /([\s\t]*)(?:\bglobal_defs|notification_email|notification_email_from|smtp_server|smtp_connect_timeout|router_id|virtual_server|fwmark|delay_loop|lb_algo|lb_kind|persistence_timeout|persistence_granularity|virtualhost|protocol|sorry_server|real_server|weight|TCP_CHECK|MISC_CHECK|misc_path|HTTP_GET|SSL_GET|url|path|digest|connect_port|connect_timeout|retry|delay_before_retry|vrrp_instance|state|interface|mcast_src_ip|lvs_sync_daemon_inteface|virtual_router_id|priority|advert_int|smtp_alert|authentication|auth_type|auth_pass|virtual_ipaddress|virtual_ipaddress_excluded|notify_master|notify_backup|notify_fault|vrrp_sync_group|vrrp_script|interval|script)\b/, + lookbehind: true + }, + 'constant': { + pattern: /(^[ \t]*)(?:rr|wrr|lc|wlc|sh|dh|lblc|NAT|DR|TUN|TCP|UDP|MASTER|BACKUP|PASS|AH)\b/, + lookbehind: true + }, + 'string': /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, + 'email': { + pattern: /([\w-])+@([\w-])+((\.[\w-]{2,3}){1,2})/, + alias: 'string', + }, + 'path': { + pattern: /(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:\w+\\)*(?:\w+\.\w+)?)/, + alias: 'string', + }, + 'ip': { + pattern: /(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:225[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)/, + alias: 'number' + }, + 'number': { + pattern: /(^|[^\w.-])-?\d*\.?\d+/, + lookbehind: true + }, + 'punctuation': /[\{\}]/ +}; \ No newline at end of file diff --git a/components/prism-keepalived.min.js b/components/prism-keepalived.min.js new file mode 100644 index 0000000000..5320831631 --- /dev/null +++ b/components/prism-keepalived.min.js @@ -0,0 +1 @@ +Prism.languages.keepalived={comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},property:{pattern:/(^[ \t]*)(?:global_defs|notification_email|notification_email_from|smtp_server|smtp_connection_timeout|lvs_id|virtual_server|fwmark|delay_loop|lb_algo|lb_kind|persistence_timeout|persistence_granularity|virtualhost|protocol|sorry_server|real_server|weight|TCP_CHECK|MISC_CHECK|misc_path|HTTP_GET|SSL_GET|url|path|digest|connect_port|connect_timeout|retry|delay_before_retry)\b/,lookbehind:!0},constant:{pattern:/(^[ \t]*)(?:rr|wrr|lc|wlc|sh|dh|lblc|NAT|DR|TUN|TCP|UDP|MASTER|BACKUP|PASS|AH)\b/,lookbehind:!0},string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,email:{pattern:/([\w-])+@([\w-])+((\.[\w-]{2,3}){1,2})/,alias:"string"},path:{pattern:/(?:\/(?:[^\/]+\/)*[^\/]*)|(?:[a-zA-Z]:\\(?:\w+\\)*(?:\w+\.\w+)?)/,alias:"string"},ip:{pattern:/(25[0-5]|2[0-4]\d|[01]\d{2}\.){3}(25[0-5]|2[0-4]\d|[01]\d{2})/,alias:"number"},number:{pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},punctuation:/[\{\}]/}; \ No newline at end of file diff --git a/plugins/show-language/prism-show-language.js b/plugins/show-language/prism-show-language.js index ac7d41779f..0fa9dd3c4e 100644 --- a/plugins/show-language/prism-show-language.js +++ b/plugins/show-language/prism-show-language.js @@ -93,6 +93,7 @@ "webmanifest": "Web App Manifest", "jsonp": "JSONP", "json5": "JSON5", + "keepalived": "Keepalived Configure", "latex": "LaTeX", "tex": "TeX", "context": "ConTeXt", diff --git a/plugins/show-language/prism-show-language.min.js b/plugins/show-language/prism-show-language.min.js index 802b0d75f1..b0aba364ae 100644 --- a/plugins/show-language/prism-show-language.min.js +++ b/plugins/show-language/prism-show-language.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var r={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"Augmented Backus–Naur form",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",asm6502:"6502 Assembly",aspnet:"ASP.NET (C#)",autohotkey:"AutoHotkey",autoit:"AutoIt",basic:"BASIC",bbcode:"BBcode",bnf:"Backus–Naur form",rbnf:"Routing Backus–Naur form",conc:"Concurnas",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",coffee:"CoffeeScript",cmake:"CMake",csp:"Content-Security-Policy","css-extras":"CSS Extras",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",ebnf:"Extended Backus–Naur form",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",iecst:"Structured Text (IEC 61131-3)",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras","js-templates":"JS Templates",json:"JSON",webmanifest:"Web App Manifest",jsonp:"JSONP",json5:"JSON5",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",py:"Python",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",tap:"TAP",toml:"TOML",tt2:"Template Toolkit 2",trig:"TriG",ts:"TypeScript","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)","t4-templating":"T4 templating",uscript:"UnrealScript",uc:"UnrealScript",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var s,t=a.getAttribute("data-language")||r[e.language]||((s=e.language)?(s.substring(0,1).toUpperCase()+s.substring(1)).replace(/s(?=cript)/,"S"):s);if(t){var o=document.createElement("span");return o.textContent=t,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}(); \ No newline at end of file +!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var r={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"Augmented Backus–Naur form",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",asm6502:"6502 Assembly",aspnet:"ASP.NET (C#)",autohotkey:"AutoHotkey",autoit:"AutoIt",basic:"BASIC",bbcode:"BBcode",bnf:"Backus–Naur form",rbnf:"Routing Backus–Naur form",conc:"Concurnas",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",coffee:"CoffeeScript",cmake:"CMake",csp:"Content-Security-Policy","css-extras":"CSS Extras",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",ebnf:"Extended Backus–Naur form",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",iecst:"Structured Text (IEC 61131-3)",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras","js-templates":"JS Templates",json:"JSON",webmanifest:"Web App Manifest",jsonp:"JSONP",json5:"JSON5",keepalived:"Keepalived Configure",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",py:"Python",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",tap:"TAP",toml:"TOML",tt2:"Template Toolkit 2",trig:"TriG",ts:"TypeScript","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)","t4-templating":"T4 templating",uscript:"UnrealScript",uc:"UnrealScript",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var s,t=a.getAttribute("data-language")||r[e.language]||((s=e.language)?(s.substring(0,1).toUpperCase()+s.substring(1)).replace(/s(?=cript)/,"S"):s);if(t){var o=document.createElement("span");return o.textContent=t,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}(); \ No newline at end of file diff --git a/tests/languages/keepalived/comment_feature.test b/tests/languages/keepalived/comment_feature.test new file mode 100644 index 0000000000..09493ab581 --- /dev/null +++ b/tests/languages/keepalived/comment_feature.test @@ -0,0 +1,13 @@ +# +# Foobar + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# Foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/tests/languages/keepalived/constant_feature.test b/tests/languages/keepalived/constant_feature.test new file mode 100644 index 0000000000..d9df719727 --- /dev/null +++ b/tests/languages/keepalived/constant_feature.test @@ -0,0 +1,79 @@ +virtual_server 192.168.1.200 3306 { + lb_algo rr + lb_algo wrr + lb_algo lc + lb_algo wlc + lb_algo sh + lb_algo dh + lb_algo lblc + + lb_kind NAT + lb_kind DR + lb_kind TUN + + protocol TCP + protocol UDP +} + +vrrp_instance test { + state MASTER + state BACKUP + + authentication { + auth_type PASS + auth_type AH + } +} + +---------------------------------------------------- + +[ + ["property", "virtual_server"], + ["ip", "192.168.1.200"], + ["number", "3306"], + ["punctuation", "{"], + ["property", "lb_algo"], + ["constant", "rr"], + ["property", "lb_algo"], + ["constant", "wrr"], + ["property", "lb_algo"], + ["constant", "lc"], + ["property", "lb_algo"], + ["constant", "wlc"], + ["property", "lb_algo"], + ["constant", "sh"], + ["property", "lb_algo"], + ["constant", "dh"], + ["property", "lb_algo"], + ["constant", "lblc"], + ["property", "lb_kind"], + ["constant", "NAT"], + ["property", "lb_kind"], + ["constant", "DR"], + ["property", "lb_kind"], + ["constant", "TUN"], + ["property", "protocol"], + ["constant", "TCP"], + ["property", "protocol"], + ["constant", "UDP"], + ["punctuation", "}"], + ["property", "vrrp_instance"], + " test ", + ["punctuation", "{"], + ["property", "state"], + ["constant", "MASTER"], + ["property", "state"], + ["constant", "BACKUP"], + ["property", "authentication"], + ["punctuation", "{"], + ["property", "auth_type"], + ["constant", "PASS"], + ["property", "auth_type"], + ["constant", "AH"], + ["punctuation", "}"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for constants, ip (alias number), number, punctuations. \ No newline at end of file diff --git a/tests/languages/keepalived/property_feature.test b/tests/languages/keepalived/property_feature.test new file mode 100644 index 0000000000..ab4f91df25 --- /dev/null +++ b/tests/languages/keepalived/property_feature.test @@ -0,0 +1,111 @@ +global_defs +notification_email +notification_email_from +smtp_server +smtp_connect_timeout +router_id +virtual_server +fwmark +delay_loop +lb_algo +lb_kind +persistence_timeout +persistence_granularity +virtualhost +protocol +sorry_server +real_server +weight +TCP_CHECK +MISC_CHECK +misc_path +HTTP_GET +SSL_GET +url +path +digest +connect_port +connect_timeout +retry +delay_before_retry +vrrp_instance +state +interface +mcast_src_ip +lvs_sync_daemon_inteface +virtual_router_id +priority +advert_int +smtp_alert +authentication +auth_type +auth_pass +virtual_ipaddress +virtual_ipaddress_excluded +notify_master +notify_backup +notify_fault +vrrp_sync_group +vrrp_script +interval +script + +---------------------------------------------------- + +[ + ["property", "global_defs"], + ["property", "notification_email"], + ["property", "notification_email_from"], + ["property", "smtp_server"], + ["property", "smtp_connect_timeout"], + ["property", "lvs_id"], + ["property", "virtual_server"], + ["property", "fwmark"], + ["property", "delay_loop"], + ["property", "lb_algo"], + ["property", "lb_kind"], + ["property", "persistence_timeout"], + ["property", "persistence_granularity"], + ["property", "virtualhost"], + ["property", "protocol"], + ["property", "sorry_server"], + ["property", "real_server"], + ["property", "weight"], + ["property", "TCP_CHECK"], + ["property", "MISC_CHECK"], + ["property", "misc_path"], + ["property", "HTTP_GET"], + ["property", "SSL_GET"], + ["property", "url"], + ["property", "path"], + ["property", "digest"], + ["property", "connect_port"], + ["property", "connect_timeout"], + ["property", "retry"], + ["property", "delay_before_retry"], + ["property", "vrrp_instance"], + ["property", "state"], + ["property", "interface"], + ["property", "mcast_src_ip"], + ["property", "lvs_sync_daemon_inteface"], + ["property", "virtual_router_id"], + ["property", "priority"], + ["property", "advert_int"], + ["property", "smtp_alert"], + ["property", "authentication"], + ["property", "auth_type"], + ["property", "auth_pass"], + ["property", "virtual_ipaddress"], + ["property", "virtual_ipaddress_excluded"], + ["property", "notify_master"], + ["property", "notify_backup"], + ["property", "notify_fault"], + ["property", "vrrp_sync_group"] + ["property", "vrrp_script"] + ["property", "interval"] + ["property", "script"] +] + +---------------------------------------------------- + +Checks for properties. diff --git a/tests/languages/keepalived/string_feature.test b/tests/languages/keepalived/string_feature.test new file mode 100644 index 0000000000..fc9567c905 --- /dev/null +++ b/tests/languages/keepalived/string_feature.test @@ -0,0 +1,40 @@ +global_defs { + notification_email { + example@163.com + } + notification_email_from example@example.com +} + +vrrp_instance VI_1 { + notify_master /etc/keepalived/to_master.sh + notify_backup C:\keepalived\to_backup.bat + notify_fault "/etc/keepalived/to_fault.sh" +} + +---------------------------------------------------- + +[ + ["property", "global_defs"], + ["punctuation", "{"], + ["property", "notification_email"], + ["punctuation", "{"], + ["email", "example@163.com"], + ["punctuation", "}"], + ["property", "notification_email_from"], + ["email", "example@example.com"], + ["punctuation", "}"], + ["property", "vrrp_instance"], + " VI_1 ", + ["punctuation", "{"], + ["property", "notify_master"], + ["path", "/etc/keepalived/to_master.sh"], + ["property", "notify_backup"], + ["path", "C:\\keepalived\\to_backup.bat"], + ["property", "notify_fault"], + ["string", "\"/etc/keepalived/to_fault.sh\""], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for string, path (alias string), email (alias string). \ No newline at end of file From 468491dab970f5056fe08388cf1ecc5f960702d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Tue, 9 Jun 2020 17:22:02 +0800 Subject: [PATCH 14/23] Fix test bug. --- tests/languages/keepalived/property_feature.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/languages/keepalived/property_feature.test b/tests/languages/keepalived/property_feature.test index ab4f91df25..8cd0ec8e1c 100644 --- a/tests/languages/keepalived/property_feature.test +++ b/tests/languages/keepalived/property_feature.test @@ -58,7 +58,7 @@ script ["property", "notification_email_from"], ["property", "smtp_server"], ["property", "smtp_connect_timeout"], - ["property", "lvs_id"], + ["property", "router_id"], ["property", "virtual_server"], ["property", "fwmark"], ["property", "delay_loop"], @@ -100,9 +100,9 @@ script ["property", "notify_master"], ["property", "notify_backup"], ["property", "notify_fault"], - ["property", "vrrp_sync_group"] - ["property", "vrrp_script"] - ["property", "interval"] + ["property", "vrrp_sync_group"], + ["property", "vrrp_script"], + ["property", "interval"], ["property", "script"] ] From 4a4ec98bc0b442afc60cab1fe02b5073baea8a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Tue, 9 Jun 2020 17:33:43 +0800 Subject: [PATCH 15/23] run `gulp` after change. --- components/prism-keepalived.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-keepalived.min.js b/components/prism-keepalived.min.js index 5320831631..82fee65c83 100644 --- a/components/prism-keepalived.min.js +++ b/components/prism-keepalived.min.js @@ -1 +1 @@ -Prism.languages.keepalived={comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},property:{pattern:/(^[ \t]*)(?:global_defs|notification_email|notification_email_from|smtp_server|smtp_connection_timeout|lvs_id|virtual_server|fwmark|delay_loop|lb_algo|lb_kind|persistence_timeout|persistence_granularity|virtualhost|protocol|sorry_server|real_server|weight|TCP_CHECK|MISC_CHECK|misc_path|HTTP_GET|SSL_GET|url|path|digest|connect_port|connect_timeout|retry|delay_before_retry)\b/,lookbehind:!0},constant:{pattern:/(^[ \t]*)(?:rr|wrr|lc|wlc|sh|dh|lblc|NAT|DR|TUN|TCP|UDP|MASTER|BACKUP|PASS|AH)\b/,lookbehind:!0},string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,email:{pattern:/([\w-])+@([\w-])+((\.[\w-]{2,3}){1,2})/,alias:"string"},path:{pattern:/(?:\/(?:[^\/]+\/)*[^\/]*)|(?:[a-zA-Z]:\\(?:\w+\\)*(?:\w+\.\w+)?)/,alias:"string"},ip:{pattern:/(25[0-5]|2[0-4]\d|[01]\d{2}\.){3}(25[0-5]|2[0-4]\d|[01]\d{2})/,alias:"number"},number:{pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},punctuation:/[\{\}]/}; \ No newline at end of file +Prism.languages.keepalived={comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},property:{pattern:/([\s\t]*)(?:\bglobal_defs|notification_email|notification_email_from|smtp_server|smtp_connect_timeout|router_id|virtual_server|fwmark|delay_loop|lb_algo|lb_kind|persistence_timeout|persistence_granularity|virtualhost|protocol|sorry_server|real_server|weight|TCP_CHECK|MISC_CHECK|misc_path|HTTP_GET|SSL_GET|url|path|digest|connect_port|connect_timeout|retry|delay_before_retry|vrrp_instance|state|interface|mcast_src_ip|lvs_sync_daemon_inteface|virtual_router_id|priority|advert_int|smtp_alert|authentication|auth_type|auth_pass|virtual_ipaddress|virtual_ipaddress_excluded|notify_master|notify_backup|notify_fault|vrrp_sync_group|vrrp_script|interval|script)\b/,lookbehind:!0},constant:{pattern:/(^[ \t]*)(?:rr|wrr|lc|wlc|sh|dh|lblc|NAT|DR|TUN|TCP|UDP|MASTER|BACKUP|PASS|AH)\b/,lookbehind:!0},string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,email:{pattern:/([\w-])+@([\w-])+((\.[\w-]{2,3}){1,2})/,alias:"string"},path:{pattern:/(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:\w+\\)*(?:\w+\.\w+)?)/,alias:"string"},ip:{pattern:/(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:225[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)/,alias:"number"},number:{pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},punctuation:/[\{\}]/}; \ No newline at end of file From 42e746acfc326f87e8d4b6fb0946aeeddd8892b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Tue, 9 Jun 2020 17:43:29 +0800 Subject: [PATCH 16/23] add `?:` to regex --- components/prism-keepalived.js | 2 +- components/prism-keepalived.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/prism-keepalived.js b/components/prism-keepalived.js index 040b9a6af3..d232999be0 100644 --- a/components/prism-keepalived.js +++ b/components/prism-keepalived.js @@ -13,7 +13,7 @@ Prism.languages.keepalived = { }, 'string': /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, 'email': { - pattern: /([\w-])+@([\w-])+((\.[\w-]{2,3}){1,2})/, + pattern: /(?:[\w-])+@([\w-])+((\.[\w-]{2,3}){1,2})/, alias: 'string', }, 'path': { diff --git a/components/prism-keepalived.min.js b/components/prism-keepalived.min.js index 82fee65c83..09962376c6 100644 --- a/components/prism-keepalived.min.js +++ b/components/prism-keepalived.min.js @@ -1 +1 @@ -Prism.languages.keepalived={comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},property:{pattern:/([\s\t]*)(?:\bglobal_defs|notification_email|notification_email_from|smtp_server|smtp_connect_timeout|router_id|virtual_server|fwmark|delay_loop|lb_algo|lb_kind|persistence_timeout|persistence_granularity|virtualhost|protocol|sorry_server|real_server|weight|TCP_CHECK|MISC_CHECK|misc_path|HTTP_GET|SSL_GET|url|path|digest|connect_port|connect_timeout|retry|delay_before_retry|vrrp_instance|state|interface|mcast_src_ip|lvs_sync_daemon_inteface|virtual_router_id|priority|advert_int|smtp_alert|authentication|auth_type|auth_pass|virtual_ipaddress|virtual_ipaddress_excluded|notify_master|notify_backup|notify_fault|vrrp_sync_group|vrrp_script|interval|script)\b/,lookbehind:!0},constant:{pattern:/(^[ \t]*)(?:rr|wrr|lc|wlc|sh|dh|lblc|NAT|DR|TUN|TCP|UDP|MASTER|BACKUP|PASS|AH)\b/,lookbehind:!0},string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,email:{pattern:/([\w-])+@([\w-])+((\.[\w-]{2,3}){1,2})/,alias:"string"},path:{pattern:/(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:\w+\\)*(?:\w+\.\w+)?)/,alias:"string"},ip:{pattern:/(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:225[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)/,alias:"number"},number:{pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},punctuation:/[\{\}]/}; \ No newline at end of file +Prism.languages.keepalived={comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},property:{pattern:/([\s\t]*)(?:\bglobal_defs|notification_email|notification_email_from|smtp_server|smtp_connect_timeout|router_id|virtual_server|fwmark|delay_loop|lb_algo|lb_kind|persistence_timeout|persistence_granularity|virtualhost|protocol|sorry_server|real_server|weight|TCP_CHECK|MISC_CHECK|misc_path|HTTP_GET|SSL_GET|url|path|digest|connect_port|connect_timeout|retry|delay_before_retry|vrrp_instance|state|interface|mcast_src_ip|lvs_sync_daemon_inteface|virtual_router_id|priority|advert_int|smtp_alert|authentication|auth_type|auth_pass|virtual_ipaddress|virtual_ipaddress_excluded|notify_master|notify_backup|notify_fault|vrrp_sync_group|vrrp_script|interval|script)\b/,lookbehind:!0},constant:{pattern:/(^[ \t]*)(?:rr|wrr|lc|wlc|sh|dh|lblc|NAT|DR|TUN|TCP|UDP|MASTER|BACKUP|PASS|AH)\b/,lookbehind:!0},string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,email:{pattern:/(?:[\w-])+@([\w-])+((\.[\w-]{2,3}){1,2})/,alias:"string"},path:{pattern:/(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:\w+\\)*(?:\w+\.\w+)?)/,alias:"string"},ip:{pattern:/(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:225[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)/,alias:"number"},number:{pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},punctuation:/[\{\}]/}; \ No newline at end of file From dadc727022156763d67e13c30a6ddc96507b58a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Tue, 9 Jun 2020 18:12:20 +0800 Subject: [PATCH 17/23] add example file. --- components/prism-keepalived.js | 2 +- examples/prism-keepalived.html | 130 +++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+), 1 deletion(-) create mode 100644 examples/prism-keepalived.html diff --git a/components/prism-keepalived.js b/components/prism-keepalived.js index d232999be0..836c8ef98e 100644 --- a/components/prism-keepalived.js +++ b/components/prism-keepalived.js @@ -13,7 +13,7 @@ Prism.languages.keepalived = { }, 'string': /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, 'email': { - pattern: /(?:[\w-])+@([\w-])+((\.[\w-]{2,3}){1,2})/, + pattern: /(?:[\w-])+@(?:[\w-])+(?:(?:\.[\w-]{2,3}){1,2})/, alias: 'string', }, 'path': { diff --git a/examples/prism-keepalived.html b/examples/prism-keepalived.html new file mode 100644 index 0000000000..c8bc961c8f --- /dev/null +++ b/examples/prism-keepalived.html @@ -0,0 +1,130 @@ +

A example from keepalived document

+

+# Configuration File for keepalived
+global_defs {
+    notification_email {
+        admin@domain.com
+        0633225522@domain.com
+    }
+    notification_email_from keepalived@domain.com
+    smtp_server 192.168.200.20
+    smtp_connect_timeout 30
+    router_id LVS_MAIN
+}
+
+# VRRP Instances definitions
+vrrp_instance VI_1 {
+    state MASTER
+    interface eth0
+    virtual_router_id 51
+    priority 150
+    advert_int 1
+    authentication {
+        auth_type PASS
+        auth_pass k@l!ve1
+    }
+    virtual_ipaddress {
+        192.168.200.10
+        192.168.200.11
+    }
+}
+vrrp_instance VI_2 {
+    state MASTER
+    interface eth1
+    virtual_router_id 52
+    priority 150
+    advert_int 1
+    authentication {
+        auth_type PASS
+        auth_pass k@l!ve2
+    }
+    virtual_ipaddress {
+        192.168.100.10
+    }
+}
+vrrp_instance VI_3 {
+    state BACKUP
+    interface eth0
+    virtual_router_id 53
+    priority 100
+    advert_int 1
+    authentication {
+        auth_type PASS
+        auth_pass k@l!ve3
+    }
+    virtual_ipaddress {
+        192.168.200.12
+        192.168.200.13
+    }
+}
+vrrp_instance VI_4 {
+    state BACKUP
+    interface eth1
+    virtual_router_id 54
+    priority 100
+    advert_int 1
+    authentication {
+        auth_type PASS
+        auth_pass k@l!ve4
+    }
+    virtual_ipaddress {
+        192.168.100.11
+    }
+}
+# Virtual Servers definitions
+virtual_server 192.168.200.10 80 {
+    delay_loop 30
+    lb_algo wrr
+    lb_kind NAT
+    persistence_timeout 50
+    protocol TCP
+    sorry_server 192.168.100.100 80
+    real_server 192.168.100.2 80 {
+        weight 2
+        HTTP_GET {
+            url {
+                path /testurl/test.jsp
+                digest ec90a42b99ea9a2f5ecbe213ac9eba03
+            }
+            url {
+                path /testurl2/test.jsp
+                digest 640205b7b0fc66c1ea91c463fac6334c
+            }
+            connect_timeout 3
+            retry 3
+            delay_before_retry 2
+        }
+    }
+    real_server 192.168.100.3 80 {
+        weight 1
+        HTTP_GET {
+            url {
+                path /testurl/test.jsp
+                digest 640205b7b0fc66c1ea91c463fac6334c
+            }
+            connect_timeout 3
+            retry 3
+            delay_before_retry 2
+        }
+    }
+}
+virtual_server 192.168.200.12 443 {
+    delay_loop 20
+    lb_algo rr
+    lb_kind NAT
+    persistence_timeout 360
+    protocol TCP
+    real_server 192.168.100.2 443 {
+        weight 1
+        TCP_CHECK {
+            connect_timeout 3
+        }
+    }
+    real_server 192.168.100.3 443 {
+        weight 1
+        TCP_CHECK {
+            connect_timeout 3
+        }
+    }
+}
+
\ No newline at end of file From 373f7012be198f62abdcc4905d90c230d87d4f81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Tue, 9 Jun 2020 18:21:25 +0800 Subject: [PATCH 18/23] ...... commit minify JS and HTML --- components/prism-keepalived.min.js | 2 +- examples/prism-nginx.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/components/prism-keepalived.min.js b/components/prism-keepalived.min.js index 09962376c6..7b0cb8f24d 100644 --- a/components/prism-keepalived.min.js +++ b/components/prism-keepalived.min.js @@ -1 +1 @@ -Prism.languages.keepalived={comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},property:{pattern:/([\s\t]*)(?:\bglobal_defs|notification_email|notification_email_from|smtp_server|smtp_connect_timeout|router_id|virtual_server|fwmark|delay_loop|lb_algo|lb_kind|persistence_timeout|persistence_granularity|virtualhost|protocol|sorry_server|real_server|weight|TCP_CHECK|MISC_CHECK|misc_path|HTTP_GET|SSL_GET|url|path|digest|connect_port|connect_timeout|retry|delay_before_retry|vrrp_instance|state|interface|mcast_src_ip|lvs_sync_daemon_inteface|virtual_router_id|priority|advert_int|smtp_alert|authentication|auth_type|auth_pass|virtual_ipaddress|virtual_ipaddress_excluded|notify_master|notify_backup|notify_fault|vrrp_sync_group|vrrp_script|interval|script)\b/,lookbehind:!0},constant:{pattern:/(^[ \t]*)(?:rr|wrr|lc|wlc|sh|dh|lblc|NAT|DR|TUN|TCP|UDP|MASTER|BACKUP|PASS|AH)\b/,lookbehind:!0},string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,email:{pattern:/(?:[\w-])+@([\w-])+((\.[\w-]{2,3}){1,2})/,alias:"string"},path:{pattern:/(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:\w+\\)*(?:\w+\.\w+)?)/,alias:"string"},ip:{pattern:/(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:225[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)/,alias:"number"},number:{pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},punctuation:/[\{\}]/}; \ No newline at end of file +Prism.languages.keepalived={comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},property:{pattern:/([\s\t]*)(?:\bglobal_defs|notification_email|notification_email_from|smtp_server|smtp_connect_timeout|router_id|virtual_server|fwmark|delay_loop|lb_algo|lb_kind|persistence_timeout|persistence_granularity|virtualhost|protocol|sorry_server|real_server|weight|TCP_CHECK|MISC_CHECK|misc_path|HTTP_GET|SSL_GET|url|path|digest|connect_port|connect_timeout|retry|delay_before_retry|vrrp_instance|state|interface|mcast_src_ip|lvs_sync_daemon_inteface|virtual_router_id|priority|advert_int|smtp_alert|authentication|auth_type|auth_pass|virtual_ipaddress|virtual_ipaddress_excluded|notify_master|notify_backup|notify_fault|vrrp_sync_group|vrrp_script|interval|script)\b/,lookbehind:!0},constant:{pattern:/(^[ \t]*)(?:rr|wrr|lc|wlc|sh|dh|lblc|NAT|DR|TUN|TCP|UDP|MASTER|BACKUP|PASS|AH)\b/,lookbehind:!0},string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,email:{pattern:/(?:[\w-])+@(?:[\w-])+(?:(?:\.[\w-]{2,3}){1,2})/,alias:"string"},path:{pattern:/(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:\w+\\)*(?:\w+\.\w+)?)/,alias:"string"},ip:{pattern:/(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:225[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)/,alias:"number"},number:{pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},punctuation:/[\{\}]/}; \ No newline at end of file diff --git a/examples/prism-nginx.html b/examples/prism-nginx.html index 49d14664d3..b00ffbb2aa 100644 --- a/examples/prism-nginx.html +++ b/examples/prism-nginx.html @@ -22,4 +22,5 @@

Server Block

location / { proxy_pass http://127.0.0.1:8080; } -} \ No newline at end of file +} + \ No newline at end of file From b370309890dde9f6cef5ab2b2344e24d3c02e2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ITSheng=E3=81=AE=E5=8F=B0=E5=BC=8F=E6=9C=BA?= <453491931@qq.com> Date: Wed, 17 Jun 2020 02:35:28 +0800 Subject: [PATCH 19/23] Fix all problems. --- components/prism-keepalived.js | 371 +++++++++- components/prism-keepalived.min.js | 2 +- .../languages/keepalived/boolean_feature.test | 23 + .../conditional-configuration_feature.test | 37 + .../keepalived/constant_feature.test | 92 ++- tests/languages/keepalived/ip_feature.test | 25 + tests/languages/keepalived/path_feature.test | 27 + .../keepalived/property_feature.test | 670 ++++++++++++++++-- .../languages/keepalived/string_feature.test | 8 +- .../keepalived/variable_feature.test | 23 + 10 files changed, 1152 insertions(+), 126 deletions(-) create mode 100644 tests/languages/keepalived/boolean_feature.test create mode 100644 tests/languages/keepalived/conditional-configuration_feature.test create mode 100644 tests/languages/keepalived/ip_feature.test create mode 100644 tests/languages/keepalived/path_feature.test create mode 100644 tests/languages/keepalived/variable_feature.test diff --git a/components/prism-keepalived.js b/components/prism-keepalived.js index 836c8ef98e..0c05214d2d 100644 --- a/components/prism-keepalived.js +++ b/components/prism-keepalived.js @@ -1,32 +1,367 @@ Prism.languages.keepalived = { + 'string': /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, 'comment': { - pattern: /(^|[^"{\\])#.*/, - lookbehind: true - }, - 'property': { - pattern: /([\s\t]*)(?:\bglobal_defs|notification_email|notification_email_from|smtp_server|smtp_connect_timeout|router_id|virtual_server|fwmark|delay_loop|lb_algo|lb_kind|persistence_timeout|persistence_granularity|virtualhost|protocol|sorry_server|real_server|weight|TCP_CHECK|MISC_CHECK|misc_path|HTTP_GET|SSL_GET|url|path|digest|connect_port|connect_timeout|retry|delay_before_retry|vrrp_instance|state|interface|mcast_src_ip|lvs_sync_daemon_inteface|virtual_router_id|priority|advert_int|smtp_alert|authentication|auth_type|auth_pass|virtual_ipaddress|virtual_ipaddress_excluded|notify_master|notify_backup|notify_fault|vrrp_sync_group|vrrp_script|interval|script)\b/, - lookbehind: true + pattern: /(?:#|!).*/, + greedy: true }, - 'constant': { - pattern: /(^[ \t]*)(?:rr|wrr|lc|wlc|sh|dh|lblc|NAT|DR|TUN|TCP|UDP|MASTER|BACKUP|PASS|AH)\b/, - lookbehind: true + + // support IPv4, IPv6, subnet mask + 'ip': { + pattern: /\b(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){5}:(?:[0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){4}:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){3}:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){2}:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}:(?:(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d)\.){3}(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d))|(?:::(?:[0-9A-Fa-f]{1,4}:){0,5}(?:(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d)\.){3}(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d))|(?:[0-9A-Fa-f]{1,4}::(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(?:::(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){1,7}:)))(?:\/\d{1,3})?)|(?:(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)(?:\/\d{1,2})?)\b/, + alias: 'number' }, - 'string': /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, - 'email': { - pattern: /(?:[\w-])+@(?:[\w-])+(?:(?:\.[\w-]{2,3}){1,2})/, + + // support *nix / Windows, directory / file + 'path': { + pattern: /(\s+)(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:[^\\\s]+\\)*[^\\\s]*)/, + lookbehind: true, alias: 'string', }, - 'path': { - pattern: /(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:\w+\\)*(?:\w+\.\w+)?)/, + 'variable': /\$\{?\w+\}?/, + 'email': { + pattern: /[\w-]+@[\w-]+(?:\.[\w-]{2,3}){1,2}/, alias: 'string', }, - 'ip': { - pattern: /(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:225[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)/, - alias: 'number' + 'conditional-configuration': { + pattern: /@\^?[\w-]+/, + alias: 'variable' }, + 'operator': /=/, + + // The list is too lang to split two parts + 'property': [ + // Uppercase and lowercase a-n + { + pattern: RegExp('\\b(?:' + [ + 'BFD_CHECK', + 'DNS_CHECK', + 'FILE_CHECK', + 'HTTP_GET', + 'MISC_CHECK', + 'NAME', + 'PING_CHECK', + 'SCRIPTS', + 'SMTP_CHECK', + 'SSL', + 'SSL_GET', + 'TCP_CHECK', + 'UDP_CHECK', + 'accept', + 'advert_int', + 'alpha', + 'auth_pass', + 'auth_type', + 'authentication', + 'bfd_cpu_affinity', + 'bfd_instance', + 'bfd_no_swap', + 'bfd_priority', + 'bfd_process_name', + 'bfd_rlimit_rttime', + 'bfd_rt_priority', + 'bind_if', + 'bind_port', + 'bindto', + 'ca', + 'certificate', + 'check_unicast_src', + 'checker', + 'checker_cpu_affinity', + 'checker_log_all_failures', + 'checker_no_swap', + 'checker_priority', + 'checker_rlimit_rttime', + 'checker_rt_priority', + 'child_wait_time', + 'connect_ip', + 'connect_port', + 'connect_timeout', + 'dbus_service_name', + 'debug', + 'default_interface', + 'delay', + 'delay_before_retry', + 'delay_loop', + 'digest', + 'dont_track_primary', + 'dynamic', + 'dynamic_interfaces', + 'enable_dbus', + 'enable_script_security', + 'enable_sni', + 'enable_snmp_checker', + 'enable_snmp_rfc', + 'enable_snmp_rfcv2', + 'enable_snmp_rfcv3', + 'enable_snmp_vrrp', + 'enable_traps', + 'end', + 'fall', + 'fast_recovery', + 'file', + 'flag-1', + 'flag-2', + 'flag-3', + 'fork_delay', + 'full_command', + 'fwmark', + 'garp_group', + 'garp_interval', + 'garp_lower_prio_delay', + 'garp_lower_prio_repeat', + 'garp_master_delay', + 'garp_master_refresh', + 'garp_master_refresh_repeat', + 'garp_master_repeat', + 'global_defs', + 'global_tracking', + 'gna_interval', + 'group', + 'ha_suspend', + 'hashed', + 'helo_name', + 'higher_prio_send_advert', + 'hoplimit', + 'http_protocol', + 'hysteresis', + 'idle_tx', + 'include', + 'inhibit_on_failure', + 'init_fail', + 'init_file', + 'instance', + 'interface', + 'interfaces', + 'interval', + 'ip_family', + 'ipvs_process_name', + 'keepalived.conf', + 'kernel_rx_buf_size', + 'key', + 'linkbeat_interfaces', + 'linkbeat_use_polling', + 'log_all_failures', + 'log_unknown_vrids', + 'lower_prio_no_advert', + 'lthreshold', + 'lvs_flush', + 'lvs_flush_onstop', + 'lvs_method', + 'lvs_netlink_cmd_rcv_bufs', + 'lvs_netlink_cmd_rcv_bufs_force', + 'lvs_netlink_monitor_rcv_bufs', + 'lvs_netlink_monitor_rcv_bufs_force', + 'lvs_notify_fifo', + 'lvs_notify_fifo_script', + 'lvs_sched', + 'lvs_sync_daemon', + 'max_auto_priority', + 'max_hops', + 'mcast_src_ip', + 'mh-fallback', + 'mh-port', + 'min_auto_priority_delay', + 'min_rx', + 'min_tx', + 'misc_dynamic', + 'misc_path', + 'misc_timeout', + 'multiplier', + 'name', + 'namespace_with_ipsets', + 'native_ipv6', + 'neighbor_ip', + 'net_namespace', + 'net_namespace_ipvs', + 'nftables', + 'nftables_counters', + 'nftables_ifindex', + 'nftables_priority', + 'no_accept', + 'no_checker_emails', + 'no_email_faults', + 'nopreempt', + 'notification_email', + 'notification_email_from', + 'notify', + 'notify_backup', + 'notify_deleted', + 'notify_down', + 'notify_fault', + 'notify_fifo', + 'notify_fifo_script', + 'notify_master', + 'notify_master_rx_lower_pri', + 'notify_priority_changes', + 'notify_stop', + 'notify_up', + ].join('|') + ')\\b') + }, + + // lowercase o-z + { + pattern: RegExp('\\b(?:' + [ + 'old_unicast_checksum', + 'omega', + 'ops', + 'param_match', + 'passive', + 'password', + 'path', + 'persistence_engine', + 'persistence_granularity', + 'persistence_timeout', + 'preempt', + 'preempt_delay', + 'priority', + 'process', + 'process_monitor_rcv_bufs', + 'process_monitor_rcv_bufs_force', + 'process_name', + 'process_names', + 'promote_secondaries', + 'protocol', + 'proxy_arp', + 'proxy_arp_pvlan', + 'quorum', + 'quorum_down', + 'quorum_max', + 'quorum_up', + 'random_seed', + 'real_server', + 'regex', + 'regex_max_offset', + 'regex_min_offset', + 'regex_no_match', + 'regex_options', + 'regex_stack', + 'reload_time_file', + 'reload_repeat', + 'require_reply', + 'retry', + 'rise', + 'router_id', + 'rs_init_notifies', + 'script', + 'script_user', + 'sh-fallback', + 'sh-port', + 'shutdown_script', + 'shutdown_script_timeout', + 'skip_check_adv_addr', + 'smtp_alert', + 'smtp_alert_checker', + 'smtp_alert_vrrp', + 'smtp_connect_timeout', + 'smtp_helo_name', + 'smtp_server', + 'snmp_socket', + 'sorry_server', + 'sorry_server_inhibit', + 'sorry_server_lvs_method', + 'source_ip', + 'start', + 'startup_script', + 'startup_script_timeout', + 'state', + 'static_ipaddress', + 'static_routes', + 'static_rules', + 'status_code', + 'step', + 'strict_mode', + 'sync_group_tracking_weight', + 'terminate_delay', + 'timeout', + 'track_bfd', + 'track_file', + 'track_group', + 'track_interface', + 'track_process', + 'track_script', + 'track_src_ip', + 'ttl', + 'type', + 'umask', + 'unicast_peer', + 'unicast_src_ip', + 'unicast_ttl', + 'url', + 'use_ipvlan', + 'use_pid_dir', + 'use_vmac', + 'user', + 'uthreshold', + 'val1', + 'val2', + 'val3', + 'version', + 'virtual_ipaddress', + 'virtual_ipaddress_excluded', + 'virtual_router_id', + 'virtual_routes', + 'virtual_rules', + 'virtual_server', + 'virtual_server fwmark', + 'virtual_server group', + 'virtual_server_group', + 'virtualhost', + 'vmac_xmit_base', + 'vrrp', + 'vrrp_check_unicast_src', + 'vrrp_cpu_affinity', + 'vrrp_garp_interval', + 'vrrp_garp_lower_prio_delay', + 'vrrp_garp_lower_prio_repeat', + 'vrrp_garp_master_delay', + 'vrrp_garp_master_refresh', + 'vrrp_garp_master_refresh_repeat', + 'vrrp_garp_master_repeat', + 'vrrp_gna_interval', + 'vrrp_higher_prio_send_advert', + 'vrrp_instance', + 'vrrp_ipsets', + 'vrrp_iptables', + 'vrrp_lower_prio_no_advert', + 'vrrp_mcast_group4', + 'vrrp_mcast_group6', + 'vrrp_min_garp', + 'vrrp_netlink_cmd_rcv_bufs', + 'vrrp_netlink_cmd_rcv_bufs_force', + 'vrrp_netlink_monitor_rcv_bufs', + 'vrrp_netlink_monitor_rcv_bufs_force', + 'vrrp_no_swap', + 'vrrp_notify_fifo', + 'vrrp_notify_fifo_script', + 'vrrp_notify_priority_changes', + 'vrrp_priority', + 'vrrp_process_name', + 'vrrp_rlimit_rttime', + 'vrrp_rt_priority', + 'vrrp_rx_bufs_multiplier', + 'vrrp_rx_bufs_policy', + 'vrrp_script', + 'vrrp_skip_check_adv_addr', + 'vrrp_startup_delay', + 'vrrp_strict', + 'vrrp_sync_group', + 'vrrp_track_process', + 'vrrp_version', + 'warmup', + 'weight', + ].join('|') + ')\\b') + } + ], + + 'constant': /\b(?:A|AAAA|AH|BACKUP|CNAME|DR|MASTER|MX|NAT|NS|PASS|SCTP|SOA|TCP|TUN|TXT|UDP|dh|fo|lblc|lblcr|lc|mh|nq|ovf|rr|sed|sh|wlc|wrr)\b/, + + 'number': { - pattern: /(^|[^\w.-])-?\d*\.?\d+/, + pattern: /(^|[^\w.-])-?\d+(?:\.\d+)?/, lookbehind: true }, + + 'boolean': /\b(?:on|off|true|false|yes|no)\b/, + 'punctuation': /[\{\}]/ }; \ No newline at end of file diff --git a/components/prism-keepalived.min.js b/components/prism-keepalived.min.js index 7b0cb8f24d..d8d9d7c334 100644 --- a/components/prism-keepalived.min.js +++ b/components/prism-keepalived.min.js @@ -1 +1 @@ -Prism.languages.keepalived={comment:{pattern:/(^|[^"{\\])#.*/,lookbehind:!0},property:{pattern:/([\s\t]*)(?:\bglobal_defs|notification_email|notification_email_from|smtp_server|smtp_connect_timeout|router_id|virtual_server|fwmark|delay_loop|lb_algo|lb_kind|persistence_timeout|persistence_granularity|virtualhost|protocol|sorry_server|real_server|weight|TCP_CHECK|MISC_CHECK|misc_path|HTTP_GET|SSL_GET|url|path|digest|connect_port|connect_timeout|retry|delay_before_retry|vrrp_instance|state|interface|mcast_src_ip|lvs_sync_daemon_inteface|virtual_router_id|priority|advert_int|smtp_alert|authentication|auth_type|auth_pass|virtual_ipaddress|virtual_ipaddress_excluded|notify_master|notify_backup|notify_fault|vrrp_sync_group|vrrp_script|interval|script)\b/,lookbehind:!0},constant:{pattern:/(^[ \t]*)(?:rr|wrr|lc|wlc|sh|dh|lblc|NAT|DR|TUN|TCP|UDP|MASTER|BACKUP|PASS|AH)\b/,lookbehind:!0},string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,email:{pattern:/(?:[\w-])+@(?:[\w-])+(?:(?:\.[\w-]{2,3}){1,2})/,alias:"string"},path:{pattern:/(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:\w+\\)*(?:\w+\.\w+)?)/,alias:"string"},ip:{pattern:/(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:225[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)/,alias:"number"},number:{pattern:/(^|[^\w.-])-?\d*\.?\d+/,lookbehind:!0},punctuation:/[\{\}]/}; \ No newline at end of file +Prism.languages.keepalived={string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,comment:{pattern:/(?:#|!).*/,greedy:!0},ip:{pattern:/\b(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){5}:(?:[0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){4}:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){3}:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){2}:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}:(?:(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d)\.){3}(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d))|(?:::(?:[0-9A-Fa-f]{1,4}:){0,5}(?:(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d)\.){3}(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d))|(?:[0-9A-Fa-f]{1,4}::(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(?:::(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){1,7}:)))(?:\/\d{1,3})?)|(?:(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)(?:\/\d{1,2})?)\b/,alias:"number"},path:{pattern:/(\s+)(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:[^\\\s]+\\)*[^\\\s]*)/,lookbehind:!0,alias:"string"},variable:/\$\{?\w+\}?/,email:{pattern:/[\w-]+@[\w-]+(?:\.[\w-]{2,3}){1,2}/,alias:"string"},"conditional-configuration":{pattern:/@\^?[\w-]+/,alias:"variable"},operator:/=/,property:[{pattern:RegExp("\\b(?:"+["BFD_CHECK","DNS_CHECK","FILE_CHECK","HTTP_GET","MISC_CHECK","NAME","PING_CHECK","SCRIPTS","SMTP_CHECK","SSL","SSL_GET","TCP_CHECK","UDP_CHECK","accept","advert_int","alpha","auth_pass","auth_type","authentication","bfd_cpu_affinity","bfd_instance","bfd_no_swap","bfd_priority","bfd_process_name","bfd_rlimit_rttime","bfd_rt_priority","bind_if","bind_port","bindto","ca","certificate","check_unicast_src","checker","checker_cpu_affinity","checker_log_all_failures","checker_no_swap","checker_priority","checker_rlimit_rttime","checker_rt_priority","child_wait_time","connect_ip","connect_port","connect_timeout","dbus_service_name","debug","default_interface","delay","delay_before_retry","delay_loop","digest","dont_track_primary","dynamic","dynamic_interfaces","enable_dbus","enable_script_security","enable_sni","enable_snmp_checker","enable_snmp_rfc","enable_snmp_rfcv2","enable_snmp_rfcv3","enable_snmp_vrrp","enable_traps","end","fall","fast_recovery","file","flag-1","flag-2","flag-3","fork_delay","full_command","fwmark","garp_group","garp_interval","garp_lower_prio_delay","garp_lower_prio_repeat","garp_master_delay","garp_master_refresh","garp_master_refresh_repeat","garp_master_repeat","global_defs","global_tracking","gna_interval","group","ha_suspend","hashed","helo_name","higher_prio_send_advert","hoplimit","http_protocol","hysteresis","idle_tx","include","inhibit_on_failure","init_fail","init_file","instance","interface","interfaces","interval","ip_family","ipvs_process_name","keepalived.conf","kernel_rx_buf_size","key","linkbeat_interfaces","linkbeat_use_polling","log_all_failures","log_unknown_vrids","lower_prio_no_advert","lthreshold","lvs_flush","lvs_flush_onstop","lvs_method","lvs_netlink_cmd_rcv_bufs","lvs_netlink_cmd_rcv_bufs_force","lvs_netlink_monitor_rcv_bufs","lvs_netlink_monitor_rcv_bufs_force","lvs_notify_fifo","lvs_notify_fifo_script","lvs_sched","lvs_sync_daemon","max_auto_priority","max_hops","mcast_src_ip","mh-fallback","mh-port","min_auto_priority_delay","min_rx","min_tx","misc_dynamic","misc_path","misc_timeout","multiplier","name","namespace_with_ipsets","native_ipv6","neighbor_ip","net_namespace","net_namespace_ipvs","nftables","nftables_counters","nftables_ifindex","nftables_priority","no_accept","no_checker_emails","no_email_faults","nopreempt","notification_email","notification_email_from","notify","notify_backup","notify_deleted","notify_down","notify_fault","notify_fifo","notify_fifo_script","notify_master","notify_master_rx_lower_pri","notify_priority_changes","notify_stop","notify_up"].join("|")+")\\b")},{pattern:RegExp("\\b(?:"+["old_unicast_checksum","omega","ops","param_match","passive","password","path","persistence_engine","persistence_granularity","persistence_timeout","preempt","preempt_delay","priority","process","process_monitor_rcv_bufs","process_monitor_rcv_bufs_force","process_name","process_names","promote_secondaries","protocol","proxy_arp","proxy_arp_pvlan","quorum","quorum_down","quorum_max","quorum_up","random_seed","real_server","regex","regex_max_offset","regex_min_offset","regex_no_match","regex_options","regex_stack","reload_time_file","reload_repeat","require_reply","retry","rise","router_id","rs_init_notifies","script","script_user","sh-fallback","sh-port","shutdown_script","shutdown_script_timeout","skip_check_adv_addr","smtp_alert","smtp_alert_checker","smtp_alert_vrrp","smtp_connect_timeout","smtp_helo_name","smtp_server","snmp_socket","sorry_server","sorry_server_inhibit","sorry_server_lvs_method","source_ip","start","startup_script","startup_script_timeout","state","static_ipaddress","static_routes","static_rules","status_code","step","strict_mode","sync_group_tracking_weight","terminate_delay","timeout","track_bfd","track_file","track_group","track_interface","track_process","track_script","track_src_ip","ttl","type","umask","unicast_peer","unicast_src_ip","unicast_ttl","url","use_ipvlan","use_pid_dir","use_vmac","user","uthreshold","val1","val2","val3","version","virtual_ipaddress","virtual_ipaddress_excluded","virtual_router_id","virtual_routes","virtual_rules","virtual_server","virtual_server fwmark","virtual_server group","virtual_server_group","virtualhost","vmac_xmit_base","vrrp","vrrp_check_unicast_src","vrrp_cpu_affinity","vrrp_garp_interval","vrrp_garp_lower_prio_delay","vrrp_garp_lower_prio_repeat","vrrp_garp_master_delay","vrrp_garp_master_refresh","vrrp_garp_master_refresh_repeat","vrrp_garp_master_repeat","vrrp_gna_interval","vrrp_higher_prio_send_advert","vrrp_instance","vrrp_ipsets","vrrp_iptables","vrrp_lower_prio_no_advert","vrrp_mcast_group4","vrrp_mcast_group6","vrrp_min_garp","vrrp_netlink_cmd_rcv_bufs","vrrp_netlink_cmd_rcv_bufs_force","vrrp_netlink_monitor_rcv_bufs","vrrp_netlink_monitor_rcv_bufs_force","vrrp_no_swap","vrrp_notify_fifo","vrrp_notify_fifo_script","vrrp_notify_priority_changes","vrrp_priority","vrrp_process_name","vrrp_rlimit_rttime","vrrp_rt_priority","vrrp_rx_bufs_multiplier","vrrp_rx_bufs_policy","vrrp_script","vrrp_skip_check_adv_addr","vrrp_startup_delay","vrrp_strict","vrrp_sync_group","vrrp_track_process","vrrp_version","warmup","weight"].join("|")+")\\b")}],constant:/\b(?:A|AAAA|AH|BACKUP|CNAME|DR|MASTER|MX|NAT|NS|PASS|SCTP|SOA|TCP|TUN|TXT|UDP|dh|fo|lblc|lblcr|lc|mh|nq|ovf|rr|sed|sh|wlc|wrr)\b/,number:{pattern:/(^|[^\w.-])-?\d+(?:\.\d+)?/,lookbehind:!0},boolean:/\b(?:on|off|true|false|yes|no)\b/,punctuation:/[\{\}]/}; \ No newline at end of file diff --git a/tests/languages/keepalived/boolean_feature.test b/tests/languages/keepalived/boolean_feature.test new file mode 100644 index 0000000000..921cbe2d01 --- /dev/null +++ b/tests/languages/keepalived/boolean_feature.test @@ -0,0 +1,23 @@ +strict_mode on +strict_mode off +strict_mode true +strict_mode false +strict_mode yes +strict_mode no + +---------------------------------------------------- + +[ + ["property", "strict_mode"], + ["boolean", "on"], + ["property", "strict_mode"], + ["boolean", "off"], + ["property", "strict_mode"], + ["boolean", "true"], + ["property", "strict_mode"], + ["boolean", "false"], + ["property", "strict_mode"], + ["boolean", "yes"], + ["property", "strict_mode"], + ["boolean", "no"] +] \ No newline at end of file diff --git a/tests/languages/keepalived/conditional-configuration_feature.test b/tests/languages/keepalived/conditional-configuration_feature.test new file mode 100644 index 0000000000..7d630fffde --- /dev/null +++ b/tests/languages/keepalived/conditional-configuration_feature.test @@ -0,0 +1,37 @@ +global_defs { + @main router_id main_router +} + +vrrp_instance VRRP { + @main unicast_src_ip 1.2.3.4 + unicast_peer { + @^main 1.2.3.4 + } +} + +---------------------------------------------------- + +[ + ["property", "global_defs"], + ["punctuation", "{"], + ["conditional-configuration", "@main"], + ["property", "router_id"], + " main_router\r\n", + ["punctuation", "}"], + ["property", "vrrp_instance"], + " VRRP ", + ["punctuation", "{"], + ["conditional-configuration", "@main"], + ["property", "unicast_src_ip"], + ["ip", "1.2.3.4"], + ["property", "unicast_peer"], + ["punctuation", "{"], + ["conditional-configuration", "@^main"], + ["ip", "1.2.3.4"], + ["punctuation", "}"], + ["punctuation", "}"] +] + + + + diff --git a/tests/languages/keepalived/constant_feature.test b/tests/languages/keepalived/constant_feature.test index d9df719727..6d83175c63 100644 --- a/tests/languages/keepalived/constant_feature.test +++ b/tests/languages/keepalived/constant_feature.test @@ -1,18 +1,25 @@ virtual_server 192.168.1.200 3306 { - lb_algo rr - lb_algo wrr - lb_algo lc - lb_algo wlc - lb_algo sh - lb_algo dh - lb_algo lblc + lvs_sched rr + lvs_sched wrr + lvs_sched lc + lvs_sched wlc + lvs_sched lblc + lvs_sched sh + lvs_sched mh + lvs_sched dh + lvs_sched fo + lvs_sched ovf + lvs_sched lblcr + lvs_sched sed + lvs_sched nq - lb_kind NAT - lb_kind DR - lb_kind TUN + lvs_method NAT + lvs_method DR + lvs_method TUN protocol TCP protocol UDP + protocol SCTP } vrrp_instance test { @@ -25,6 +32,16 @@ vrrp_instance test { } } +DNS_CHECK { + type A + type NS + type CNAME + type SOA + type MX + type TXT + type AAAA +} + ---------------------------------------------------- [ @@ -32,30 +49,44 @@ vrrp_instance test { ["ip", "192.168.1.200"], ["number", "3306"], ["punctuation", "{"], - ["property", "lb_algo"], + ["property", "lvs_sched"], ["constant", "rr"], - ["property", "lb_algo"], + ["property", "lvs_sched"], ["constant", "wrr"], - ["property", "lb_algo"], + ["property", "lvs_sched"], ["constant", "lc"], - ["property", "lb_algo"], + ["property", "lvs_sched"], ["constant", "wlc"], - ["property", "lb_algo"], + ["property", "lvs_sched"], + ["constant", "lblc"], + ["property", "lvs_sched"], ["constant", "sh"], - ["property", "lb_algo"], + ["property", "lvs_sched"], + ["constant", "mh"], + ["property", "lvs_sched"], ["constant", "dh"], - ["property", "lb_algo"], - ["constant", "lblc"], - ["property", "lb_kind"], + ["property", "lvs_sched"], + ["constant", "fo"], + ["property", "lvs_sched"], + ["constant", "ovf"], + ["property", "lvs_sched"], + ["constant", "lblcr"], + ["property", "lvs_sched"], + ["constant", "sed"], + ["property", "lvs_sched"], + ["constant", "nq"], + ["property", "lvs_method"], ["constant", "NAT"], - ["property", "lb_kind"], + ["property", "lvs_method"], ["constant", "DR"], - ["property", "lb_kind"], + ["property", "lvs_method"], ["constant", "TUN"], ["property", "protocol"], ["constant", "TCP"], ["property", "protocol"], ["constant", "UDP"], + ["property", "protocol"], + ["constant", "SCTP"], ["punctuation", "}"], ["property", "vrrp_instance"], " test ", @@ -71,9 +102,26 @@ vrrp_instance test { ["property", "auth_type"], ["constant", "AH"], ["punctuation", "}"], + ["punctuation", "}"], + ["property", "DNS_CHECK"], + ["punctuation", "{"], + ["property", "type"], + ["constant", "A"], + ["property", "type"], + ["constant", "NS"], + ["property", "type"], + ["constant", "CNAME"], + ["property", "type"], + ["constant", "SOA"], + ["property", "type"], + ["constant", "MX"], + ["property", "type"], + ["constant", "TXT"], + ["property", "type"], + ["constant", "AAAA"], ["punctuation", "}"] ] ---------------------------------------------------- -Checks for constants, ip (alias number), number, punctuations. \ No newline at end of file +Checks for constants, number, punctuations. \ No newline at end of file diff --git a/tests/languages/keepalived/ip_feature.test b/tests/languages/keepalived/ip_feature.test new file mode 100644 index 0000000000..801d399fe6 --- /dev/null +++ b/tests/languages/keepalived/ip_feature.test @@ -0,0 +1,25 @@ +virtual_server 192.168.1.200 3306 +virtual_server 192.168.1.200/32 3306 +virtual_server ABCD:EF01:2345:6789:ABCD:EF01:2345:6789 3306 +virtual_server ABCD:EF01:2345:6789:ABCD:EF01:2345:6789/128 3306 + +---------------------------------------------------- + +[ + ["property", "virtual_server"], + ["ip", "192.168.1.200"], + ["number", "3306"], + ["property", "virtual_server"], + ["ip", "192.168.1.200/32"], + ["number", "3306"], + ["property", "virtual_server"], + ["ip", "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789"], + ["number", "3306"], + ["property", "virtual_server"], + ["ip", "ABCD:EF01:2345:6789:ABCD:EF01:2345:6789/128"], + ["number", "3306"] +] + +---------------------------------------------------- + +Checks for ip (IPv4, IPv6, subnet mask). \ No newline at end of file diff --git a/tests/languages/keepalived/path_feature.test b/tests/languages/keepalived/path_feature.test new file mode 100644 index 0000000000..d5c5ff2f2c --- /dev/null +++ b/tests/languages/keepalived/path_feature.test @@ -0,0 +1,27 @@ +vrrp_instance VI_1 { + notify_master /etc/keepalived/to_master.sh + notify_backup C:\keepalived\to_backup.bat + net_namespace /var/run/keepalived + net_namespace C:\users\prism\keepalived +} + +---------------------------------------------------- + +[ + ["property", "vrrp_instance"], + " VI_1 ", + ["punctuation", "{"], + ["property", "notify_master"], + ["path", "/etc/keepalived/to_master.sh"], + ["property", "notify_backup"], + ["path", "C:\\keepalived\\to_backup.bat"], + ["property", "net_namespace"], + ["path", "/var/run/keepalived"], + ["property", "net_namespace"], + ["path", "C:\\users\\prism\\keepalived"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for path. \ No newline at end of file diff --git a/tests/languages/keepalived/property_feature.test b/tests/languages/keepalived/property_feature.test index 8cd0ec8e1c..2accd91338 100644 --- a/tests/languages/keepalived/property_feature.test +++ b/tests/languages/keepalived/property_feature.test @@ -1,109 +1,623 @@ -global_defs -notification_email -notification_email_from -smtp_server -smtp_connect_timeout -router_id -virtual_server -fwmark -delay_loop -lb_algo -lb_kind -persistence_timeout -persistence_granularity -virtualhost -protocol -sorry_server -real_server -weight -TCP_CHECK -MISC_CHECK -misc_path +BFD_CHECK +DNS_CHECK +FILE_CHECK HTTP_GET +MISC_CHECK +NAME +PING_CHECK +SCRIPTS +SMTP_CHECK +SSL SSL_GET -url -path -digest +TCP_CHECK +UDP_CHECK +accept +advert_int +alpha +auth_pass +auth_type +authentication +bfd_cpu_affinity +bfd_instance +bfd_no_swap +bfd_priority +bfd_process_name +bfd_rlimit_rttime +bfd_rt_priority +bind_if +bind_port +bindto +ca +certificate +check_unicast_src +checker +checker_cpu_affinity +checker_log_all_failures +checker_no_swap +checker_priority +checker_rlimit_rttime +checker_rt_priority +child_wait_time +connect_ip connect_port connect_timeout -retry +dbus_service_name +debug +default_interface +delay delay_before_retry -vrrp_instance -state +delay_loop +digest +dont_track_primary +dynamic +dynamic_interfaces +enable_dbus +enable_script_security +enable_sni +enable_snmp_checker +enable_snmp_rfc +enable_snmp_rfcv2 +enable_snmp_rfcv3 +enable_snmp_vrrp +enable_traps +end +fall +fast_recovery +file +flag-1 +flag-2 +flag-3 +fork_delay +full_command +fwmark +garp_group +garp_interval +garp_lower_prio_delay +garp_lower_prio_repeat +garp_master_delay +garp_master_refresh +garp_master_refresh_repeat +garp_master_repeat +global_defs +global_tracking +gna_interval +group +ha_suspend +hashed +helo_name +higher_prio_send_advert +hoplimit +http_protocol +hysteresis +idle_tx +include +inhibit_on_failure +init_fail +init_file +instance interface +interfaces +interval +ip_family +ipvs_process_name +keepalived.conf +kernel_rx_buf_size +key +linkbeat_interfaces +linkbeat_use_polling +log_all_failures +log_unknown_vrids +lower_prio_no_advert +lthreshold +lvs_flush +lvs_flush_onstop +lvs_method +lvs_netlink_cmd_rcv_bufs +lvs_netlink_cmd_rcv_bufs_force +lvs_netlink_monitor_rcv_bufs +lvs_netlink_monitor_rcv_bufs_force +lvs_notify_fifo +lvs_notify_fifo_script +lvs_sched +lvs_sync_daemon +max_auto_priority +max_hops mcast_src_ip -lvs_sync_daemon_inteface -virtual_router_id +mh-fallback +mh-port +min_auto_priority_delay +min_rx +min_tx +misc_dynamic +misc_path +misc_timeout +multiplier +name +namespace_with_ipsets +native_ipv6 +neighbor_ip +net_namespace +net_namespace_ipvs +nftables +nftables_counters +nftables_ifindex +nftables_priority +no_accept +no_checker_emails +no_email_faults +nopreempt +notification_email +notification_email_from +notify +notify_backup +notify_deleted +notify_down +notify_fault +notify_fifo +notify_fifo_script +notify_master +notify_master_rx_lower_pri +notify_priority_changes +notify_stop +notify_up +old_unicast_checksum +omega +ops +param_match +passive +password +path +persistence_engine +persistence_granularity +persistence_timeout +preempt +preempt_delay priority -advert_int +process +process_monitor_rcv_bufs +process_monitor_rcv_bufs_force +process_name +process_names +promote_secondaries +protocol +proxy_arp +proxy_arp_pvlan +quorum +quorum_down +quorum_max +quorum_up +random_seed +real_server +regex +regex_max_offset +regex_min_offset +regex_no_match +regex_options +regex_stack +reload_time_file +reload_repeat +require_reply +retry +rise +router_id +rs_init_notifies +script +script_user +sh-fallback +sh-port +shutdown_script +shutdown_script_timeout +skip_check_adv_addr smtp_alert -authentication -auth_type -auth_pass +smtp_alert_checker +smtp_alert_vrrp +smtp_connect_timeout +smtp_helo_name +smtp_server +snmp_socket +sorry_server +sorry_server_inhibit +sorry_server_lvs_method +source_ip +start +startup_script +startup_script_timeout +state +static_ipaddress +static_routes +static_rules +status_code +step +strict_mode +sync_group_tracking_weight +terminate_delay +timeout +track_bfd +track_file +track_group +track_interface +track_process +track_script +track_src_ip +ttl +type +umask +unicast_peer +unicast_src_ip +unicast_ttl +url +use_ipvlan +use_pid_dir +use_vmac +user +uthreshold +val1 +val2 +val3 +version virtual_ipaddress virtual_ipaddress_excluded -notify_master -notify_backup -notify_fault -vrrp_sync_group +virtual_router_id +virtual_routes +virtual_rules +virtual_server +virtual_server_group +virtualhost +vmac_xmit_base +vrrp +vrrp_check_unicast_src +vrrp_cpu_affinity +vrrp_garp_interval +vrrp_garp_lower_prio_delay +vrrp_garp_lower_prio_repeat +vrrp_garp_master_delay +vrrp_garp_master_refresh +vrrp_garp_master_refresh_repeat +vrrp_garp_master_repeat +vrrp_gna_interval +vrrp_higher_prio_send_advert +vrrp_instance +vrrp_ipsets +vrrp_iptables +vrrp_lower_prio_no_advert +vrrp_mcast_group4 +vrrp_mcast_group6 +vrrp_min_garp +vrrp_netlink_cmd_rcv_bufs +vrrp_netlink_cmd_rcv_bufs_force +vrrp_netlink_monitor_rcv_bufs +vrrp_netlink_monitor_rcv_bufs_force +vrrp_no_swap +vrrp_notify_fifo +vrrp_notify_fifo_script +vrrp_notify_priority_changes +vrrp_priority +vrrp_process_name +vrrp_rlimit_rttime +vrrp_rt_priority +vrrp_rx_bufs_multiplier +vrrp_rx_bufs_policy vrrp_script -interval -script +vrrp_skip_check_adv_addr +vrrp_startup_delay +vrrp_strict +vrrp_sync_group +vrrp_track_process +vrrp_version +warmup +weight ---------------------------------------------------- [ - ["property", "global_defs"], - ["property", "notification_email"], - ["property", "notification_email_from"], - ["property", "smtp_server"], - ["property", "smtp_connect_timeout"], - ["property", "router_id"], - ["property", "virtual_server"], - ["property", "fwmark"], - ["property", "delay_loop"], - ["property", "lb_algo"], - ["property", "lb_kind"], - ["property", "persistence_timeout"], - ["property", "persistence_granularity"], - ["property", "virtualhost"], - ["property", "protocol"], - ["property", "sorry_server"], - ["property", "real_server"], - ["property", "weight"], - ["property", "TCP_CHECK"], - ["property", "MISC_CHECK"], - ["property", "misc_path"], + ["property", "BFD_CHECK"], + ["property", "DNS_CHECK"], + ["property", "FILE_CHECK"], ["property", "HTTP_GET"], + ["property", "MISC_CHECK"], + ["property", "NAME"], + ["property", "PING_CHECK"], + ["property", "SCRIPTS"], + ["property", "SMTP_CHECK"], + ["property", "SSL"], ["property", "SSL_GET"], - ["property", "url"], - ["property", "path"], - ["property", "digest"], + ["property", "TCP_CHECK"], + ["property", "UDP_CHECK"], + ["property", "accept"], + ["property", "advert_int"], + ["property", "alpha"], + ["property", "auth_pass"], + ["property", "auth_type"], + ["property", "authentication"], + ["property", "bfd_cpu_affinity"], + ["property", "bfd_instance"], + ["property", "bfd_no_swap"], + ["property", "bfd_priority"], + ["property", "bfd_process_name"], + ["property", "bfd_rlimit_rttime"], + ["property", "bfd_rt_priority"], + ["property", "bind_if"], + ["property", "bind_port"], + ["property", "bindto"], + ["property", "ca"], + ["property", "certificate"], + ["property", "check_unicast_src"], + ["property", "checker"], + ["property", "checker_cpu_affinity"], + ["property", "checker_log_all_failures"], + ["property", "checker_no_swap"], + ["property", "checker_priority"], + ["property", "checker_rlimit_rttime"], + ["property", "checker_rt_priority"], + ["property", "child_wait_time"], + ["property", "connect_ip"], ["property", "connect_port"], ["property", "connect_timeout"], - ["property", "retry"], + ["property", "dbus_service_name"], + ["property", "debug"], + ["property", "default_interface"], + ["property", "delay"], ["property", "delay_before_retry"], - ["property", "vrrp_instance"], - ["property", "state"], + ["property", "delay_loop"], + ["property", "digest"], + ["property", "dont_track_primary"], + ["property", "dynamic"], + ["property", "dynamic_interfaces"], + ["property", "enable_dbus"], + ["property", "enable_script_security"], + ["property", "enable_sni"], + ["property", "enable_snmp_checker"], + ["property", "enable_snmp_rfc"], + ["property", "enable_snmp_rfcv2"], + ["property", "enable_snmp_rfcv3"], + ["property", "enable_snmp_vrrp"], + ["property", "enable_traps"], + ["property", "end"], + ["property", "fall"], + ["property", "fast_recovery"], + ["property", "file"], + ["property", "flag-1"], + ["property", "flag-2"], + ["property", "flag-3"], + ["property", "fork_delay"], + ["property", "full_command"], + ["property", "fwmark"], + ["property", "garp_group"], + ["property", "garp_interval"], + ["property", "garp_lower_prio_delay"], + ["property", "garp_lower_prio_repeat"], + ["property", "garp_master_delay"], + ["property", "garp_master_refresh"], + ["property", "garp_master_refresh_repeat"], + ["property", "garp_master_repeat"], + ["property", "global_defs"], + ["property", "global_tracking"], + ["property", "gna_interval"], + ["property", "group"], + ["property", "ha_suspend"], + ["property", "hashed"], + ["property", "helo_name"], + ["property", "higher_prio_send_advert"], + ["property", "hoplimit"], + ["property", "http_protocol"], + ["property", "hysteresis"], + ["property", "idle_tx"], + ["property", "include"], + ["property", "inhibit_on_failure"], + ["property", "init_fail"], + ["property", "init_file"], + ["property", "instance"], ["property", "interface"], + ["property", "interfaces"], + ["property", "interval"], + ["property", "ip_family"], + ["property", "ipvs_process_name"], + ["property", "keepalived.conf"], + ["property", "kernel_rx_buf_size"], + ["property", "key"], + ["property", "linkbeat_interfaces"], + ["property", "linkbeat_use_polling"], + ["property", "log_all_failures"], + ["property", "log_unknown_vrids"], + ["property", "lower_prio_no_advert"], + ["property", "lthreshold"], + ["property", "lvs_flush"], + ["property", "lvs_flush_onstop"], + ["property", "lvs_method"], + ["property", "lvs_netlink_cmd_rcv_bufs"], + ["property", "lvs_netlink_cmd_rcv_bufs_force"], + ["property", "lvs_netlink_monitor_rcv_bufs"], + ["property", "lvs_netlink_monitor_rcv_bufs_force"], + ["property", "lvs_notify_fifo"], + ["property", "lvs_notify_fifo_script"], + ["property", "lvs_sched"], + ["property", "lvs_sync_daemon"], + ["property", "max_auto_priority"], + ["property", "max_hops"], ["property", "mcast_src_ip"], - ["property", "lvs_sync_daemon_inteface"], - ["property", "virtual_router_id"], + ["property", "mh-fallback"], + ["property", "mh-port"], + ["property", "min_auto_priority_delay"], + ["property", "min_rx"], + ["property", "min_tx"], + ["property", "misc_dynamic"], + ["property", "misc_path"], + ["property", "misc_timeout"], + ["property", "multiplier"], + ["property", "name"], + ["property", "namespace_with_ipsets"], + ["property", "native_ipv6"], + ["property", "neighbor_ip"], + ["property", "net_namespace"], + ["property", "net_namespace_ipvs"], + ["property", "nftables"], + ["property", "nftables_counters"], + ["property", "nftables_ifindex"], + ["property", "nftables_priority"], + ["property", "no_accept"], + ["property", "no_checker_emails"], + ["property", "no_email_faults"], + ["property", "nopreempt"], + ["property", "notification_email"], + ["property", "notification_email_from"], + ["property", "notify"], + ["property", "notify_backup"], + ["property", "notify_deleted"], + ["property", "notify_down"], + ["property", "notify_fault"], + ["property", "notify_fifo"], + ["property", "notify_fifo_script"], + ["property", "notify_master"], + ["property", "notify_master_rx_lower_pri"], + ["property", "notify_priority_changes"], + ["property", "notify_stop"], + ["property", "notify_up"], + ["property", "old_unicast_checksum"], + ["property", "omega"], + ["property", "ops"], + ["property", "param_match"], + ["property", "passive"], + ["property", "password"], + ["property", "path"], + ["property", "persistence_engine"], + ["property", "persistence_granularity"], + ["property", "persistence_timeout"], + ["property", "preempt"], + ["property", "preempt_delay"], ["property", "priority"], - ["property", "advert_int"], + ["property", "process"], + ["property", "process_monitor_rcv_bufs"], + ["property", "process_monitor_rcv_bufs_force"], + ["property", "process_name"], + ["property", "process_names"], + ["property", "promote_secondaries"], + ["property", "protocol"], + ["property", "proxy_arp"], + ["property", "proxy_arp_pvlan"], + ["property", "quorum"], + ["property", "quorum_down"], + ["property", "quorum_max"], + ["property", "quorum_up"], + ["property", "random_seed"], + ["property", "real_server"], + ["property", "regex"], + ["property", "regex_max_offset"], + ["property", "regex_min_offset"], + ["property", "regex_no_match"], + ["property", "regex_options"], + ["property", "regex_stack"], + ["property", "reload_time_file"], + ["property", "reload_repeat"], + ["property", "require_reply"], + ["property", "retry"], + ["property", "rise"], + ["property", "router_id"], + ["property", "rs_init_notifies"], + ["property", "script"], + ["property", "script_user"], + ["property", "sh-fallback"], + ["property", "sh-port"], + ["property", "shutdown_script"], + ["property", "shutdown_script_timeout"], + ["property", "skip_check_adv_addr"], ["property", "smtp_alert"], - ["property", "authentication"], - ["property", "auth_type"], - ["property", "auth_pass"], + ["property", "smtp_alert_checker"], + ["property", "smtp_alert_vrrp"], + ["property", "smtp_connect_timeout"], + ["property", "smtp_helo_name"], + ["property", "smtp_server"], + ["property", "snmp_socket"], + ["property", "sorry_server"], + ["property", "sorry_server_inhibit"], + ["property", "sorry_server_lvs_method"], + ["property", "source_ip"], + ["property", "start"], + ["property", "startup_script"], + ["property", "startup_script_timeout"], + ["property", "state"], + ["property", "static_ipaddress"], + ["property", "static_routes"], + ["property", "static_rules"], + ["property", "status_code"], + ["property", "step"], + ["property", "strict_mode"], + ["property", "sync_group_tracking_weight"], + ["property", "terminate_delay"], + ["property", "timeout"], + ["property", "track_bfd"], + ["property", "track_file"], + ["property", "track_group"], + ["property", "track_interface"], + ["property", "track_process"], + ["property", "track_script"], + ["property", "track_src_ip"], + ["property", "ttl"], + ["property", "type"], + ["property", "umask"], + ["property", "unicast_peer"], + ["property", "unicast_src_ip"], + ["property", "unicast_ttl"], + ["property", "url"], + ["property", "use_ipvlan"], + ["property", "use_pid_dir"], + ["property", "use_vmac"], + ["property", "user"], + ["property", "uthreshold"], + ["property", "val1"], + ["property", "val2"], + ["property", "val3"], + ["property", "version"], ["property", "virtual_ipaddress"], ["property", "virtual_ipaddress_excluded"], - ["property", "notify_master"], - ["property", "notify_backup"], - ["property", "notify_fault"], - ["property", "vrrp_sync_group"], + ["property", "virtual_router_id"], + ["property", "virtual_routes"], + ["property", "virtual_rules"], + ["property", "virtual_server"], + ["property", "virtual_server_group"], + ["property", "virtualhost"], + ["property", "vmac_xmit_base"], + ["property", "vrrp"], + ["property", "vrrp_check_unicast_src"], + ["property", "vrrp_cpu_affinity"], + ["property", "vrrp_garp_interval"], + ["property", "vrrp_garp_lower_prio_delay"], + ["property", "vrrp_garp_lower_prio_repeat"], + ["property", "vrrp_garp_master_delay"], + ["property", "vrrp_garp_master_refresh"], + ["property", "vrrp_garp_master_refresh_repeat"], + ["property", "vrrp_garp_master_repeat"], + ["property", "vrrp_gna_interval"], + ["property", "vrrp_higher_prio_send_advert"], + ["property", "vrrp_instance"], + ["property", "vrrp_ipsets"], + ["property", "vrrp_iptables"], + ["property", "vrrp_lower_prio_no_advert"], + ["property", "vrrp_mcast_group4"], + ["property", "vrrp_mcast_group6"], + ["property", "vrrp_min_garp"], + ["property", "vrrp_netlink_cmd_rcv_bufs"], + ["property", "vrrp_netlink_cmd_rcv_bufs_force"], + ["property", "vrrp_netlink_monitor_rcv_bufs"], + ["property", "vrrp_netlink_monitor_rcv_bufs_force"], + ["property", "vrrp_no_swap"], + ["property", "vrrp_notify_fifo"], + ["property", "vrrp_notify_fifo_script"], + ["property", "vrrp_notify_priority_changes"], + ["property", "vrrp_priority"], + ["property", "vrrp_process_name"], + ["property", "vrrp_rlimit_rttime"], + ["property", "vrrp_rt_priority"], + ["property", "vrrp_rx_bufs_multiplier"], + ["property", "vrrp_rx_bufs_policy"], ["property", "vrrp_script"], - ["property", "interval"], - ["property", "script"] + ["property", "vrrp_skip_check_adv_addr"], + ["property", "vrrp_startup_delay"], + ["property", "vrrp_strict"], + ["property", "vrrp_sync_group"], + ["property", "vrrp_track_process"], + ["property", "vrrp_version"], + ["property", "warmup"], + ["property", "weight"] ] ---------------------------------------------------- diff --git a/tests/languages/keepalived/string_feature.test b/tests/languages/keepalived/string_feature.test index fc9567c905..c8b2993c3a 100644 --- a/tests/languages/keepalived/string_feature.test +++ b/tests/languages/keepalived/string_feature.test @@ -6,8 +6,6 @@ global_defs { } vrrp_instance VI_1 { - notify_master /etc/keepalived/to_master.sh - notify_backup C:\keepalived\to_backup.bat notify_fault "/etc/keepalived/to_fault.sh" } @@ -26,10 +24,6 @@ vrrp_instance VI_1 { ["property", "vrrp_instance"], " VI_1 ", ["punctuation", "{"], - ["property", "notify_master"], - ["path", "/etc/keepalived/to_master.sh"], - ["property", "notify_backup"], - ["path", "C:\\keepalived\\to_backup.bat"], ["property", "notify_fault"], ["string", "\"/etc/keepalived/to_fault.sh\""], ["punctuation", "}"] @@ -37,4 +31,4 @@ vrrp_instance VI_1 { ---------------------------------------------------- -Checks for string, path (alias string), email (alias string). \ No newline at end of file +Checks for string, email (alias string). \ No newline at end of file diff --git a/tests/languages/keepalived/variable_feature.test b/tests/languages/keepalived/variable_feature.test new file mode 100644 index 0000000000..751c374d4a --- /dev/null +++ b/tests/languages/keepalived/variable_feature.test @@ -0,0 +1,23 @@ +$ADDRESS_BASE=10.2.${ADDRESS_BASE_SUB} +$ADDRESS_BASE_SUB=0 +${ADDRESS_BASE}.100/32 +$ADDRESS_BASE_SUB=10 + +---------------------------------------------------- + +[ + ["variable", "$ADDRESS_BASE"], + ["operator", "="], + ["number", "10.2"], + ".", + ["variable", "${ADDRESS_BASE_SUB}"], + ["variable", "$ADDRESS_BASE_SUB"], + ["operator", "="], + ["number", "0"], + ["variable", "${ADDRESS_BASE}"], + ".100/", + ["number", "32"], + ["variable", "$ADDRESS_BASE_SUB"], + ["operator", "="], + ["number", "10"] +] \ No newline at end of file From 4e51c7f40cc89b47814a5ba8bc4355f8b22389e1 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 3 Oct 2021 16:16:42 +0200 Subject: [PATCH 20/23] Fixed linting errors and addressed review comments --- components/prism-keepalived.js | 20 +++++++++++++------- components/prism-keepalived.min.js | 2 +- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/components/prism-keepalived.js b/components/prism-keepalived.js index 0c05214d2d..71e1f06ba5 100644 --- a/components/prism-keepalived.js +++ b/components/prism-keepalived.js @@ -1,19 +1,26 @@ Prism.languages.keepalived = { - 'string': /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, 'comment': { - pattern: /(?:#|!).*/, + pattern: /[#!].*/, + greedy: true + }, + 'string': { + pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, greedy: true }, // support IPv4, IPv6, subnet mask 'ip': { - pattern: /\b(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){5}:(?:[0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){4}:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){3}:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){2}:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}:(?:(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d)\.){3}(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d))|(?:::(?:[0-9A-Fa-f]{1,4}:){0,5}(?:(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d)\.){3}(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d))|(?:[0-9A-Fa-f]{1,4}::(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(?:::(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){1,7}:)))(?:\/\d{1,3})?)|(?:(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)(?:\/\d{1,2})?)\b/, + pattern: RegExp( + /\b(?:(?:(?:[\da-f]{1,4}:){7}[\da-f]{1,4}|(?:[\da-f]{1,4}:){6}:[\da-f]{1,4}|(?:[\da-f]{1,4}:){5}:(?:[\da-f]{1,4}:)?[\da-f]{1,4}|(?:[\da-f]{1,4}:){4}:(?:[\da-f]{1,4}:){0,2}[\da-f]{1,4}|(?:[\da-f]{1,4}:){3}:(?:[\da-f]{1,4}:){0,3}[\da-f]{1,4}|(?:[\da-f]{1,4}:){2}:(?:[\da-f]{1,4}:){0,4}[\da-f]{1,4}|(?:[\da-f]{1,4}:){6}|(?:[\da-f]{1,4}:){0,5}:|::(?:[\da-f]{1,4}:){0,5}|[\da-f]{1,4}::(?:[\da-f]{1,4}:){0,5}[\da-f]{1,4}|::(?:[\da-f]{1,4}:){0,6}[\da-f]{1,4}|(?:[\da-f]{1,4}:){1,7}:)(?:\/\d{1,3})?|(?:\/\d{1,2})?)\b/.source + .replace(//g, function () { return /(?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d))/.source; }), + 'i' + ), alias: 'number' }, // support *nix / Windows, directory / file 'path': { - pattern: /(\s+)(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:[^\\\s]+\\)*[^\\\s]*)/, + pattern: /(\s)\/(?:[^\/\s]+\/)*[^\/\s]*|\b[a-zA-Z]:\\(?:[^\\\s]+\\)*[^\\\s]*/, lookbehind: true, alias: 'string', }, @@ -355,13 +362,12 @@ Prism.languages.keepalived = { 'constant': /\b(?:A|AAAA|AH|BACKUP|CNAME|DR|MASTER|MX|NAT|NS|PASS|SCTP|SOA|TCP|TUN|TXT|UDP|dh|fo|lblc|lblcr|lc|mh|nq|ovf|rr|sed|sh|wlc|wrr)\b/, - 'number': { pattern: /(^|[^\w.-])-?\d+(?:\.\d+)?/, lookbehind: true }, - 'boolean': /\b(?:on|off|true|false|yes|no)\b/, + 'boolean': /\b(?:false|no|off|on|true|yes)\b/, 'punctuation': /[\{\}]/ -}; \ No newline at end of file +}; diff --git a/components/prism-keepalived.min.js b/components/prism-keepalived.min.js index d8d9d7c334..892c650749 100644 --- a/components/prism-keepalived.min.js +++ b/components/prism-keepalived.min.js @@ -1 +1 @@ -Prism.languages.keepalived={string:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,comment:{pattern:/(?:#|!).*/,greedy:!0},ip:{pattern:/\b(?:(?:(?:(?:[0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){5}:(?:[0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){4}:(?:[0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){3}:(?:[0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){2}:(?:[0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){6}(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)|(?:(?:[0-9A-Fa-f]{1,4}:){0,5}:(?:(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d)\.){3}(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d))|(?:::(?:[0-9A-Fa-f]{1,4}:){0,5}(?:(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d)\.){3}(?:25[0-5]|1\d{2}|2[0-4]\d|[1-9]\d|\d))|(?:[0-9A-Fa-f]{1,4}::(?:[0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(?:::(?:[0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(?:(?:[0-9A-Fa-f]{1,4}:){1,7}:)))(?:\/\d{1,3})?)|(?:(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)(?:\/\d{1,2})?)\b/,alias:"number"},path:{pattern:/(\s+)(?:\/(?:[^\/\s]+\/)*[^\/\s]*)|(?:[a-zA-Z]:\\(?:[^\\\s]+\\)*[^\\\s]*)/,lookbehind:!0,alias:"string"},variable:/\$\{?\w+\}?/,email:{pattern:/[\w-]+@[\w-]+(?:\.[\w-]{2,3}){1,2}/,alias:"string"},"conditional-configuration":{pattern:/@\^?[\w-]+/,alias:"variable"},operator:/=/,property:[{pattern:RegExp("\\b(?:"+["BFD_CHECK","DNS_CHECK","FILE_CHECK","HTTP_GET","MISC_CHECK","NAME","PING_CHECK","SCRIPTS","SMTP_CHECK","SSL","SSL_GET","TCP_CHECK","UDP_CHECK","accept","advert_int","alpha","auth_pass","auth_type","authentication","bfd_cpu_affinity","bfd_instance","bfd_no_swap","bfd_priority","bfd_process_name","bfd_rlimit_rttime","bfd_rt_priority","bind_if","bind_port","bindto","ca","certificate","check_unicast_src","checker","checker_cpu_affinity","checker_log_all_failures","checker_no_swap","checker_priority","checker_rlimit_rttime","checker_rt_priority","child_wait_time","connect_ip","connect_port","connect_timeout","dbus_service_name","debug","default_interface","delay","delay_before_retry","delay_loop","digest","dont_track_primary","dynamic","dynamic_interfaces","enable_dbus","enable_script_security","enable_sni","enable_snmp_checker","enable_snmp_rfc","enable_snmp_rfcv2","enable_snmp_rfcv3","enable_snmp_vrrp","enable_traps","end","fall","fast_recovery","file","flag-1","flag-2","flag-3","fork_delay","full_command","fwmark","garp_group","garp_interval","garp_lower_prio_delay","garp_lower_prio_repeat","garp_master_delay","garp_master_refresh","garp_master_refresh_repeat","garp_master_repeat","global_defs","global_tracking","gna_interval","group","ha_suspend","hashed","helo_name","higher_prio_send_advert","hoplimit","http_protocol","hysteresis","idle_tx","include","inhibit_on_failure","init_fail","init_file","instance","interface","interfaces","interval","ip_family","ipvs_process_name","keepalived.conf","kernel_rx_buf_size","key","linkbeat_interfaces","linkbeat_use_polling","log_all_failures","log_unknown_vrids","lower_prio_no_advert","lthreshold","lvs_flush","lvs_flush_onstop","lvs_method","lvs_netlink_cmd_rcv_bufs","lvs_netlink_cmd_rcv_bufs_force","lvs_netlink_monitor_rcv_bufs","lvs_netlink_monitor_rcv_bufs_force","lvs_notify_fifo","lvs_notify_fifo_script","lvs_sched","lvs_sync_daemon","max_auto_priority","max_hops","mcast_src_ip","mh-fallback","mh-port","min_auto_priority_delay","min_rx","min_tx","misc_dynamic","misc_path","misc_timeout","multiplier","name","namespace_with_ipsets","native_ipv6","neighbor_ip","net_namespace","net_namespace_ipvs","nftables","nftables_counters","nftables_ifindex","nftables_priority","no_accept","no_checker_emails","no_email_faults","nopreempt","notification_email","notification_email_from","notify","notify_backup","notify_deleted","notify_down","notify_fault","notify_fifo","notify_fifo_script","notify_master","notify_master_rx_lower_pri","notify_priority_changes","notify_stop","notify_up"].join("|")+")\\b")},{pattern:RegExp("\\b(?:"+["old_unicast_checksum","omega","ops","param_match","passive","password","path","persistence_engine","persistence_granularity","persistence_timeout","preempt","preempt_delay","priority","process","process_monitor_rcv_bufs","process_monitor_rcv_bufs_force","process_name","process_names","promote_secondaries","protocol","proxy_arp","proxy_arp_pvlan","quorum","quorum_down","quorum_max","quorum_up","random_seed","real_server","regex","regex_max_offset","regex_min_offset","regex_no_match","regex_options","regex_stack","reload_time_file","reload_repeat","require_reply","retry","rise","router_id","rs_init_notifies","script","script_user","sh-fallback","sh-port","shutdown_script","shutdown_script_timeout","skip_check_adv_addr","smtp_alert","smtp_alert_checker","smtp_alert_vrrp","smtp_connect_timeout","smtp_helo_name","smtp_server","snmp_socket","sorry_server","sorry_server_inhibit","sorry_server_lvs_method","source_ip","start","startup_script","startup_script_timeout","state","static_ipaddress","static_routes","static_rules","status_code","step","strict_mode","sync_group_tracking_weight","terminate_delay","timeout","track_bfd","track_file","track_group","track_interface","track_process","track_script","track_src_ip","ttl","type","umask","unicast_peer","unicast_src_ip","unicast_ttl","url","use_ipvlan","use_pid_dir","use_vmac","user","uthreshold","val1","val2","val3","version","virtual_ipaddress","virtual_ipaddress_excluded","virtual_router_id","virtual_routes","virtual_rules","virtual_server","virtual_server fwmark","virtual_server group","virtual_server_group","virtualhost","vmac_xmit_base","vrrp","vrrp_check_unicast_src","vrrp_cpu_affinity","vrrp_garp_interval","vrrp_garp_lower_prio_delay","vrrp_garp_lower_prio_repeat","vrrp_garp_master_delay","vrrp_garp_master_refresh","vrrp_garp_master_refresh_repeat","vrrp_garp_master_repeat","vrrp_gna_interval","vrrp_higher_prio_send_advert","vrrp_instance","vrrp_ipsets","vrrp_iptables","vrrp_lower_prio_no_advert","vrrp_mcast_group4","vrrp_mcast_group6","vrrp_min_garp","vrrp_netlink_cmd_rcv_bufs","vrrp_netlink_cmd_rcv_bufs_force","vrrp_netlink_monitor_rcv_bufs","vrrp_netlink_monitor_rcv_bufs_force","vrrp_no_swap","vrrp_notify_fifo","vrrp_notify_fifo_script","vrrp_notify_priority_changes","vrrp_priority","vrrp_process_name","vrrp_rlimit_rttime","vrrp_rt_priority","vrrp_rx_bufs_multiplier","vrrp_rx_bufs_policy","vrrp_script","vrrp_skip_check_adv_addr","vrrp_startup_delay","vrrp_strict","vrrp_sync_group","vrrp_track_process","vrrp_version","warmup","weight"].join("|")+")\\b")}],constant:/\b(?:A|AAAA|AH|BACKUP|CNAME|DR|MASTER|MX|NAT|NS|PASS|SCTP|SOA|TCP|TUN|TXT|UDP|dh|fo|lblc|lblcr|lc|mh|nq|ovf|rr|sed|sh|wlc|wrr)\b/,number:{pattern:/(^|[^\w.-])-?\d+(?:\.\d+)?/,lookbehind:!0},boolean:/\b(?:on|off|true|false|yes|no)\b/,punctuation:/[\{\}]/}; \ No newline at end of file +Prism.languages.keepalived={comment:{pattern:/[#!].*/,greedy:!0},string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},ip:{pattern:RegExp("\\b(?:(?:(?:[\\da-f]{1,4}:){7}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){6}:[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){5}:(?:[\\da-f]{1,4}:)?[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){4}:(?:[\\da-f]{1,4}:){0,2}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){3}:(?:[\\da-f]{1,4}:){0,3}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){2}:(?:[\\da-f]{1,4}:){0,4}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){6}|(?:[\\da-f]{1,4}:){0,5}:|::(?:[\\da-f]{1,4}:){0,5}|[\\da-f]{1,4}::(?:[\\da-f]{1,4}:){0,5}[\\da-f]{1,4}|::(?:[\\da-f]{1,4}:){0,6}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){1,7}:)(?:/\\d{1,3})?|(?:/\\d{1,2})?)\\b".replace(//g,function(){return"(?:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d))"}),"i"),alias:"number"},path:{pattern:/(\s)\/(?:[^\/\s]+\/)*[^\/\s]*|\b[a-zA-Z]:\\(?:[^\\\s]+\\)*[^\\\s]*/,lookbehind:!0,alias:"string"},variable:/\$\{?\w+\}?/,email:{pattern:/[\w-]+@[\w-]+(?:\.[\w-]{2,3}){1,2}/,alias:"string"},"conditional-configuration":{pattern:/@\^?[\w-]+/,alias:"variable"},operator:/=/,property:[{pattern:RegExp("\\b(?:"+["BFD_CHECK","DNS_CHECK","FILE_CHECK","HTTP_GET","MISC_CHECK","NAME","PING_CHECK","SCRIPTS","SMTP_CHECK","SSL","SSL_GET","TCP_CHECK","UDP_CHECK","accept","advert_int","alpha","auth_pass","auth_type","authentication","bfd_cpu_affinity","bfd_instance","bfd_no_swap","bfd_priority","bfd_process_name","bfd_rlimit_rttime","bfd_rt_priority","bind_if","bind_port","bindto","ca","certificate","check_unicast_src","checker","checker_cpu_affinity","checker_log_all_failures","checker_no_swap","checker_priority","checker_rlimit_rttime","checker_rt_priority","child_wait_time","connect_ip","connect_port","connect_timeout","dbus_service_name","debug","default_interface","delay","delay_before_retry","delay_loop","digest","dont_track_primary","dynamic","dynamic_interfaces","enable_dbus","enable_script_security","enable_sni","enable_snmp_checker","enable_snmp_rfc","enable_snmp_rfcv2","enable_snmp_rfcv3","enable_snmp_vrrp","enable_traps","end","fall","fast_recovery","file","flag-1","flag-2","flag-3","fork_delay","full_command","fwmark","garp_group","garp_interval","garp_lower_prio_delay","garp_lower_prio_repeat","garp_master_delay","garp_master_refresh","garp_master_refresh_repeat","garp_master_repeat","global_defs","global_tracking","gna_interval","group","ha_suspend","hashed","helo_name","higher_prio_send_advert","hoplimit","http_protocol","hysteresis","idle_tx","include","inhibit_on_failure","init_fail","init_file","instance","interface","interfaces","interval","ip_family","ipvs_process_name","keepalived.conf","kernel_rx_buf_size","key","linkbeat_interfaces","linkbeat_use_polling","log_all_failures","log_unknown_vrids","lower_prio_no_advert","lthreshold","lvs_flush","lvs_flush_onstop","lvs_method","lvs_netlink_cmd_rcv_bufs","lvs_netlink_cmd_rcv_bufs_force","lvs_netlink_monitor_rcv_bufs","lvs_netlink_monitor_rcv_bufs_force","lvs_notify_fifo","lvs_notify_fifo_script","lvs_sched","lvs_sync_daemon","max_auto_priority","max_hops","mcast_src_ip","mh-fallback","mh-port","min_auto_priority_delay","min_rx","min_tx","misc_dynamic","misc_path","misc_timeout","multiplier","name","namespace_with_ipsets","native_ipv6","neighbor_ip","net_namespace","net_namespace_ipvs","nftables","nftables_counters","nftables_ifindex","nftables_priority","no_accept","no_checker_emails","no_email_faults","nopreempt","notification_email","notification_email_from","notify","notify_backup","notify_deleted","notify_down","notify_fault","notify_fifo","notify_fifo_script","notify_master","notify_master_rx_lower_pri","notify_priority_changes","notify_stop","notify_up"].join("|")+")\\b")},{pattern:RegExp("\\b(?:"+["old_unicast_checksum","omega","ops","param_match","passive","password","path","persistence_engine","persistence_granularity","persistence_timeout","preempt","preempt_delay","priority","process","process_monitor_rcv_bufs","process_monitor_rcv_bufs_force","process_name","process_names","promote_secondaries","protocol","proxy_arp","proxy_arp_pvlan","quorum","quorum_down","quorum_max","quorum_up","random_seed","real_server","regex","regex_max_offset","regex_min_offset","regex_no_match","regex_options","regex_stack","reload_time_file","reload_repeat","require_reply","retry","rise","router_id","rs_init_notifies","script","script_user","sh-fallback","sh-port","shutdown_script","shutdown_script_timeout","skip_check_adv_addr","smtp_alert","smtp_alert_checker","smtp_alert_vrrp","smtp_connect_timeout","smtp_helo_name","smtp_server","snmp_socket","sorry_server","sorry_server_inhibit","sorry_server_lvs_method","source_ip","start","startup_script","startup_script_timeout","state","static_ipaddress","static_routes","static_rules","status_code","step","strict_mode","sync_group_tracking_weight","terminate_delay","timeout","track_bfd","track_file","track_group","track_interface","track_process","track_script","track_src_ip","ttl","type","umask","unicast_peer","unicast_src_ip","unicast_ttl","url","use_ipvlan","use_pid_dir","use_vmac","user","uthreshold","val1","val2","val3","version","virtual_ipaddress","virtual_ipaddress_excluded","virtual_router_id","virtual_routes","virtual_rules","virtual_server","virtual_server fwmark","virtual_server group","virtual_server_group","virtualhost","vmac_xmit_base","vrrp","vrrp_check_unicast_src","vrrp_cpu_affinity","vrrp_garp_interval","vrrp_garp_lower_prio_delay","vrrp_garp_lower_prio_repeat","vrrp_garp_master_delay","vrrp_garp_master_refresh","vrrp_garp_master_refresh_repeat","vrrp_garp_master_repeat","vrrp_gna_interval","vrrp_higher_prio_send_advert","vrrp_instance","vrrp_ipsets","vrrp_iptables","vrrp_lower_prio_no_advert","vrrp_mcast_group4","vrrp_mcast_group6","vrrp_min_garp","vrrp_netlink_cmd_rcv_bufs","vrrp_netlink_cmd_rcv_bufs_force","vrrp_netlink_monitor_rcv_bufs","vrrp_netlink_monitor_rcv_bufs_force","vrrp_no_swap","vrrp_notify_fifo","vrrp_notify_fifo_script","vrrp_notify_priority_changes","vrrp_priority","vrrp_process_name","vrrp_rlimit_rttime","vrrp_rt_priority","vrrp_rx_bufs_multiplier","vrrp_rx_bufs_policy","vrrp_script","vrrp_skip_check_adv_addr","vrrp_startup_delay","vrrp_strict","vrrp_sync_group","vrrp_track_process","vrrp_version","warmup","weight"].join("|")+")\\b")}],constant:/\b(?:A|AAAA|AH|BACKUP|CNAME|DR|MASTER|MX|NAT|NS|PASS|SCTP|SOA|TCP|TUN|TXT|UDP|dh|fo|lblc|lblcr|lc|mh|nq|ovf|rr|sed|sh|wlc|wrr)\b/,number:{pattern:/(^|[^\w.-])-?\d+(?:\.\d+)?/,lookbehind:!0},boolean:/\b(?:false|no|off|on|true|yes)\b/,punctuation:/[\{\}]/}; \ No newline at end of file From 699110f0ff60f4303f1a94eecd6e456ba7a5bd1c Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 3 Oct 2021 16:30:16 +0200 Subject: [PATCH 21/23] Improved string pattern --- components/prism-keepalived.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/prism-keepalived.js b/components/prism-keepalived.js index 71e1f06ba5..f4b6da36d3 100644 --- a/components/prism-keepalived.js +++ b/components/prism-keepalived.js @@ -4,7 +4,8 @@ Prism.languages.keepalived = { greedy: true }, 'string': { - pattern: /("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, + pattern: /(^|[^\\])(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/, + lookbehind: true, greedy: true }, From 01d264c45cea512d1e268c5d0b885a842e1e499b Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 3 Oct 2021 16:32:06 +0200 Subject: [PATCH 22/23] Made one long `property` regex Now our regex tooling can work its magic. This will make it easier to maintain the regex in the long run. --- components/prism-keepalived.js | 325 +---------------------------- components/prism-keepalived.min.js | 2 +- 2 files changed, 2 insertions(+), 325 deletions(-) diff --git a/components/prism-keepalived.js b/components/prism-keepalived.js index f4b6da36d3..70a99944ba 100644 --- a/components/prism-keepalived.js +++ b/components/prism-keepalived.js @@ -36,330 +36,7 @@ Prism.languages.keepalived = { }, 'operator': /=/, - // The list is too lang to split two parts - 'property': [ - // Uppercase and lowercase a-n - { - pattern: RegExp('\\b(?:' + [ - 'BFD_CHECK', - 'DNS_CHECK', - 'FILE_CHECK', - 'HTTP_GET', - 'MISC_CHECK', - 'NAME', - 'PING_CHECK', - 'SCRIPTS', - 'SMTP_CHECK', - 'SSL', - 'SSL_GET', - 'TCP_CHECK', - 'UDP_CHECK', - 'accept', - 'advert_int', - 'alpha', - 'auth_pass', - 'auth_type', - 'authentication', - 'bfd_cpu_affinity', - 'bfd_instance', - 'bfd_no_swap', - 'bfd_priority', - 'bfd_process_name', - 'bfd_rlimit_rttime', - 'bfd_rt_priority', - 'bind_if', - 'bind_port', - 'bindto', - 'ca', - 'certificate', - 'check_unicast_src', - 'checker', - 'checker_cpu_affinity', - 'checker_log_all_failures', - 'checker_no_swap', - 'checker_priority', - 'checker_rlimit_rttime', - 'checker_rt_priority', - 'child_wait_time', - 'connect_ip', - 'connect_port', - 'connect_timeout', - 'dbus_service_name', - 'debug', - 'default_interface', - 'delay', - 'delay_before_retry', - 'delay_loop', - 'digest', - 'dont_track_primary', - 'dynamic', - 'dynamic_interfaces', - 'enable_dbus', - 'enable_script_security', - 'enable_sni', - 'enable_snmp_checker', - 'enable_snmp_rfc', - 'enable_snmp_rfcv2', - 'enable_snmp_rfcv3', - 'enable_snmp_vrrp', - 'enable_traps', - 'end', - 'fall', - 'fast_recovery', - 'file', - 'flag-1', - 'flag-2', - 'flag-3', - 'fork_delay', - 'full_command', - 'fwmark', - 'garp_group', - 'garp_interval', - 'garp_lower_prio_delay', - 'garp_lower_prio_repeat', - 'garp_master_delay', - 'garp_master_refresh', - 'garp_master_refresh_repeat', - 'garp_master_repeat', - 'global_defs', - 'global_tracking', - 'gna_interval', - 'group', - 'ha_suspend', - 'hashed', - 'helo_name', - 'higher_prio_send_advert', - 'hoplimit', - 'http_protocol', - 'hysteresis', - 'idle_tx', - 'include', - 'inhibit_on_failure', - 'init_fail', - 'init_file', - 'instance', - 'interface', - 'interfaces', - 'interval', - 'ip_family', - 'ipvs_process_name', - 'keepalived.conf', - 'kernel_rx_buf_size', - 'key', - 'linkbeat_interfaces', - 'linkbeat_use_polling', - 'log_all_failures', - 'log_unknown_vrids', - 'lower_prio_no_advert', - 'lthreshold', - 'lvs_flush', - 'lvs_flush_onstop', - 'lvs_method', - 'lvs_netlink_cmd_rcv_bufs', - 'lvs_netlink_cmd_rcv_bufs_force', - 'lvs_netlink_monitor_rcv_bufs', - 'lvs_netlink_monitor_rcv_bufs_force', - 'lvs_notify_fifo', - 'lvs_notify_fifo_script', - 'lvs_sched', - 'lvs_sync_daemon', - 'max_auto_priority', - 'max_hops', - 'mcast_src_ip', - 'mh-fallback', - 'mh-port', - 'min_auto_priority_delay', - 'min_rx', - 'min_tx', - 'misc_dynamic', - 'misc_path', - 'misc_timeout', - 'multiplier', - 'name', - 'namespace_with_ipsets', - 'native_ipv6', - 'neighbor_ip', - 'net_namespace', - 'net_namespace_ipvs', - 'nftables', - 'nftables_counters', - 'nftables_ifindex', - 'nftables_priority', - 'no_accept', - 'no_checker_emails', - 'no_email_faults', - 'nopreempt', - 'notification_email', - 'notification_email_from', - 'notify', - 'notify_backup', - 'notify_deleted', - 'notify_down', - 'notify_fault', - 'notify_fifo', - 'notify_fifo_script', - 'notify_master', - 'notify_master_rx_lower_pri', - 'notify_priority_changes', - 'notify_stop', - 'notify_up', - ].join('|') + ')\\b') - }, - - // lowercase o-z - { - pattern: RegExp('\\b(?:' + [ - 'old_unicast_checksum', - 'omega', - 'ops', - 'param_match', - 'passive', - 'password', - 'path', - 'persistence_engine', - 'persistence_granularity', - 'persistence_timeout', - 'preempt', - 'preempt_delay', - 'priority', - 'process', - 'process_monitor_rcv_bufs', - 'process_monitor_rcv_bufs_force', - 'process_name', - 'process_names', - 'promote_secondaries', - 'protocol', - 'proxy_arp', - 'proxy_arp_pvlan', - 'quorum', - 'quorum_down', - 'quorum_max', - 'quorum_up', - 'random_seed', - 'real_server', - 'regex', - 'regex_max_offset', - 'regex_min_offset', - 'regex_no_match', - 'regex_options', - 'regex_stack', - 'reload_time_file', - 'reload_repeat', - 'require_reply', - 'retry', - 'rise', - 'router_id', - 'rs_init_notifies', - 'script', - 'script_user', - 'sh-fallback', - 'sh-port', - 'shutdown_script', - 'shutdown_script_timeout', - 'skip_check_adv_addr', - 'smtp_alert', - 'smtp_alert_checker', - 'smtp_alert_vrrp', - 'smtp_connect_timeout', - 'smtp_helo_name', - 'smtp_server', - 'snmp_socket', - 'sorry_server', - 'sorry_server_inhibit', - 'sorry_server_lvs_method', - 'source_ip', - 'start', - 'startup_script', - 'startup_script_timeout', - 'state', - 'static_ipaddress', - 'static_routes', - 'static_rules', - 'status_code', - 'step', - 'strict_mode', - 'sync_group_tracking_weight', - 'terminate_delay', - 'timeout', - 'track_bfd', - 'track_file', - 'track_group', - 'track_interface', - 'track_process', - 'track_script', - 'track_src_ip', - 'ttl', - 'type', - 'umask', - 'unicast_peer', - 'unicast_src_ip', - 'unicast_ttl', - 'url', - 'use_ipvlan', - 'use_pid_dir', - 'use_vmac', - 'user', - 'uthreshold', - 'val1', - 'val2', - 'val3', - 'version', - 'virtual_ipaddress', - 'virtual_ipaddress_excluded', - 'virtual_router_id', - 'virtual_routes', - 'virtual_rules', - 'virtual_server', - 'virtual_server fwmark', - 'virtual_server group', - 'virtual_server_group', - 'virtualhost', - 'vmac_xmit_base', - 'vrrp', - 'vrrp_check_unicast_src', - 'vrrp_cpu_affinity', - 'vrrp_garp_interval', - 'vrrp_garp_lower_prio_delay', - 'vrrp_garp_lower_prio_repeat', - 'vrrp_garp_master_delay', - 'vrrp_garp_master_refresh', - 'vrrp_garp_master_refresh_repeat', - 'vrrp_garp_master_repeat', - 'vrrp_gna_interval', - 'vrrp_higher_prio_send_advert', - 'vrrp_instance', - 'vrrp_ipsets', - 'vrrp_iptables', - 'vrrp_lower_prio_no_advert', - 'vrrp_mcast_group4', - 'vrrp_mcast_group6', - 'vrrp_min_garp', - 'vrrp_netlink_cmd_rcv_bufs', - 'vrrp_netlink_cmd_rcv_bufs_force', - 'vrrp_netlink_monitor_rcv_bufs', - 'vrrp_netlink_monitor_rcv_bufs_force', - 'vrrp_no_swap', - 'vrrp_notify_fifo', - 'vrrp_notify_fifo_script', - 'vrrp_notify_priority_changes', - 'vrrp_priority', - 'vrrp_process_name', - 'vrrp_rlimit_rttime', - 'vrrp_rt_priority', - 'vrrp_rx_bufs_multiplier', - 'vrrp_rx_bufs_policy', - 'vrrp_script', - 'vrrp_skip_check_adv_addr', - 'vrrp_startup_delay', - 'vrrp_strict', - 'vrrp_sync_group', - 'vrrp_track_process', - 'vrrp_version', - 'warmup', - 'weight', - ].join('|') + ')\\b') - } - ], + 'property': /\b(?:BFD_CHECK|DNS_CHECK|FILE_CHECK|HTTP_GET|MISC_CHECK|NAME|PING_CHECK|SCRIPTS|SMTP_CHECK|SSL|SSL_GET|TCP_CHECK|UDP_CHECK|accept|advert_int|alpha|auth_pass|auth_type|authentication|bfd_cpu_affinity|bfd_instance|bfd_no_swap|bfd_priority|bfd_process_name|bfd_rlimit_rttime|bfd_rt_priority|bind_if|bind_port|bindto|ca|certificate|check_unicast_src|checker|checker_cpu_affinity|checker_log_all_failures|checker_no_swap|checker_priority|checker_rlimit_rttime|checker_rt_priority|child_wait_time|connect_ip|connect_port|connect_timeout|dbus_service_name|debug|default_interface|delay|delay_before_retry|delay_loop|digest|dont_track_primary|dynamic|dynamic_interfaces|enable_(?:dbus|script_security|sni|snmp_checker|snmp_rfc|snmp_rfcv2|snmp_rfcv3|snmp_vrrp|traps)|end|fall|fast_recovery|file|flag-[123]|fork_delay|full_command|fwmark|garp_group|garp_interval|garp_lower_prio_delay|garp_lower_prio_repeat|garp_master_delay|garp_master_refresh|garp_master_refresh_repeat|garp_master_repeat|global_defs|global_tracking|gna_interval|group|ha_suspend|hashed|helo_name|higher_prio_send_advert|hoplimit|http_protocol|hysteresis|idle_tx|include|inhibit_on_failure|init_fail|init_file|instance|interface|interfaces|interval|ip_family|ipvs_process_name|keepalived.conf|kernel_rx_buf_size|key|linkbeat_interfaces|linkbeat_use_polling|log_all_failures|log_unknown_vrids|lower_prio_no_advert|lthreshold|lvs_flush|lvs_flush_onstop|lvs_method|lvs_netlink_cmd_rcv_bufs|lvs_netlink_cmd_rcv_bufs_force|lvs_netlink_monitor_rcv_bufs|lvs_netlink_monitor_rcv_bufs_force|lvs_notify_fifo|lvs_notify_fifo_script|lvs_sched|lvs_sync_daemon|max_auto_priority|max_hops|mcast_src_ip|mh-fallback|mh-port|min_auto_priority_delay|min_rx|min_tx|misc_dynamic|misc_path|misc_timeout|multiplier|name|namespace_with_ipsets|native_ipv6|neighbor_ip|net_namespace|net_namespace_ipvs|nftables|nftables_counters|nftables_ifindex|nftables_priority|no_accept|no_checker_emails|no_email_faults|nopreempt|notification_email|notification_email_from|notify|notify_backup|notify_deleted|notify_down|notify_fault|notify_fifo|notify_fifo_script|notify_master|notify_master_rx_lower_pri|notify_priority_changes|notify_stop|notify_up|old_unicast_checksum|omega|ops|param_match|passive|password|path|persistence_engine|persistence_granularity|persistence_timeout|preempt|preempt_delay|priority|process|process_monitor_rcv_bufs|process_monitor_rcv_bufs_force|process_name|process_names|promote_secondaries|protocol|proxy_arp|proxy_arp_pvlan|quorum|quorum_down|quorum_max|quorum_up|random_seed|real_server|regex|regex_max_offset|regex_min_offset|regex_no_match|regex_options|regex_stack|reload_repeat|reload_time_file|require_reply|retry|rise|router_id|rs_init_notifies|script|script_user|sh-fallback|sh-port|shutdown_script|shutdown_script_timeout|skip_check_adv_addr|smtp_alert|smtp_alert_checker|smtp_alert_vrrp|smtp_connect_timeout|smtp_helo_name|smtp_server|snmp_socket|sorry_server|sorry_server_inhibit|sorry_server_lvs_method|source_ip|start|startup_script|startup_script_timeout|state|static_ipaddress|static_routes|static_rules|status_code|step|strict_mode|sync_group_tracking_weight|terminate_delay|timeout|track_bfd|track_file|track_group|track_interface|track_process|track_script|track_src_ip|ttl|type|umask|unicast_peer|unicast_src_ip|unicast_ttl|url|use_ipvlan|use_pid_dir|use_vmac|user|uthreshold|val[123]|version|virtual_ipaddress|virtual_ipaddress_excluded|virtual_router_id|virtual_routes|virtual_rules|virtual_server|virtual_server_group|virtualhost|vmac_xmit_base|vrrp|vrrp_(?:check_unicast_src|cpu_affinity|garp_interval|garp_lower_prio_delay|garp_lower_prio_repeat|garp_master_delay|garp_master_refresh|garp_master_refresh_repeat|garp_master_repeat|gna_interval|higher_prio_send_advert|instance|ipsets|iptables|lower_prio_no_advert|mcast_group4|mcast_group6|min_garp|netlink_cmd_rcv_bufs|netlink_cmd_rcv_bufs_force|netlink_monitor_rcv_bufs|netlink_monitor_rcv_bufs_force|no_swap|notify_fifo|notify_fifo_script|notify_priority_changes|priority|process_name|rlimit_rttime|rt_priority|rx_bufs_multiplier|rx_bufs_policy|script|skip_check_adv_addr|startup_delay|strict|sync_group|track_process|version)|warmup|weight)\b/, 'constant': /\b(?:A|AAAA|AH|BACKUP|CNAME|DR|MASTER|MX|NAT|NS|PASS|SCTP|SOA|TCP|TUN|TXT|UDP|dh|fo|lblc|lblcr|lc|mh|nq|ovf|rr|sed|sh|wlc|wrr)\b/, diff --git a/components/prism-keepalived.min.js b/components/prism-keepalived.min.js index 892c650749..e5eb79b5f3 100644 --- a/components/prism-keepalived.min.js +++ b/components/prism-keepalived.min.js @@ -1 +1 @@ -Prism.languages.keepalived={comment:{pattern:/[#!].*/,greedy:!0},string:{pattern:/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},ip:{pattern:RegExp("\\b(?:(?:(?:[\\da-f]{1,4}:){7}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){6}:[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){5}:(?:[\\da-f]{1,4}:)?[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){4}:(?:[\\da-f]{1,4}:){0,2}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){3}:(?:[\\da-f]{1,4}:){0,3}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){2}:(?:[\\da-f]{1,4}:){0,4}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){6}|(?:[\\da-f]{1,4}:){0,5}:|::(?:[\\da-f]{1,4}:){0,5}|[\\da-f]{1,4}::(?:[\\da-f]{1,4}:){0,5}[\\da-f]{1,4}|::(?:[\\da-f]{1,4}:){0,6}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){1,7}:)(?:/\\d{1,3})?|(?:/\\d{1,2})?)\\b".replace(//g,function(){return"(?:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d))"}),"i"),alias:"number"},path:{pattern:/(\s)\/(?:[^\/\s]+\/)*[^\/\s]*|\b[a-zA-Z]:\\(?:[^\\\s]+\\)*[^\\\s]*/,lookbehind:!0,alias:"string"},variable:/\$\{?\w+\}?/,email:{pattern:/[\w-]+@[\w-]+(?:\.[\w-]{2,3}){1,2}/,alias:"string"},"conditional-configuration":{pattern:/@\^?[\w-]+/,alias:"variable"},operator:/=/,property:[{pattern:RegExp("\\b(?:"+["BFD_CHECK","DNS_CHECK","FILE_CHECK","HTTP_GET","MISC_CHECK","NAME","PING_CHECK","SCRIPTS","SMTP_CHECK","SSL","SSL_GET","TCP_CHECK","UDP_CHECK","accept","advert_int","alpha","auth_pass","auth_type","authentication","bfd_cpu_affinity","bfd_instance","bfd_no_swap","bfd_priority","bfd_process_name","bfd_rlimit_rttime","bfd_rt_priority","bind_if","bind_port","bindto","ca","certificate","check_unicast_src","checker","checker_cpu_affinity","checker_log_all_failures","checker_no_swap","checker_priority","checker_rlimit_rttime","checker_rt_priority","child_wait_time","connect_ip","connect_port","connect_timeout","dbus_service_name","debug","default_interface","delay","delay_before_retry","delay_loop","digest","dont_track_primary","dynamic","dynamic_interfaces","enable_dbus","enable_script_security","enable_sni","enable_snmp_checker","enable_snmp_rfc","enable_snmp_rfcv2","enable_snmp_rfcv3","enable_snmp_vrrp","enable_traps","end","fall","fast_recovery","file","flag-1","flag-2","flag-3","fork_delay","full_command","fwmark","garp_group","garp_interval","garp_lower_prio_delay","garp_lower_prio_repeat","garp_master_delay","garp_master_refresh","garp_master_refresh_repeat","garp_master_repeat","global_defs","global_tracking","gna_interval","group","ha_suspend","hashed","helo_name","higher_prio_send_advert","hoplimit","http_protocol","hysteresis","idle_tx","include","inhibit_on_failure","init_fail","init_file","instance","interface","interfaces","interval","ip_family","ipvs_process_name","keepalived.conf","kernel_rx_buf_size","key","linkbeat_interfaces","linkbeat_use_polling","log_all_failures","log_unknown_vrids","lower_prio_no_advert","lthreshold","lvs_flush","lvs_flush_onstop","lvs_method","lvs_netlink_cmd_rcv_bufs","lvs_netlink_cmd_rcv_bufs_force","lvs_netlink_monitor_rcv_bufs","lvs_netlink_monitor_rcv_bufs_force","lvs_notify_fifo","lvs_notify_fifo_script","lvs_sched","lvs_sync_daemon","max_auto_priority","max_hops","mcast_src_ip","mh-fallback","mh-port","min_auto_priority_delay","min_rx","min_tx","misc_dynamic","misc_path","misc_timeout","multiplier","name","namespace_with_ipsets","native_ipv6","neighbor_ip","net_namespace","net_namespace_ipvs","nftables","nftables_counters","nftables_ifindex","nftables_priority","no_accept","no_checker_emails","no_email_faults","nopreempt","notification_email","notification_email_from","notify","notify_backup","notify_deleted","notify_down","notify_fault","notify_fifo","notify_fifo_script","notify_master","notify_master_rx_lower_pri","notify_priority_changes","notify_stop","notify_up"].join("|")+")\\b")},{pattern:RegExp("\\b(?:"+["old_unicast_checksum","omega","ops","param_match","passive","password","path","persistence_engine","persistence_granularity","persistence_timeout","preempt","preempt_delay","priority","process","process_monitor_rcv_bufs","process_monitor_rcv_bufs_force","process_name","process_names","promote_secondaries","protocol","proxy_arp","proxy_arp_pvlan","quorum","quorum_down","quorum_max","quorum_up","random_seed","real_server","regex","regex_max_offset","regex_min_offset","regex_no_match","regex_options","regex_stack","reload_time_file","reload_repeat","require_reply","retry","rise","router_id","rs_init_notifies","script","script_user","sh-fallback","sh-port","shutdown_script","shutdown_script_timeout","skip_check_adv_addr","smtp_alert","smtp_alert_checker","smtp_alert_vrrp","smtp_connect_timeout","smtp_helo_name","smtp_server","snmp_socket","sorry_server","sorry_server_inhibit","sorry_server_lvs_method","source_ip","start","startup_script","startup_script_timeout","state","static_ipaddress","static_routes","static_rules","status_code","step","strict_mode","sync_group_tracking_weight","terminate_delay","timeout","track_bfd","track_file","track_group","track_interface","track_process","track_script","track_src_ip","ttl","type","umask","unicast_peer","unicast_src_ip","unicast_ttl","url","use_ipvlan","use_pid_dir","use_vmac","user","uthreshold","val1","val2","val3","version","virtual_ipaddress","virtual_ipaddress_excluded","virtual_router_id","virtual_routes","virtual_rules","virtual_server","virtual_server fwmark","virtual_server group","virtual_server_group","virtualhost","vmac_xmit_base","vrrp","vrrp_check_unicast_src","vrrp_cpu_affinity","vrrp_garp_interval","vrrp_garp_lower_prio_delay","vrrp_garp_lower_prio_repeat","vrrp_garp_master_delay","vrrp_garp_master_refresh","vrrp_garp_master_refresh_repeat","vrrp_garp_master_repeat","vrrp_gna_interval","vrrp_higher_prio_send_advert","vrrp_instance","vrrp_ipsets","vrrp_iptables","vrrp_lower_prio_no_advert","vrrp_mcast_group4","vrrp_mcast_group6","vrrp_min_garp","vrrp_netlink_cmd_rcv_bufs","vrrp_netlink_cmd_rcv_bufs_force","vrrp_netlink_monitor_rcv_bufs","vrrp_netlink_monitor_rcv_bufs_force","vrrp_no_swap","vrrp_notify_fifo","vrrp_notify_fifo_script","vrrp_notify_priority_changes","vrrp_priority","vrrp_process_name","vrrp_rlimit_rttime","vrrp_rt_priority","vrrp_rx_bufs_multiplier","vrrp_rx_bufs_policy","vrrp_script","vrrp_skip_check_adv_addr","vrrp_startup_delay","vrrp_strict","vrrp_sync_group","vrrp_track_process","vrrp_version","warmup","weight"].join("|")+")\\b")}],constant:/\b(?:A|AAAA|AH|BACKUP|CNAME|DR|MASTER|MX|NAT|NS|PASS|SCTP|SOA|TCP|TUN|TXT|UDP|dh|fo|lblc|lblcr|lc|mh|nq|ovf|rr|sed|sh|wlc|wrr)\b/,number:{pattern:/(^|[^\w.-])-?\d+(?:\.\d+)?/,lookbehind:!0},boolean:/\b(?:false|no|off|on|true|yes)\b/,punctuation:/[\{\}]/}; \ No newline at end of file +Prism.languages.keepalived={comment:{pattern:/[#!].*/,greedy:!0},string:{pattern:/(^|[^\\])(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/,lookbehind:!0,greedy:!0},ip:{pattern:RegExp("\\b(?:(?:(?:[\\da-f]{1,4}:){7}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){6}:[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){5}:(?:[\\da-f]{1,4}:)?[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){4}:(?:[\\da-f]{1,4}:){0,2}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){3}:(?:[\\da-f]{1,4}:){0,3}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){2}:(?:[\\da-f]{1,4}:){0,4}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){6}|(?:[\\da-f]{1,4}:){0,5}:|::(?:[\\da-f]{1,4}:){0,5}|[\\da-f]{1,4}::(?:[\\da-f]{1,4}:){0,5}[\\da-f]{1,4}|::(?:[\\da-f]{1,4}:){0,6}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){1,7}:)(?:/\\d{1,3})?|(?:/\\d{1,2})?)\\b".replace(//g,function(){return"(?:(?:(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d))"}),"i"),alias:"number"},path:{pattern:/(\s)\/(?:[^\/\s]+\/)*[^\/\s]*|\b[a-zA-Z]:\\(?:[^\\\s]+\\)*[^\\\s]*/,lookbehind:!0,alias:"string"},variable:/\$\{?\w+\}?/,email:{pattern:/[\w-]+@[\w-]+(?:\.[\w-]{2,3}){1,2}/,alias:"string"},"conditional-configuration":{pattern:/@\^?[\w-]+/,alias:"variable"},operator:/=/,property:/\b(?:BFD_CHECK|DNS_CHECK|FILE_CHECK|HTTP_GET|MISC_CHECK|NAME|PING_CHECK|SCRIPTS|SMTP_CHECK|SSL|SSL_GET|TCP_CHECK|UDP_CHECK|accept|advert_int|alpha|auth_pass|auth_type|authentication|bfd_cpu_affinity|bfd_instance|bfd_no_swap|bfd_priority|bfd_process_name|bfd_rlimit_rttime|bfd_rt_priority|bind_if|bind_port|bindto|ca|certificate|check_unicast_src|checker|checker_cpu_affinity|checker_log_all_failures|checker_no_swap|checker_priority|checker_rlimit_rttime|checker_rt_priority|child_wait_time|connect_ip|connect_port|connect_timeout|dbus_service_name|debug|default_interface|delay|delay_before_retry|delay_loop|digest|dont_track_primary|dynamic|dynamic_interfaces|enable_(?:dbus|script_security|sni|snmp_checker|snmp_rfc|snmp_rfcv2|snmp_rfcv3|snmp_vrrp|traps)|end|fall|fast_recovery|file|flag-[123]|fork_delay|full_command|fwmark|garp_group|garp_interval|garp_lower_prio_delay|garp_lower_prio_repeat|garp_master_delay|garp_master_refresh|garp_master_refresh_repeat|garp_master_repeat|global_defs|global_tracking|gna_interval|group|ha_suspend|hashed|helo_name|higher_prio_send_advert|hoplimit|http_protocol|hysteresis|idle_tx|include|inhibit_on_failure|init_fail|init_file|instance|interface|interfaces|interval|ip_family|ipvs_process_name|keepalived.conf|kernel_rx_buf_size|key|linkbeat_interfaces|linkbeat_use_polling|log_all_failures|log_unknown_vrids|lower_prio_no_advert|lthreshold|lvs_flush|lvs_flush_onstop|lvs_method|lvs_netlink_cmd_rcv_bufs|lvs_netlink_cmd_rcv_bufs_force|lvs_netlink_monitor_rcv_bufs|lvs_netlink_monitor_rcv_bufs_force|lvs_notify_fifo|lvs_notify_fifo_script|lvs_sched|lvs_sync_daemon|max_auto_priority|max_hops|mcast_src_ip|mh-fallback|mh-port|min_auto_priority_delay|min_rx|min_tx|misc_dynamic|misc_path|misc_timeout|multiplier|name|namespace_with_ipsets|native_ipv6|neighbor_ip|net_namespace|net_namespace_ipvs|nftables|nftables_counters|nftables_ifindex|nftables_priority|no_accept|no_checker_emails|no_email_faults|nopreempt|notification_email|notification_email_from|notify|notify_backup|notify_deleted|notify_down|notify_fault|notify_fifo|notify_fifo_script|notify_master|notify_master_rx_lower_pri|notify_priority_changes|notify_stop|notify_up|old_unicast_checksum|omega|ops|param_match|passive|password|path|persistence_engine|persistence_granularity|persistence_timeout|preempt|preempt_delay|priority|process|process_monitor_rcv_bufs|process_monitor_rcv_bufs_force|process_name|process_names|promote_secondaries|protocol|proxy_arp|proxy_arp_pvlan|quorum|quorum_down|quorum_max|quorum_up|random_seed|real_server|regex|regex_max_offset|regex_min_offset|regex_no_match|regex_options|regex_stack|reload_repeat|reload_time_file|require_reply|retry|rise|router_id|rs_init_notifies|script|script_user|sh-fallback|sh-port|shutdown_script|shutdown_script_timeout|skip_check_adv_addr|smtp_alert|smtp_alert_checker|smtp_alert_vrrp|smtp_connect_timeout|smtp_helo_name|smtp_server|snmp_socket|sorry_server|sorry_server_inhibit|sorry_server_lvs_method|source_ip|start|startup_script|startup_script_timeout|state|static_ipaddress|static_routes|static_rules|status_code|step|strict_mode|sync_group_tracking_weight|terminate_delay|timeout|track_bfd|track_file|track_group|track_interface|track_process|track_script|track_src_ip|ttl|type|umask|unicast_peer|unicast_src_ip|unicast_ttl|url|use_ipvlan|use_pid_dir|use_vmac|user|uthreshold|val[123]|version|virtual_ipaddress|virtual_ipaddress_excluded|virtual_router_id|virtual_routes|virtual_rules|virtual_server|virtual_server_group|virtualhost|vmac_xmit_base|vrrp|vrrp_(?:check_unicast_src|cpu_affinity|garp_interval|garp_lower_prio_delay|garp_lower_prio_repeat|garp_master_delay|garp_master_refresh|garp_master_refresh_repeat|garp_master_repeat|gna_interval|higher_prio_send_advert|instance|ipsets|iptables|lower_prio_no_advert|mcast_group4|mcast_group6|min_garp|netlink_cmd_rcv_bufs|netlink_cmd_rcv_bufs_force|netlink_monitor_rcv_bufs|netlink_monitor_rcv_bufs_force|no_swap|notify_fifo|notify_fifo_script|notify_priority_changes|priority|process_name|rlimit_rttime|rt_priority|rx_bufs_multiplier|rx_bufs_policy|script|skip_check_adv_addr|startup_delay|strict|sync_group|track_process|version)|warmup|weight)\b/,constant:/\b(?:A|AAAA|AH|BACKUP|CNAME|DR|MASTER|MX|NAT|NS|PASS|SCTP|SOA|TCP|TUN|TXT|UDP|dh|fo|lblc|lblcr|lc|mh|nq|ovf|rr|sed|sh|wlc|wrr)\b/,number:{pattern:/(^|[^\w.-])-?\d+(?:\.\d+)?/,lookbehind:!0},boolean:/\b(?:false|no|off|on|true|yes)\b/,punctuation:/[\{\}]/}; \ No newline at end of file From e8194b106baac5d1edfb71dca949fd68e5145441 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Sun, 3 Oct 2021 16:35:41 +0200 Subject: [PATCH 23/23] Sorted languages list --- components.js | 2 +- components.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components.js b/components.js index db630e806e..41d90e7ed3 100644 --- a/components.js +++ b/components.js @@ -1,2 +1,2 @@ -var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","optional":"regex","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"ABNF","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"agda":{"title":"Agda","owner":"xy-ren"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apex":{"title":"Apex","require":["clike","sql"],"owner":"RunDevelopment"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"dkern"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"avisynth":{"title":"AviSynth","alias":"avs","owner":"Zinfidel"},"avro-idl":{"title":"Avro IDL","alias":"avdl","owner":"RunDevelopment"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bicep":{"title":"Bicep","owner":"johnnyreilly"},"birb":{"title":"Birb","require":"clike","owner":"Calamity210"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"BNF","alias":"rbnf","aliasTitles":{"rbnf":"RBNF"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"bsl":{"title":"BSL (1C:Enterprise)","alias":"oscript","aliasTitles":{"oscript":"OneScript"},"owner":"Diversus23"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cfscript":{"title":"CFScript","require":"clike","alias":"cfc","owner":"mjclemente"},"chaiscript":{"title":"ChaiScript","require":["clike","cpp"],"owner":"RunDevelopment"},"cil":{"title":"CIL","owner":"sbrl"},"clojure":{"title":"Clojure","owner":"troglotit"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"cobol":{"title":"COBOL","owner":"RunDevelopment"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"coq":{"title":"Coq","owner":"RunDevelopment"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"csv":{"title":"CSV","owner":"RunDevelopment"},"cypher":{"title":"Cypher","owner":"RunDevelopment"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dataweave":{"title":"DataWeave","owner":"machaval"},"dax":{"title":"DAX","owner":"peterbud"},"dhall":{"title":"Dhall","owner":"RunDevelopment"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"dot":{"title":"DOT (Graphviz)","alias":"gv","optional":"markup","owner":"RunDevelopment"},"ebnf":{"title":"EBNF","owner":"RunDevelopment"},"editorconfig":{"title":"EditorConfig","owner":"osipxd"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"false":{"title":"False","owner":"edukisto"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"gap":{"title":"GAP (CAS)","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gn":{"title":"GN","alias":"gni","owner":"RunDevelopment"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","optional":"markdown","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","alias":"hbs","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"hoon":{"title":"Hoon","owner":"matildepark"},"http":{"title":"HTTP","optional":["css","javascript","json","markup","uri"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"icu-message-format":{"title":"ICU Message Format","owner":"RunDevelopment"},"idris":{"title":"Idris","alias":"idr","owner":"KeenS","require":"haskell"},"ignore":{"title":".ignore","owner":"osipxd","alias":["gitignore","hgignore","npmignore"],"aliasTitles":{"gitignore":".gitignore","hgignore":".hgignore","npmignore":".npmignore"}},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jexl":{"title":"Jexl","owner":"czosel"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike","typescript"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"jsstacktrace":{"title":"JS stack trace","owner":"sbrl"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup","sql"],"owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"keepalived":{"title":"Keepalived Configure","owner":"dev-itsheng"},"kotlin":{"title":"Kotlin","alias":["kt","kts"],"aliasTitles":{"kts":"Kotlin Script"},"require":"clike","owner":"Golmote"},"kumir":{"title":"KuMir (КуМир)","alias":"kum","owner":"edukisto"},"kusto":{"title":"Kusto","owner":"RunDevelopment"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","require":"markup-templating","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"log":{"title":"Log file","optional":"javastacktrace","owner":"RunDevelopment"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"magma":{"title":"Magma (CAS)","owner":"RunDevelopment"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","optional":"yaml","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"maxscript":{"title":"MAXScript","owner":"RunDevelopment"},"mel":{"title":"MEL","owner":"Golmote"},"mermaid":{"title":"Mermaid","owner":"RunDevelopment"},"mizar":{"title":"Mizar","owner":"Golmote"},"mongodb":{"title":"MongoDB","owner":"airs0urce","require":"javascript"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"naniscript":{"title":"Naninovel Script","owner":"Elringus","alias":"nani"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nevod":{"title":"Nevod","owner":"nezaboodka"},"nginx":{"title":"nginx","owner":"volado"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"openqasm":{"title":"OpenQasm","alias":"qasm","owner":"RunDevelopment"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"psl":{"title":"PATROL Scripting Language","owner":"bertysentry"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":"markup-templating","owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"promql":{"title":"PromQL","owner":"arendjr"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"purescript":{"title":"PureScript","require":"haskell","alias":"purs","owner":"sriharshachilakapati"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"qsharp":{"title":"Q#","require":"clike","alias":"qs","owner":"fedonman"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"cshtml":{"title":"Razor C#","alias":"razor","require":["markup","csharp"],"optional":["css","css-extras","javascript","js-extras"],"owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","owner":"RunDevelopment"},"rego":{"title":"Rego","owner":"JordanSh"},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","optional":"css-extras","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","alias":["sh-session","shellsession"],"owner":"RunDevelopment"},"smali":{"title":"Smali","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"sml":{"title":"SML","alias":"smlnj","aliasTitles":{"smlnj":"SML/NJ"},"owner":"RunDevelopment"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"squirrel":{"title":"Squirrel","require":"clike","owner":"RunDevelopment"},"stan":{"title":"Stan","owner":"RunDevelopment"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","owner":"chrischares"},"systemd":{"title":"Systemd configuration file","owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tremor":{"title":"Tremor","alias":["trickle","troy"],"owner":"darach","aliasTitles":{"trickle":"trickle","troy":"troy"}},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"typoscript":{"title":"TypoScript","alias":"tsconfig","aliasTitles":{"tsconfig":"TSConfig"},"owner":"dkern"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"uri":{"title":"URI","alias":"url","aliasTitles":{"url":"URL"},"owner":"RunDevelopment"},"v":{"title":"V","require":"clike","owner":"taggon"},"vala":{"title":"Vala","require":"clike","optional":"regex","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":["vb","vba"],"aliasTitles":{"vba":"VBA"},"owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"wolfram":{"title":"Wolfram language","alias":["mathematica","nb","wl"],"aliasTitles":{"mathematica":"Mathematica","nb":"Mathematica Notebook"},"owner":"msollami"},"wren":{"title":"Wren","owner":"clsource"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"yang":{"title":"YANG","owner":"RunDevelopment"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword for fine-grained highlighting.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}}; +var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","optional":"regex","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"ABNF","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"agda":{"title":"Agda","owner":"xy-ren"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apex":{"title":"Apex","require":["clike","sql"],"owner":"RunDevelopment"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"dkern"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"avisynth":{"title":"AviSynth","alias":"avs","owner":"Zinfidel"},"avro-idl":{"title":"Avro IDL","alias":"avdl","owner":"RunDevelopment"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bicep":{"title":"Bicep","owner":"johnnyreilly"},"birb":{"title":"Birb","require":"clike","owner":"Calamity210"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"BNF","alias":"rbnf","aliasTitles":{"rbnf":"RBNF"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"bsl":{"title":"BSL (1C:Enterprise)","alias":"oscript","aliasTitles":{"oscript":"OneScript"},"owner":"Diversus23"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cfscript":{"title":"CFScript","require":"clike","alias":"cfc","owner":"mjclemente"},"chaiscript":{"title":"ChaiScript","require":["clike","cpp"],"owner":"RunDevelopment"},"cil":{"title":"CIL","owner":"sbrl"},"clojure":{"title":"Clojure","owner":"troglotit"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"cobol":{"title":"COBOL","owner":"RunDevelopment"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"coq":{"title":"Coq","owner":"RunDevelopment"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"csv":{"title":"CSV","owner":"RunDevelopment"},"cypher":{"title":"Cypher","owner":"RunDevelopment"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dataweave":{"title":"DataWeave","owner":"machaval"},"dax":{"title":"DAX","owner":"peterbud"},"dhall":{"title":"Dhall","owner":"RunDevelopment"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"dot":{"title":"DOT (Graphviz)","alias":"gv","optional":"markup","owner":"RunDevelopment"},"ebnf":{"title":"EBNF","owner":"RunDevelopment"},"editorconfig":{"title":"EditorConfig","owner":"osipxd"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"false":{"title":"False","owner":"edukisto"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"gap":{"title":"GAP (CAS)","owner":"RunDevelopment"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gn":{"title":"GN","alias":"gni","owner":"RunDevelopment"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","optional":"markdown","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","alias":"hbs","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"hoon":{"title":"Hoon","owner":"matildepark"},"http":{"title":"HTTP","optional":["css","javascript","json","markup","uri"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"icu-message-format":{"title":"ICU Message Format","owner":"RunDevelopment"},"idris":{"title":"Idris","alias":"idr","owner":"KeenS","require":"haskell"},"ignore":{"title":".ignore","owner":"osipxd","alias":["gitignore","hgignore","npmignore"],"aliasTitles":{"gitignore":".gitignore","hgignore":".hgignore","npmignore":".npmignore"}},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jexl":{"title":"Jexl","owner":"czosel"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike","typescript"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"jsstacktrace":{"title":"JS stack trace","owner":"sbrl"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup","sql"],"owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keepalived":{"title":"Keepalived Configure","owner":"dev-itsheng"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","alias":["kt","kts"],"aliasTitles":{"kts":"Kotlin Script"},"require":"clike","owner":"Golmote"},"kumir":{"title":"KuMir (КуМир)","alias":"kum","owner":"edukisto"},"kusto":{"title":"Kusto","owner":"RunDevelopment"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","require":"markup-templating","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"log":{"title":"Log file","optional":"javastacktrace","owner":"RunDevelopment"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"magma":{"title":"Magma (CAS)","owner":"RunDevelopment"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","optional":"yaml","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"maxscript":{"title":"MAXScript","owner":"RunDevelopment"},"mel":{"title":"MEL","owner":"Golmote"},"mermaid":{"title":"Mermaid","owner":"RunDevelopment"},"mizar":{"title":"Mizar","owner":"Golmote"},"mongodb":{"title":"MongoDB","owner":"airs0urce","require":"javascript"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"naniscript":{"title":"Naninovel Script","owner":"Elringus","alias":"nani"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nevod":{"title":"Nevod","owner":"nezaboodka"},"nginx":{"title":"nginx","owner":"volado"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"openqasm":{"title":"OpenQasm","alias":"qasm","owner":"RunDevelopment"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"psl":{"title":"PATROL Scripting Language","owner":"bertysentry"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":"markup-templating","owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"promql":{"title":"PromQL","owner":"arendjr"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"purescript":{"title":"PureScript","require":"haskell","alias":"purs","owner":"sriharshachilakapati"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"qsharp":{"title":"Q#","require":"clike","alias":"qs","owner":"fedonman"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"cshtml":{"title":"Razor C#","alias":"razor","require":["markup","csharp"],"optional":["css","css-extras","javascript","js-extras"],"owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","owner":"RunDevelopment"},"rego":{"title":"Rego","owner":"JordanSh"},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","optional":"css-extras","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","alias":["sh-session","shellsession"],"owner":"RunDevelopment"},"smali":{"title":"Smali","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"sml":{"title":"SML","alias":"smlnj","aliasTitles":{"smlnj":"SML/NJ"},"owner":"RunDevelopment"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"squirrel":{"title":"Squirrel","require":"clike","owner":"RunDevelopment"},"stan":{"title":"Stan","owner":"RunDevelopment"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","owner":"chrischares"},"systemd":{"title":"Systemd configuration file","owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"tremor":{"title":"Tremor","alias":["trickle","troy"],"owner":"darach","aliasTitles":{"trickle":"trickle","troy":"troy"}},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"typoscript":{"title":"TypoScript","alias":"tsconfig","aliasTitles":{"tsconfig":"TSConfig"},"owner":"dkern"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"uri":{"title":"URI","alias":"url","aliasTitles":{"url":"URL"},"owner":"RunDevelopment"},"v":{"title":"V","require":"clike","owner":"taggon"},"vala":{"title":"Vala","require":"clike","optional":"regex","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":["vb","vba"],"aliasTitles":{"vba":"VBA"},"owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"wolfram":{"title":"Wolfram language","alias":["mathematica","nb","wl"],"aliasTitles":{"mathematica":"Mathematica","nb":"Mathematica Notebook"},"owner":"msollami"},"wren":{"title":"Wren","owner":"clsource"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"yang":{"title":"YANG","owner":"RunDevelopment"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword for fine-grained highlighting.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}}; if (typeof module !== 'undefined' && module.exports) { module.exports = components; } \ No newline at end of file diff --git a/components.json b/components.json index 8471eb3c6e..906491e4a7 100644 --- a/components.json +++ b/components.json @@ -713,14 +713,14 @@ "title": "Julia", "owner": "cdagnino" }, - "keyman": { - "title": "Keyman", - "owner": "mcdurdin" - }, "keepalived": { "title": "Keepalived Configure", "owner": "dev-itsheng" }, + "keyman": { + "title": "Keyman", + "owner": "mcdurdin" + }, "kotlin": { "title": "Kotlin", "alias": ["kt", "kts"],