diff options
author | Suzanne Selhorn <sselhorn@gitlab.com> | 2021-08-04 16:46:16 +0300 |
---|---|---|
committer | Craig Norris <cnorris@gitlab.com> | 2021-08-04 16:46:16 +0300 |
commit | 81aa474b8ccca6cee84177423591c25a17cbf7d1 (patch) | |
tree | 530366ce09a704075dfc02208f29dcb25382e1e2 /lib | |
parent | 3e20646657e6be706ff54c9702f5755b4bc45c13 (diff) |
Add alert for FLAG
Diffstat (limited to 'lib')
-rw-r--r-- | lib/filters/admonition.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/filters/admonition.rb b/lib/filters/admonition.rb index e48688ac..b5040bbf 100644 --- a/lib/filters/admonition.rb +++ b/lib/filters/admonition.rb @@ -4,12 +4,14 @@ class AdmonitionFilter < Nanoc::Filter BOOTSTRAP_MAPPING = { 'note' => 'info', - 'warning' => 'warning' + 'warning' => 'warning', + 'flag' => 'flag' }.freeze GITLAB_SVGS_MAPPING = { 'note' => 'information-o', - 'warning' => 'warning' + 'warning' => 'warning', + 'flag' => 'flag' }.freeze def run(content, params = {}) @@ -18,7 +20,7 @@ class AdmonitionFilter < Nanoc::Filter doc = Nokogiri::HTML.fragment(content.dup) doc.css('p').each do |para| content = para.inner_html - match = content.match(/\A(?<type>NOTE|WARNING):\s?(?<content>.*)\Z/m) + match = content.match(/\A(?<type>NOTE|WARNING|FLAG):\s?(?<content>.*)\Z/m) next unless match new_content = generate(match[:type].downcase, match[:content]) |