From deb3a97f61fb4811337ab44a13ee93fb5f54af70 Mon Sep 17 00:00:00 2001 From: Wei Ting <59229084+hoonweiting@users.noreply.github.com> Date: Mon, 24 Jan 2022 20:21:53 +0800 Subject: [PATCH] INI: Swap out `header` for `section` (#3304) --- components/prism-ini.js | 2 +- components/prism-ini.min.js | 2 +- ...ader_feature.test => section_feature.test} | 24 +++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) rename tests/languages/ini/{header_feature.test => section_feature.test} (84%) diff --git a/components/prism-ini.js b/components/prism-ini.js index 3e261d3f1e..4a40140c4a 100644 --- a/components/prism-ini.js +++ b/components/prism-ini.js @@ -10,7 +10,7 @@ Prism.languages.ini = { pattern: /(^[ \f\t\v]*)[#;][^\n\r]*/m, lookbehind: true }, - 'header': { + 'section': { pattern: /(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m, lookbehind: true, inside: { diff --git a/components/prism-ini.min.js b/components/prism-ini.min.js index a4e2d8e09b..7e16e987bd 100644 --- a/components/prism-ini.min.js +++ b/components/prism-ini.min.js @@ -1 +1 @@ -Prism.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},header:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/}; \ No newline at end of file +Prism.languages.ini={comment:{pattern:/(^[ \f\t\v]*)[#;][^\n\r]*/m,lookbehind:!0},section:{pattern:/(^[ \f\t\v]*)\[[^\n\r\]]*\]?/m,lookbehind:!0,inside:{"section-name":{pattern:/(^\[[ \f\t\v]*)[^ \f\t\v\]]+(?:[ \f\t\v]+[^ \f\t\v\]]+)*/,lookbehind:!0,alias:"selector"},punctuation:/\[|\]/}},key:{pattern:/(^[ \f\t\v]*)[^ \f\n\r\t\v=]+(?:[ \f\t\v]+[^ \f\n\r\t\v=]+)*(?=[ \f\t\v]*=)/m,lookbehind:!0,alias:"attr-name"},value:{pattern:/(=[ \f\t\v]*)[^ \f\n\r\t\v]+(?:[ \f\t\v]+[^ \f\n\r\t\v]+)*/,lookbehind:!0,alias:"attr-value",inside:{"inner-value":{pattern:/^("|').+(?=\1$)/,lookbehind:!0}}},punctuation:/=/}; \ No newline at end of file diff --git a/tests/languages/ini/header_feature.test b/tests/languages/ini/section_feature.test similarity index 84% rename from tests/languages/ini/header_feature.test rename to tests/languages/ini/section_feature.test index 9f0df51ac4..386ec3139e 100644 --- a/tests/languages/ini/header_feature.test +++ b/tests/languages/ini/section_feature.test @@ -13,66 +13,66 @@ ---------------------------------------------------- [ - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "foo1"], ["punctuation", "]"] ]], - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "\"foo2\""], ["punctuation", "]"] ]], - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "foo3"], ["punctuation", "]"] ]], - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "\" foo4 \""], ["punctuation", "]"] ]], - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "\"foo5 bar5\""], ["punctuation", "]"] ]], - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "\"foo6\""], ["punctuation", "]"] ]], - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "foo7"] ]], - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "foo8 bar8"], ["punctuation", "]"] ]], - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "foo9[bar9"], ["punctuation", "]"] ]], - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "foo10"], ["punctuation", "]"] ]], - ["header", [ + ["section", [ ["punctuation", "["], ["section-name", "foo11"], ["punctuation", "]"] @@ -83,4 +83,4 @@ ---------------------------------------------------- -Checks for headers (and section names). +Checks for sections (and section names).