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