Sha256: e139d31cc9b21588bd8e3559b296ef1bb05c39d58fb23faac759e6480a587f1e
Contents?: true
Size: 920 Bytes
Versions: 2
Compression:
Stored size: 920 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 protocol = $1 vimeo_id = $3 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="#{protocol}://player.vimeo.com/video/#{vimeo_id}#{query_string}" width="#{width}" height="#{height}" frameborder="#{frameborder}"></iframe>} end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
auto_html-1.5.3 | lib/auto_html/filters/vimeo.rb |
auto_html-1.5.2 | lib/auto_html/filters/vimeo.rb |