Class: Jekyll::CodeTabs::CodeTabBlock

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

Instance Method Summary collapse

Constructor Details

#initialize(tag_name, markup, tokens) ⇒ CodeTabBlock

Returns a new instance of CodeTabBlock.



32
33
34
35
36
37
38
# File 'lib/jekyll-code-tabs.rb', line 32

def initialize(tag_name, markup, tokens)
  super
  if markup == ""
    raise SyntaxError.new("No toggle name given in #{tag_name} tag")
  end
  @toggle = markup.strip
end

Instance Method Details

#render(context) ⇒ Object



40
41
42
43
44
45
46
# File 'lib/jekyll-code-tabs.rb', line 40

def render(context)
  site = context.registers[:site]
  converter = site.find_converter_instance(::Jekyll::Converters::Markdown)
  environment = context.environments.first
  environment['codetabs'] ||= {}
  environment['codetabs'][@toggle] = converter.convert(render_block(context))
end

#render_blockObject



30
# File 'lib/jekyll-code-tabs.rb', line 30

alias_method :render_block, :render