Sha256: 5c6e25b0fd79c5b2fb2beb7ef47212207426bdab64d118e7899b94b3e60e4723

Contents?: true

Size: 513 Bytes

Versions: 12

Compression:

Stored size: 513 Bytes

Contents

AutoHtml.add_filter(:youtube).with(:width => 390, :height => 250, :frameborder => 0) do |text, options|
  regex = /http:\/\/(www.)?youtube\.com\/watch\?v=([A-Za-z0-9._%-]*)(\&\S+)?/
  text.gsub(regex) do
    youtube_id = $2
    width = options[:width]
    height = options[:height]
    frameborder = options[:frameborder]
    %{<iframe class="youtube-player" type="text/html" width="#{width}" height="#{height}" src="http://www.youtube.com/embed/#{youtube_id}" frameborder="#{frameborder}">
</iframe>}
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
auto_html-1.4.1 lib/auto_html/filters/youtube.rb
auto_html-1.4.0 lib/auto_html/filters/youtube.rb
auto_html-1.3.7 lib/auto_html/filters/youtube.rb
marcosinger-auto_html-1.3.5 lib/auto_html/filters/youtube.rb
marcosinger-auto_html-1.3.4 lib/auto_html/filters/youtube.rb
auto_html-1.3.6 lib/auto_html/filters/youtube.rb
auto_html-1.3.5 lib/auto_html/filters/youtube.rb
auto_html-1.3.4 lib/auto_html/filters/youtube.rb
auto_html-1.3.3 lib/auto_html/filters/youtube.rb
auto_html-1.3.2 lib/auto_html/filters/youtube.rb
auto_html-1.3.1 lib/auto_html/filters/youtube.rb
auto_html-1.3.0 lib/auto_html/filters/youtube.rb