Sha256: 007f794b8560710bd7d387ba1b14c288ee86a0168dbb992a4685835707db45d4
Contents?: true
Size: 566 Bytes
Versions: 2
Compression:
Stored size: 566 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+)?|http:\/\/(www.)?youtu\.be\/([A-Za-z0-9._%-]*)?/ text.gsub(regex) do youtube_id = $2 || $5 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
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
marcosinger-auto_html-1.3.6 | lib/auto_html/filters/youtube.rb |
auto_html-1.4.2 | lib/auto_html/filters/youtube.rb |