class Jekyll::TransistorSoundTag

Transistor sound tag for Jekyll

Public Class Methods

new(tag_name, markup, tokens) click to toggle source
Calls superclass method
# File lib/jekyll-transistor.rb, line 23
def initialize(tag_name, markup, tokens)
  super
  params = Shellwords.shellwords markup
  @sound = { id: params[0], color: params[1] || 'light' }
end

Public Instance Methods

render(_context) click to toggle source
# File lib/jekyll-transistor.rb, line 29
def render(_context)
  url = "https://share.transistor.fm/e/#{@sound[:id]}"
  url += '/dark' if @sound[:color] == 'dark'
  "<iframe src='#{url}' width='100%' height='180' frameborder='0' "\
  "scrolling='no' seamless='true' style='width:100%; height:180px;'>"\
  '</iframe>'
end