Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axil@gitlab.com>2020-12-04 17:29:14 +0300
committerAchilleas Pipinellis <axil@gitlab.com>2020-12-04 17:29:14 +0300
commit4c183dee303cbe1264febf5660c79bbe046e13b9 (patch)
tree52ed6c539a585594fbfcfe39a619cbce9858d630
parentc6edca9c06c23acfd0040aba4cffbc59a4043c57 (diff)
Add option to use WARNING in alerts
This is a drop-in replacement of CAUTION, and they can be used interchangeably.
-rw-r--r--lib/filters/admonition.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/filters/admonition.rb b/lib/filters/admonition.rb
index 0cb288fa..8952f7cf 100644
--- a/lib/filters/admonition.rb
+++ b/lib/filters/admonition.rb
@@ -6,6 +6,7 @@ class AdmonitionFilter < Nanoc::Filter
'tip' => 'success',
'note' => 'info',
'caution' => 'warning',
+ 'warning' => 'warning',
'danger' => 'danger'
}.freeze
@@ -13,6 +14,7 @@ class AdmonitionFilter < Nanoc::Filter
'tip' => 'bulb',
'note' => 'information-o',
'caution' => 'warning',
+ 'warning' => 'warning',
'danger' => 'warning'
}.freeze
@@ -22,7 +24,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>TIP|NOTE|CAUTION|DANGER):\s?(?<content>.*)\Z/m)
+ match = content.match(/\A(?<type>TIP|NOTE|CAUTION|WARNING|DANGER):\s?(?<content>.*)\Z/m)
next unless match
new_content = generate(match[:type].downcase, match[:content])