Sha256: 898ba8df65ad81505aaac4044e95d802d49a1e071ee1e55af6e8b3db63c3622e
Contents?: true
Size: 735 Bytes
Versions: 6
Compression:
Stored size: 735 Bytes
Contents
class Lalala::Markdown::Handlers::YouTube < Lalala::Markdown::Handlers::Base def initialize(options={}) options.assert_valid_keys(:width, :height) options = { width: 560, height: 315 }.merge(options) @options = options end def image(url, alt=nil, title=nil) unless %r|^youtube[:]//(.+)$| === url return "" end id = $1 helpers.content_tag :span, class: "embed-container" do helpers.content_tag( :iframe, "", width: @options[:width], height: @options[:height], src: "http://www.youtube.com/embed/#{id}?rel=0", frameborder: 0, allowfullscreen: true ) end end end
Version data entries
6 entries across 6 versions & 1 rubygems