Sha256: 750f99617d3978897aa02e5b44633499dc6af8119ed2af137656dd9362fa8788
Contents?: true
Size: 1018 Bytes
Versions: 10
Compression:
Stored size: 1018 Bytes
Contents
module ReverseAsciidoctor module Converters class Video < Base def convert(node, state = {}) autoplay = node['autoplay'] loop_attr = node['loop'] controls = node['controls'] src = node['src'] id = node['id'] anchor = id ? "[[#{id}]]\n" : "" title = extract_title(node) title = ".#{title}\n" unless title.empty? [anchor, title, "video::", src, "[", options(node), "]"].join("") end def options(node) autoplay = node['autoplay'] loop_attr = node['loop'] controls = node['controls'] width = node['width'] ret = "" if autoplay || loop_attr || controls out = [] out << "autoplay" if autoplay out << "loop" if loop_attr out << "controls" if controls out << "width=#{width}" if width ret = %{options="#{out.join(',')}"} end ret end end register :video, Video.new end end
Version data entries
10 entries across 10 versions & 2 rubygems