class Jekyll::SoundCloud::SoundCloudTag
Constants
- BASE_URL
Public Class Methods
new(tag_name, markup, tokens)
click to toggle source
Calls superclass method
# File lib/jekyll/sound_cloud.rb, line 9 def initialize(tag_name, markup, tokens) super params = Shellwords.shellwords markup @sound = { :id => params[0], :widget => params[1] || 'html5', :color => params[2] || 'ff7700', :size => params[3] || 'medium' } end
Public Instance Methods
render(context)
click to toggle source
# File lib/jekyll/sound_cloud.rb, line 15 def render(context) case @sound[:widget] when 'html5' "<iframe width='100%' height='166' scrolling='no' frameborder='no' src='https://w.soundcloud.com/player/?url=https%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F#{@sound[:id]}&show_artwork=true'></iframe>" when 'flash' "<object height='81' width='100%'><param name='movie' value='#{BASE_URL + @sound[:id]}&show_comments=false&auto_play=false&color=#{@sound[:color]}'></param><param name='allowscriptaccess' value='always'></param><embed allowscriptaccess='always' height='81' src='#{BASE_URL + @sound[:id]}&show_comments=false&auto_play=false&color=#{@sound[:color]}' type='application/x-shockwave-flash' width='100%'></embed></object>" when "mini" "<object height='18' width='100%'><param name='movie' value='#{BASE_URL + @sound[:id]}&auto_play=false&player_type=tiny&font=Arial&color=#{@sound[:color]}'></param> <param name='allowscriptaccess' value='always'></param> <param name='wmode' value='transparent'></param><embed wmode='transparent' allowscriptaccess='always' height='18' src='#{BASE_URL + @sound[:id]}&auto_play=false&player_type=tiny&font=Arial&color=#{@sound[:color]}' type='application/x-shockwave-flash' width='100%'></embed></object>" when "artwork" "<object height='#{dimension}' width='#{dimension}'><param name='movie' value='#{BASE_URL + @sound[:id]}&auto_play=false&player_type=artwork&color=#{@sound[:color]}'></param><param name='allowscriptaccess' value='always'></param><embed allowscriptaccess='always' height='220' src='#{BASE_URL + @sound[:id]}&auto_play=false&player_type=artwork&color=#{@sound[:color]}' type='application/x-shockwave-flash' width='220'></embed></object>" when "playlist" "<iframe width='100%' height='450' scrolling='no' frameborder='no' src='#{BASE_URL + @sound[:id]}&color=%23ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true'></iframe>" else '' end end
Private Instance Methods
dimension(size)
click to toggle source
# File lib/jekyll/sound_cloud.rb, line 35 def dimension(size) case @sound[:size] when 'small' 220 when 'medium' 300 when 'large' 425 else 0 end end