From 22691ec975fb1ad2c479363d2ce20d8c73a6832b Mon Sep 17 00:00:00 2001 From: Wei Ting Date: Sat, 22 Jan 2022 04:29:33 +0800 Subject: [PATCH 1/3] Swap out `header` for `section` --- components/prism-ini.js | 2 +- components/prism-ini.min.js | 2 +- ...ader_feature.test => section_feature.test} | 26 +++++++++---------- 3 files changed, 15 insertions(+), 15 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..c8a948caea 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:/=/}; 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..f59a76141b 100644 --- a/tests/languages/ini/header_feature.test +++ b/tests/languages/ini/section_feature.test @@ -1,4 +1,4 @@ - [foo1] +[foo1] [ "foo2" ] [ foo3 ] [" foo4 "] @@ -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). From 802e88ad213165552c83756bd0edb393906273ac Mon Sep 17 00:00:00 2001 From: Wei Ting Date: Sat, 22 Jan 2022 04:49:41 +0800 Subject: [PATCH 2/3] Rebuild Prism --- components/prism-ini.min.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/prism-ini.min.js b/components/prism-ini.min.js index c8a948caea..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},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:/=/}; +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 From 9adab01f90b16cb828cf9dcac6375e5b7a56f2b7 Mon Sep 17 00:00:00 2001 From: Wei Ting Date: Mon, 24 Jan 2022 20:14:43 +0800 Subject: [PATCH 3/3] Revert spacing around first test in `section_feature.test` --- tests/languages/ini/section_feature.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/languages/ini/section_feature.test b/tests/languages/ini/section_feature.test index f59a76141b..386ec3139e 100644 --- a/tests/languages/ini/section_feature.test +++ b/tests/languages/ini/section_feature.test @@ -1,4 +1,4 @@ -[foo1] + [foo1] [ "foo2" ] [ foo3 ] [" foo4 "]