From baf6bb0c2f6db49a1cf683dce36a210ed9efefd9 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Wed, 13 Feb 2019 20:31:50 +0100 Subject: [PATCH] Add support for # comments to INI language (#1730) This PR resolved #1729. Disclaimer: # comments are only supported by [some implementation](https://en.wikipedia.org/wiki/INI_file). --- components/prism-ini.js | 4 ++-- components/prism-ini.min.js | 2 +- tests/languages/ini/comment_feature.test | 6 ++++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/components/prism-ini.js b/components/prism-ini.js index 6747ad6c2a..c7b45a8ba4 100644 --- a/components/prism-ini.js +++ b/components/prism-ini.js @@ -1,5 +1,5 @@ Prism.languages.ini= { - 'comment': /^[ \t]*;.*$/m, + 'comment': /^[ \t]*[;#].*$/m, 'selector': /^[ \t]*\[.*?\]/m, 'constant': /^[ \t]*[^\s=]+?(?=[ \t]*=)/m, 'attr-value': { @@ -8,4 +8,4 @@ Prism.languages.ini= { 'punctuation': /^[=]/ } } -}; \ No newline at end of file +}; diff --git a/components/prism-ini.min.js b/components/prism-ini.min.js index bcc3c466ef..620cdb55b4 100644 --- a/components/prism-ini.min.js +++ b/components/prism-ini.min.js @@ -1 +1 @@ -Prism.languages.ini={comment:/^[ \t]*;.*$/m,selector:/^[ \t]*\[.*?\]/m,constant:/^[ \t]*[^\s=]+?(?=[ \t]*=)/m,"attr-value":{pattern:/=.*/,inside:{punctuation:/^[=]/}}}; \ No newline at end of file +Prism.languages.ini={comment:/^[ \t]*[;#].*$/m,selector:/^[ \t]*\[.*?\]/m,constant:/^[ \t]*[^\s=]+?(?=[ \t]*=)/m,"attr-value":{pattern:/=.*/,inside:{punctuation:/^[=]/}}}; \ No newline at end of file diff --git a/tests/languages/ini/comment_feature.test b/tests/languages/ini/comment_feature.test index 85faefe78b..30e373c63a 100644 --- a/tests/languages/ini/comment_feature.test +++ b/tests/languages/ini/comment_feature.test @@ -1,13 +1,15 @@ ; ; foobar +# foobar ---------------------------------------------------- [ ["comment", ";"], - ["comment", "; foobar"] + ["comment", "; foobar"], + ["comment", "# foobar"] ] ---------------------------------------------------- -Checks for comments. \ No newline at end of file +Checks for comments.