From 082571610c7e147c53f31d945be552aa5d01dd6c Mon Sep 17 00:00:00 2001 From: Jacek Lebioda <jacek.lebioda@uni.lu> Date: Fri, 6 Dec 2019 13:52:21 +0100 Subject: [PATCH] Resolve "Make theme's plugins available to the website" --- Gemfile | 15 ++++++--- _config.yml | 1 + _plugins/alert.rb | 24 -------------- _plugins/alert_header.rb | 18 ----------- _plugins/manual-markdown.rb | 13 -------- _plugins/rblock.rb | 54 ------------------------------- _plugins/rgridblock.rb | 29 ----------------- _plugins/rtitle.rb | 27 ---------------- development.md | 16 +++------ jekyll-theme-lcsb-default.gemspec | 2 +- 10 files changed, 17 insertions(+), 182 deletions(-) delete mode 100644 _plugins/alert.rb delete mode 100644 _plugins/alert_header.rb delete mode 100644 _plugins/manual-markdown.rb delete mode 100644 _plugins/rblock.rb delete mode 100644 _plugins/rgridblock.rb delete mode 100644 _plugins/rtitle.rb diff --git a/Gemfile b/Gemfile index b8cc664..918061b 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,19 @@ # frozen_string_literal: true source "https://rubygems.org" - gemspec group :jekyll_plugins do - gem "jekyll-feed", "~> 0.6" - gem "jekyll-paginate-v2", "~> 2", - :git => "https://github.com/sverrirs/jekyll-paginate-v2.git" + gem "jekyll-feed", + "~> 0.6" + + gem "jekyll-paginate-v2", + "~> 2", + :git => "https://github.com/sverrirs/jekyll-paginate-v2.git" + + gem 'jekyll-theme-lcsb-frozen-components', + '~> 0.0.1', + :git => "https://git-r3lab.uni.lu/core-services/jekyll-theme-lcsb-frozen-components.git", + :branch => "master" end diff --git a/_config.yml b/_config.yml index 467bc36..b778a1a 100644 --- a/_config.yml +++ b/_config.yml @@ -33,6 +33,7 @@ plugins: - jekyll-seo-tag - jekyll-feed - jekyll-paginate-v2 + - jekyll-theme-lcsb-frozen-components # Pagination Settings pagination: diff --git a/_plugins/alert.rb b/_plugins/alert.rb deleted file mode 100644 index 72a968a..0000000 --- a/_plugins/alert.rb +++ /dev/null @@ -1,24 +0,0 @@ -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 deleted file mode 100644 index 2f1617d..0000000 --- a/_plugins/alert_header.rb +++ /dev/null @@ -1,18 +0,0 @@ -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/_plugins/manual-markdown.rb b/_plugins/manual-markdown.rb deleted file mode 100644 index 1f3cc81..0000000 --- a/_plugins/manual-markdown.rb +++ /dev/null @@ -1,13 +0,0 @@ -def render(context) - site = context.registers[:site] - converter = site.find_converter_instance(::Jekyll::Converters::Markdown) - content = converter.convert(super) - - output = <<~EOS -<div> - #{content} -</div> - EOS - - output -end \ No newline at end of file diff --git a/_plugins/rblock.rb b/_plugins/rblock.rb deleted file mode 100644 index 26f0cdf..0000000 --- a/_plugins/rblock.rb +++ /dev/null @@ -1,54 +0,0 @@ -module Jekyll - module Tags - class RblockTag < Liquid::Block - - def split_params(params) - params.split("|").map(&:strip) - end - - def initialize(tag_name, block_options, liquid_options) - super - args = split_params(block_options) - @title = args[0] - if args.length >1 - @icon = args[1] - else - #default icon - @icon = "fas fa-code" - end - end - - def render(context) - rgridblockID = context["rgridblockID"] - - #content = super - site = context.registers[:site] - converter = site.find_converter_instance(::Jekyll::Converters::Markdown) - content = converter.convert(super) - - - - #Because we’re not changing the context, there’s no need to push the context stack as with the rgridblock. - # generate collapsible card HTML - output = <<~EOS -<div class="rblock"> - <h3> - <i class="#{@icon}"></i> - #{@title} - </h3> - <hr> - <p> - #{content} - </p> -</div> - EOS - output - end - end - end - end - - - - -Liquid::Template.register_tag('rblock', Jekyll::Tags::RblockTag) \ No newline at end of file diff --git a/_plugins/rgridblock.rb b/_plugins/rgridblock.rb deleted file mode 100644 index c680ff2..0000000 --- a/_plugins/rgridblock.rb +++ /dev/null @@ -1,29 +0,0 @@ -module Jekyll - module Tags - class RgridblockTag < Liquid::Block - def initialize(tag_name, block_options, liquid_options) - super - @rgridblockID = "rgridblock-#{block_options.strip}" - end - - - - def render(context) - #Pushes a new local scope on the stack, pops it at the end of the block - #Each new rgridblock creates a new scope, and contexts have a custom implementation of [] to search up the stack for a matching value. - context.stack do - context["rgridblockID"] = @rgridblockID - @content = super - end - # The last bit we add is saving the resulting output of our block contents to an instance variable so we can access it outside of the stack scope. - output= %(<div class="rgridblock" id="#{@rgridblockID}">#{@content}</div>) - output - - end - end - end -end - -Liquid::Template.register_tag('rgridblock', Jekyll::Tags::RgridblockTag) - - \ No newline at end of file diff --git a/_plugins/rtitle.rb b/_plugins/rtitle.rb deleted file mode 100644 index 64668b0..0000000 --- a/_plugins/rtitle.rb +++ /dev/null @@ -1,27 +0,0 @@ -module Jekyll - module Tags - class RtitleTag < Liquid::Block - def initialize(tag_name, block_options, liquid_options) - super - @title = block_options.strip - end - - def render(context) - site = context.registers[:site] - converter = site.find_converter_instance(::Jekyll::Converters::Markdown) - content = converter.convert(super) - output = <<~EOS -<div class="rtitle"> -<h2>#{@title}</h2> - #{content} - <hr> -</div> - EOS - - output - end - end - end - end - -Liquid::Template.register_tag('rtitle', Jekyll::Tags::RtitleTag) \ No newline at end of file diff --git a/development.md b/development.md index f92eb0a..bded764 100644 --- a/development.md +++ b/development.md @@ -22,6 +22,10 @@ Or install it yourself as: $ gem install jekyll-theme-lcsb-default + +## Plugins +Plugins that are placed in `_plugins` directory **are not published automatically!**. In order to add a new one, add it to [https://git-r3lab.uni.lu/-/ide/project/core-services/jekyll-theme-lcsb-frozen-components](https://git-r3lab.uni.lu/-/ide/project/core-services/jekyll-theme-lcsb-frozen-components). + ## Usage ### How to configure your website @@ -120,15 +124,3 @@ To add a custom directory to your theme-gem, please edit the regexp in `jekyll-t ## Automatic gem publishing Gitlab CI is configured to automatically build and publish a new version of theme, whenever the commit is tagged. For details refer to [the documentation of ruby gems](https://guides.rubygems.org/make-your-own-gem/), and this repository's `.gitlab-ci.yml` and settings. - -## Changelog - -### 0.2.20 -Added `success`, `primary` and `danger` to _alerts. Upgraded _font-awesome_ to 5.8.1. - -### 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 \ No newline at end of file diff --git a/jekyll-theme-lcsb-default.gemspec b/jekyll-theme-lcsb-default.gemspec index 45d2f06..9f650e3 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.3.0" + spec.version = "0.3.1" spec.authors = ["Trefex", "jaceklebioda_lux"] spec.email = ["lcsb-sysadmins@uni.lu"] -- GitLab