Class: Jekyll::ScalaFiddle::ScalaFiddleTag

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

Instance Method Summary collapse

Constructor Details

#initialize(tag, args, _) ⇒ ScalaFiddleTag

Returns a new instance of ScalaFiddleTag.



43
44
45
46
# File 'lib/jekyll-scalafiddle.rb', line 43

def initialize(tag, args, _)
  @args = OptionsParser.parse(args)
  super
end

Instance Method Details

#render(context) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/jekyll-scalafiddle.rb', line 48

def render(context)
  site = context.registers[:site]
  # run all markdown converters for this content
  converters = site.converters.select { |c| c.matches(".md") }.sort
  content = converters.reduce(super(context)) { |content, converter| converter.convert(content) }
  config = site.config.fetch("scalafiddle", {})
  result = <<HTML
<div #{render_attributes(config)}>#{content}</div>
HTML
  result
end