From 2eb89e15f7147118421b97d67295b6d70fe88471 Mon Sep 17 00:00:00 2001 From: Wei Ting <59229084+hoonweiting@users.noreply.github.com> Date: Mon, 24 Jan 2022 19:23:28 +0800 Subject: [PATCH] Swap out `operator` for `punctuation` (#3306) --- components/prism-systemd.js | 2 +- components/prism-systemd.min.js | 2 +- tests/languages/systemd/boolean_feature.test | 12 ++++++------ tests/languages/systemd/key_feature.test | 4 ++-- tests/languages/systemd/value_feature.test | 10 +++++----- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/components/prism-systemd.js b/components/prism-systemd.js index 1c48bfe7ed..40204dd745 100644 --- a/components/prism-systemd.js +++ b/components/prism-systemd.js @@ -68,7 +68,7 @@ } }, - 'operator': /=/ + 'punctuation': /=/ }; }(Prism)); diff --git a/components/prism-systemd.min.js b/components/prism-systemd.min.js index 694cc4fbbc..8c192ef7e2 100644 --- a/components/prism-systemd.min.js +++ b/components/prism-systemd.min.js @@ -1 +1 @@ -!function(e){var t={pattern:/^[;#].*/m,greedy:!0},n='"(?:[^\r\n"\\\\]|\\\\(?:[^\r]|\r\n?))*"(?!\\S)';Prism.languages.systemd={comment:t,section:{pattern:/^\[[^\n\r\[\]]*\](?=[ \t]*$)/m,greedy:!0,inside:{punctuation:/^\[|\]$/,"section-name":{pattern:/[\s\S]+/,alias:"selector"}}},key:{pattern:/^[^\s=]+(?=[ \t]*=)/m,greedy:!0,alias:"attr-name"},value:{pattern:RegExp("(=[ \t]*(?!\\s))(?:"+n+'|(?=[^"\r\n]))(?:[^\\s\\\\]|[ \t]+(?:(?![ \t"])|'+n+")|\\\\[\r\n]+(?:[#;].*[\r\n]+)*(?![#;]))*"),lookbehind:!0,greedy:!0,alias:"attr-value",inside:{comment:t,quoted:{pattern:RegExp("(^|\\s)"+n),lookbehind:!0,greedy:!0},punctuation:/\\$/m,boolean:{pattern:/^(?:false|no|off|on|true|yes)$/,greedy:!0}}},operator:/=/}}(); \ No newline at end of file +!function(e){var t={pattern:/^[;#].*/m,greedy:!0},n='"(?:[^\r\n"\\\\]|\\\\(?:[^\r]|\r\n?))*"(?!\\S)';Prism.languages.systemd={comment:t,section:{pattern:/^\[[^\n\r\[\]]*\](?=[ \t]*$)/m,greedy:!0,inside:{punctuation:/^\[|\]$/,"section-name":{pattern:/[\s\S]+/,alias:"selector"}}},key:{pattern:/^[^\s=]+(?=[ \t]*=)/m,greedy:!0,alias:"attr-name"},value:{pattern:RegExp("(=[ \t]*(?!\\s))(?:"+n+'|(?=[^"\r\n]))(?:[^\\s\\\\]|[ \t]+(?:(?![ \t"])|'+n+")|\\\\[\r\n]+(?:[#;].*[\r\n]+)*(?![#;]))*"),lookbehind:!0,greedy:!0,alias:"attr-value",inside:{comment:t,quoted:{pattern:RegExp("(^|\\s)"+n),lookbehind:!0,greedy:!0},punctuation:/\\$/m,boolean:{pattern:/^(?:false|no|off|on|true|yes)$/,greedy:!0}}},punctuation:/=/}}(); \ No newline at end of file diff --git a/tests/languages/systemd/boolean_feature.test b/tests/languages/systemd/boolean_feature.test index a260308560..743dd8e1f1 100644 --- a/tests/languages/systemd/boolean_feature.test +++ b/tests/languages/systemd/boolean_feature.test @@ -9,37 +9,37 @@ foo=no [ ["key", "foo"], - ["operator", "="], + ["punctuation", "="], ["value", [ ["boolean", "on"] ]], ["key", "foo"], - ["operator", "="], + ["punctuation", "="], ["value", [ ["boolean", "true"] ]], ["key", "foo"], - ["operator", "="], + ["punctuation", "="], ["value", [ ["boolean", "yes"] ]], ["key", "foo"], - ["operator", "="], + ["punctuation", "="], ["value", [ ["boolean", "off"] ]], ["key", "foo"], - ["operator", "="], + ["punctuation", "="], ["value", [ ["boolean", "false"] ]], ["key", "foo"], - ["operator", "="], + ["punctuation", "="], ["value", [ ["boolean", "no"] ]] diff --git a/tests/languages/systemd/key_feature.test b/tests/languages/systemd/key_feature.test index cf3ffab4d6..92d95c27fc 100644 --- a/tests/languages/systemd/key_feature.test +++ b/tests/languages/systemd/key_feature.test @@ -4,6 +4,6 @@ foo = ---------------------------------------------------- [ - ["key", "foo"], ["operator", "="], - ["key", "foo"], ["operator", "="] + ["key", "foo"], ["punctuation", "="], + ["key", "foo"], ["punctuation", "="] ] diff --git a/tests/languages/systemd/value_feature.test b/tests/languages/systemd/value_feature.test index acdac052b1..aa9bac655c 100644 --- a/tests/languages/systemd/value_feature.test +++ b/tests/languages/systemd/value_feature.test @@ -13,10 +13,10 @@ foo=value 3\ ---------------------------------------------------- [ - ["key", "foo"], ["operator", "="], ["value", ["value 2"]], + ["key", "foo"], ["punctuation", "="], ["value", ["value 2"]], ["key", "foo"], - ["operator", "="], + ["punctuation", "="], ["value", [ ["quoted", "\"something\""], ["quoted", "\"some thing\""], @@ -24,7 +24,7 @@ foo=value 3\ ]], ["key", "foo"], - ["operator", "="], + ["punctuation", "="], ["value", [ ["quoted", "\"something\""], ["quoted", "\"some thing\""], @@ -32,14 +32,14 @@ foo=value 3\ ]], ["key", "foo"], - ["operator", "="], + ["punctuation", "="], ["value", [ "value 2 ", ["punctuation", "\\"], "\r\n value 2 continued" ]], ["key", "foo"], - ["operator", "="], + ["punctuation", "="], ["value", [ "value 3", ["punctuation", "\\"], ["comment", "# this line is ignored"],