Commit 08257161 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Resolve "Make theme's plugins available to the website"

parent 2bc89b87
# 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
......@@ -33,6 +33,7 @@ plugins:
- jekyll-seo-tag
- jekyll-feed
- jekyll-paginate-v2
- jekyll-theme-lcsb-frozen-components
# Pagination Settings
pagination:
......
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
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
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
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
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
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
......@@ -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
......@@ -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"]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment