Class: Jekyll::CodeTabs::CodeTabBlock
- Inherits:
-
Liquid::Block
- Object
- Liquid::Block
- Jekyll::CodeTabs::CodeTabBlock
- Defined in:
- lib/jekyll-code-tabs.rb
Instance Method Summary collapse
-
#initialize(tag_name, markup, tokens) ⇒ CodeTabBlock
constructor
A new instance of CodeTabBlock.
- #render(context) ⇒ Object
- #render_block ⇒ Object
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_block ⇒ Object
30 |
# File 'lib/jekyll-code-tabs.rb', line 30 alias_method :render_block, :render |