Class: Jekyll::Bulma::Tabs::TabBlock

Inherits:
Liquid::Block
  • Object
show all
Defined in:
lib/jekyll/bulma/tabs.rb

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, options) ⇒ TabBlock



34
35
36
37
38
39
40
41
42
# File 'lib/jekyll/bulma/tabs.rb', line 34

def initialize(tag_name, markup, options)
  super
  markups = markup.split(' ', 2)
  if markups.length != 2
    raise SyntaxError.new("Block #{tag_name} requires 2 attributes")
  end
  @tabs_group = markups[0]
  @tab_id = markups[1]
end

Instance Method Details

#render(context) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/jekyll/bulma/tabs.rb', line 44

def render(context)
  super
  site = context.registers[:site]
  converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
  environment = context.environments.first
  environment["tabs-#{@tabs_group}"] ||= {}
  environment["tabs-#{@tabs_group}"][@tab_id] = converter.convert(render_block(context))
end

#render_blockObject



32
# File 'lib/jekyll/bulma/tabs.rb', line 32

alias_method :render_block, :render