require 'securerandom'
module Jekyll
class TabbedBlock < Liquid::Block
def slug(key)
key.downcase.strip.gsub(' ', '-').gsub(/[^\w\-]/, '')
end
def render_tabbed_block(vars:, converter:, classes: nil, parent_type: nil)
block = Array.new
tabs = Array.new
tabContent = Array.new
uuid = "id" + SecureRandom.hex(10)
tabs << "
"
vars.map do |entry|
tabs << "
"
tabContent << "
#{converter.convert(entry['content'].to_s)}
"
end
tabs << "
"
block << tabs.join
block << tabContent.join
block.join
end
def render(context)
contents = super(context)
vars = SafeYAML.load(contents)
site = context.registers[:site]
converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
<<~MARKUP