mirror of
https://github.com/GamingShitposting/SalaMuseoGames
synced 2025-06-05 21:59:30 +02:00
Initial commit, patched theme and main pages
This commit is contained in:
9
_plugins/filters/shuffle.rb
Normal file
9
_plugins/filters/shuffle.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
module Jekyll
|
||||
module ShuffleFilter
|
||||
def shuffle(array)
|
||||
array.shuffle
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_filter(Jekyll::ShuffleFilter)
|
62
_plugins/tags/figure.rb
Normal file
62
_plugins/tags/figure.rb
Normal file
@@ -0,0 +1,62 @@
|
||||
require 'json'
|
||||
|
||||
module Jekyll
|
||||
class RenderFigureTag < Liquid::Tag
|
||||
|
||||
def initialize(tag_name, input, tokens)
|
||||
super
|
||||
@input = input
|
||||
end
|
||||
|
||||
def render(context)
|
||||
output = "<figure>"
|
||||
|
||||
image = ""
|
||||
alt = ""
|
||||
classes = ""
|
||||
width = ""
|
||||
height = ""
|
||||
caption = ""
|
||||
|
||||
begin
|
||||
if( !@input.nil? && !@input.empty? )
|
||||
jdata = JSON.parse(@input)
|
||||
if( jdata.key?("image") )
|
||||
image = jdata["image"].strip
|
||||
output += "<img src=\"" + image + "\""
|
||||
|
||||
if( jdata.key?("alt") )
|
||||
alt = jdata["alt"].strip
|
||||
output += " alt=\"" + alt + "\""
|
||||
end
|
||||
if( jdata.key?("classes") )
|
||||
classes = jdata["classes"].strip
|
||||
output += " class=\"" + classes + "\""
|
||||
end
|
||||
if( jdata.key?("width") )
|
||||
width = jdata["width"].strip
|
||||
output += " width=\"" + width + "\""
|
||||
end
|
||||
if( jdata.key?("height") )
|
||||
height = jdata["height"].strip
|
||||
output += " height=\"" + height + "\""
|
||||
end
|
||||
output += ">"
|
||||
end
|
||||
|
||||
if( jdata.key?("caption") )
|
||||
caption = jdata["caption"].strip
|
||||
output += "<figcaption>" + caption + "</figcaption>"
|
||||
end
|
||||
end
|
||||
rescue
|
||||
end
|
||||
|
||||
output += "</figure>"
|
||||
|
||||
return output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag('figure', Jekyll::RenderFigureTag)
|
62
_plugins/tags/figure_url.rb
Normal file
62
_plugins/tags/figure_url.rb
Normal file
@@ -0,0 +1,62 @@
|
||||
require 'json'
|
||||
|
||||
module Jekyll
|
||||
class RenderFigureUrlTag < Liquid::Tag
|
||||
|
||||
def initialize(tag_name, input, tokens)
|
||||
super
|
||||
@input = input
|
||||
end
|
||||
|
||||
def render(context)
|
||||
output = "<figure>"
|
||||
|
||||
image = ""
|
||||
alt = ""
|
||||
classes = ""
|
||||
width = ""
|
||||
height = ""
|
||||
caption = ""
|
||||
|
||||
begin
|
||||
if( !@input.nil? && !@input.empty? )
|
||||
jdata = JSON.parse(@input)
|
||||
if( jdata.key?("image") )
|
||||
image = jdata["image"].strip
|
||||
output += "<img src=\"" + image + "\""
|
||||
|
||||
if( jdata.key?("alt") )
|
||||
alt = jdata["alt"].strip
|
||||
output += " alt=\"" + alt + "\""
|
||||
end
|
||||
if( jdata.key?("classes") )
|
||||
classes = jdata["classes"].strip
|
||||
output += " class=\"" + classes + "\""
|
||||
end
|
||||
if( jdata.key?("width") )
|
||||
width = jdata["width"].strip
|
||||
output += " width=\"" + width + "\""
|
||||
end
|
||||
if( jdata.key?("height") )
|
||||
height = jdata["height"].strip
|
||||
output += " height=\"" + height + "\""
|
||||
end
|
||||
output += ">"
|
||||
end
|
||||
|
||||
if( jdata.key?("caption") )
|
||||
caption = jdata["caption"].strip
|
||||
output += "<figcaption>" + caption + "</figcaption>"
|
||||
end
|
||||
end
|
||||
rescue
|
||||
end
|
||||
|
||||
output += "</figure>"
|
||||
|
||||
return output
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag('figure_url', Jekyll::RenderFigureUrlTag)
|
Reference in New Issue
Block a user