Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
core-services
jekyll-theme-lcsb-frozen-components
Commits
b0ba9b34
Commit
b0ba9b34
authored
Dec 06, 2019
by
Jacek Lebioda
Browse files
Added the frozen-plugins files
/spend 7m
parent
916e1e77
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
b0ba9b34
...
@@ -4,7 +4,9 @@
...
@@ -4,7 +4,9 @@
A collection of plugins that allow the user to include components from _frozen-pages_ layout
A collection of plugins that allow the user to include components from _frozen-pages_ layout
## How to use?
## 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
## Licence
To be filled in
To be filled in
...
...
_plugins/rblock.rb
0 → 100644
View file @
b0ba9b34
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
)
_plugins/rgridblock.rb
0 → 100644
View file @
b0ba9b34
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
)
_plugins/rtitle.rb
0 → 100644
View file @
b0ba9b34
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment