Skip to content
Snippets Groups Projects
Commit b0ba9b34 authored by Jacek Lebioda's avatar Jacek Lebioda
Browse files

Added the frozen-plugins files

/spend 7m
parent 916e1e77
No related branches found
No related tags found
1 merge request!1Added the frozen-plugins files
......@@ -4,7 +4,9 @@
A collection of plugins that allow the user to include components from _frozen-pages_ layout
## How to use?
To be filled in
**Note, that this repository does not contain CSS files!** They stay within the theme.
More information to be added.
## Licence
To be filled in
......
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)
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)
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>
<hr>
#{content}
</div>
EOS
output
end
end
end
end
Liquid::Template.register_tag('rtitle', Jekyll::Tags::RtitleTag)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment