diff --git a/README.md b/README.md index 57fa5cfb4c8e18eeabcebad7ab24d3123f6cdff2..a75100562f3d0a081b1d5bcebb79233fe1ed40f4 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,10 @@ For details refer to [the documentation of ruby gems](https://guides.rubygems.or ## Changelog +### 0.2.19 +Added `alert` and `alert_header` blocks. +To use: `{% alert info %}{% alert_header %}Header{% endalert_header %}Content{% endalert %}` or `{% alert warning %}{% alert_header %}Header{% endalert_header %}Content{% endalert %}` + ### 0.2.18 * Corrected placement of R3 logo in the footer on mobile diff --git a/_plugins/alert.rb b/_plugins/alert.rb new file mode 100644 index 0000000000000000000000000000000000000000..72a968ae29bb114d02165604127dc51762f0a23a --- /dev/null +++ b/_plugins/alert.rb @@ -0,0 +1,24 @@ +module Jekyll + module Tags + class AlertTag < Liquid::Block + def initialize(tag_name, block_options, liquid_options) + super + @class = block_options.strip + end + + def render(context) + context.stack do + context["class"] = @class + @content = super + end + output = <<~EOS + <div class="alert #{@class}"> + #{@content} + </div> + EOS + end + end + end +end + +Liquid::Template.register_tag('alert', Jekyll::Tags::AlertTag) \ No newline at end of file diff --git a/_plugins/alert_header.rb b/_plugins/alert_header.rb new file mode 100644 index 0000000000000000000000000000000000000000..2f1617d975e1a9d082aa8d176ff189de8f11784f --- /dev/null +++ b/_plugins/alert_header.rb @@ -0,0 +1,18 @@ +module Jekyll + module Tags + class AlertHeaderTag < Liquid::Block + def initialize(tag_name, block_options, liquid_options) + super + end + + def render(context) + context.stack do + @content = super + end + output = "<h3>#{@content}</h3>" + end + end + end +end + +Liquid::Template.register_tag('alert_header', Jekyll::Tags::AlertHeaderTag) \ No newline at end of file diff --git a/_sass/minima/_lcsb.scss b/_sass/minima/_lcsb.scss index 7ec1390aa196e41b5420fad0b2270b8ba0f4d8c6..f88e74025e9a241b35ae7a418fcb8c347400eb3a 100644 --- a/_sass/minima/_lcsb.scss +++ b/_sass/minima/_lcsb.scss @@ -10,6 +10,31 @@ height: 50px; } +div.alert { + padding: .75rem 1.25rem; + border: 1px solid transparent; + border-radius: 3px; + margin: 10px; + font-weight: 300; +} + +div.alert > h3 { + font-weight: 600; + margin-bottom: 3px +} + +div.alert.warning { + border-color: #feedbb; + background-color: #fef5cf; + color: #846102; +} + +div.alert.info { + border-color: #baeeff; + background-color: #c3e5ff; + color: #045689; +} + // Normal (desktop) ======================================================== .img-uni-lu { bottom: -2px; diff --git a/jekyll-theme-lcsb-default.gemspec b/jekyll-theme-lcsb-default.gemspec index 65eef0367a5162e8dde431e3d5b6b154ae50547b..dd127efebdcbb69e8e4a9fec9624faed52a53e03 100644 --- a/jekyll-theme-lcsb-default.gemspec +++ b/jekyll-theme-lcsb-default.gemspec @@ -2,7 +2,7 @@ Gem::Specification.new do |spec| spec.name = "jekyll-theme-lcsb-default" - spec.version = "0.2.18" + spec.version = "0.2.19" spec.authors = ["Trefex", "jaceklebioda_lux"] spec.email = ["lcsb-sysadmins@uni.lu"]