Class: BlueDoc::SML::Rules::Video
- Defined in:
- lib/bluedoc/sml/rules/video.rb
Constant Summary
Constants inherited from Base
Class Method Summary collapse
Methods inherited from Base
Class Method Details
.match?(node) ⇒ Boolean
5 6 7 |
# File 'lib/bluedoc/sml/rules/video.rb', line 5 def self.match?(node) tag_name(node) == "video" end |
.to_html(node, opts = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/bluedoc/sml/rules/video.rb', line 9 def self.to_html(node, opts = {}) attrs = attributes(node) return "" if attrs[:src].blank? width = attrs[:width] if width == 0 || width.blank? width = "100%" end video_attrs = html_attrs( width: width ) nid_attr = name_by_attrs(attrs) out = <<~HTML <video controls preload="no"#{video_attrs}#{nid_attr}> <source src="#{attrs[:src]}" type="#{attrs[:type]}"> </video> HTML out end |