Sha256: dc231d77db2279026ad99cc548208f6f4e5af7aed985a350c46c06198b24cb76

Contents?: true

Size: 891 Bytes

Versions: 16

Compression:

Stored size: 891 Bytes

Contents

AutoHtml.add_filter(:vimeo).with(:width => 440, :height => 248, :show_title => false, :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]
    show_title      = "title=0"    unless options[:show_title]
    show_byline     = "byline=0"   unless options[:show_byline]  
    show_portrait   = "portrait=0" unless options[:show_portrait]
    frameborder     = options[:frameborder] || 0
    query_string_variables = [show_title, show_byline, show_portrait].compact.join("&")
    query_string    = "?" + query_string_variables unless query_string_variables.empty?

    %{<iframe src="http://player.vimeo.com/video/#{vimeo_id}#{query_string}" width="#{width}" height="#{height}" frameborder="#{frameborder}"></iframe>}
  end
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
auto_html-1.5.1.1 lib/auto_html/filters/vimeo.rb
auto_html-1.5.1 lib/auto_html/filters/vimeo.rb
auto_html-1.5.0 lib/auto_html/filters/vimeo.rb
marcosinger-auto_html-1.3.6 lib/auto_html/filters/vimeo.rb
auto_html-1.4.2 lib/auto_html/filters/vimeo.rb
auto_html-1.4.1 lib/auto_html/filters/vimeo.rb
auto_html-1.4.0 lib/auto_html/filters/vimeo.rb
auto_html-1.3.7 lib/auto_html/filters/vimeo.rb
marcosinger-auto_html-1.3.5 lib/auto_html/filters/vimeo.rb
marcosinger-auto_html-1.3.4 lib/auto_html/filters/vimeo.rb
auto_html-1.3.6 lib/auto_html/filters/vimeo.rb
auto_html-1.3.5 lib/auto_html/filters/vimeo.rb
auto_html-1.3.4 lib/auto_html/filters/vimeo.rb
auto_html-1.3.3 lib/auto_html/filters/vimeo.rb
auto_html-1.3.2 lib/auto_html/filters/vimeo.rb
auto_html-1.3.1 lib/auto_html/filters/vimeo.rb