Sha256: 0f5b0c1c67e87afc1f749477565146e62f917eda2d3b59beaa34a7188ae50d90

Contents?: true

Size: 888 Bytes

Versions: 5

Compression:

Stored size: 888 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(/https?:\/\/(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="//player.vimeo.com/video/#{vimeo_id}#{query_string}" width="#{width}" height="#{height}" frameborder="#{frameborder}"></iframe>}
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
auto_html-1.6.4 lib/auto_html/filters/vimeo.rb
auto_html-1.6.3 lib/auto_html/filters/vimeo.rb
auto_html-1.6.2 lib/auto_html/filters/vimeo.rb
auto_html-1.6.1 lib/auto_html/filters/vimeo.rb
auto_html-1.6.0 lib/auto_html/filters/vimeo.rb