Sha256: ec471926777ac462219d66f4ac47c4ee49b29ae4114fcbc3c352cc112e1d12c0

Contents?: true

Size: 1.38 KB

Versions: 2

Compression:

Stored size: 1.38 KB

Contents

AutoHtml.add_filter(:vimeo).with(:width => 440, :height => 248, :show_title => false, :fullscreen => true, :show_byline => false, :show_portrait => false) do |text, options|
  text.gsub(/http:\/\/(www.)?vimeo\.com\/([A-Za-z0-9._%-]*)((\?|#)\S+)?/) do
    vimeo_id = $2
    
    width  = options[:width]
    height = options[:height]
    
    allowfullscreen = options[:fullscreen]
    fullscreen      = options[:fullscreen]    ? 1 : 0 
    show_title      = options[:show_title]    ? 1 : 0
    show_byline     = options[:show_byline]   ? 1 : 0
    show_portrait   = options[:show_portrait] ? 1 : 0
    %{<object width="#{width}" height="#{height}"><param name="allowfullscreen" value="#{allowfullscreen}" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=#{vimeo_id}&amp;server=vimeo.com&amp;show_title=#{show_title}&amp;show_byline=#{show_byline}&amp;show_portrait=#{show_portrait}&amp;color=00adef&amp;fullscreen=#{fullscreen}" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=#{vimeo_id}&amp;server=vimeo.com&amp;show_title=#{show_title}&amp;show_byline=#{show_byline}&amp;show_portrait=#{show_portrait}&amp;color=00adef&amp;fullscreen=#{fullscreen}" type="application/x-shockwave-flash" allowfullscreen="#{allowfullscreen}" allowscriptaccess="always" width="#{options[:width]}" height="#{options[:height]}"></embed></object>}    
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
galetahub-auto_html-1.0.1 lib/auto_html/filters/vimeo.rb
auto_html-1.2.1 lib/auto_html/filters/vimeo.rb