class Jekyll::Spotify

Public Class Methods

new(tag_name, id, tokens) click to toggle source
Calls superclass method
# File lib/spotify.rb, line 18
def initialize(tag_name, id, tokens)
    super
    @id       = id
end

Public Instance Methods

render(context) click to toggle source
# File lib/spotify.rb, line 23
def render(context)
  @id, @width, @height = @id.split(' ').map(&:strip)

  if @width.nil? && @height.nil?
    @width = '100%'
    @height = '300'
  end

  if @id
    %(<iframe src=\"https://embed.spotify.com/?uri=#{@id}\" width=\"#{@width}\" height=\"#{@height}\" frameborder=\"0\" allowtransparency=\"true\" allow=\"encrypted-media\"></iframe>)
  else
    %(Error input, expected syntax: {% spotify id [width] [height] %})
  end
end