class Asciidoctor::Converter::Html5Converter
def convert_video node
def convert_video node xml = @xml_mode id_attribute = node.id ? %( id="#{node.id}") : '' classes = ['videoblock'] classes << (node.attr 'float') if node.attr? 'float' classes << %(text-#{node.attr 'align'}) if node.attr? 'align' classes << node.role if node.role class_attribute = %( class="#{classes.join ' '}") title_element = node.title? ? %(\n<div class="title">#{node.title}</div>) : '' width_attribute = (node.attr? 'width') ? %( width="#{node.attr 'width'}") : '' height_attribute = (node.attr? 'height') ? %( height="#{node.attr 'height'}") : '' case node.attr 'poster' when 'vimeo' unless (asset_uri_scheme = (node.document.attr 'asset-uri-scheme', 'https')).empty? asset_uri_scheme = %(#{asset_uri_scheme}:) end start_anchor = (node.attr? 'start') ? %(#at=#{node.attr 'start'}) : '' delimiter = ['?'] autoplay_param = (node.option? 'autoplay') ? %(#{delimiter.pop || '&'}autoplay=1) : '' loop_param = (node.option? 'loop') ? %(#{delimiter.pop || '&'}loop=1) : '' muted_param = (node.option? 'muted') ? %(#{delimiter.pop || '&'}muted=1) : '' %(<div#{id_attribute}#{class_attribute}>#{title_element} iv class="content"> frame#{width_attribute}#{height_attribute} src="#{asset_uri_scheme}//player.vimeo.com/video/#{node.attr 'target'}#{autoplay_param}#{loop_param}#{muted_param}#{start_anchor}" frameborder="0"#{(node.option? 'nofullscreen') ? '' : (append_boolean_attribute 'allowfullscreen', xml)}></iframe> div> div>) when 'youtube' unless (asset_uri_scheme = (node.document.attr 'asset-uri-scheme', 'https')).empty? asset_uri_scheme = %(#{asset_uri_scheme}:) end rel_param_val = (node.option? 'related') ? 1 : 0 # NOTE start and end must be seconds (t parameter allows XmYs where X is minutes and Y is seconds) start_param = (node.attr? 'start') ? %(&start=#{node.attr 'start'}) : '' end_param = (node.attr? 'end') ? %(&end=#{node.attr 'end'}) : '' autoplay_param = (node.option? 'autoplay') ? '&autoplay=1' : '' loop_param = (has_loop_param = node.option? 'loop') ? '&loop=1' : '' mute_param = (node.option? 'muted') ? '&mute=1' : '' controls_param = (node.option? 'nocontrols') ? '&controls=0' : '' # cover both ways of controlling fullscreen option if node.option? 'nofullscreen' fs_param = '&fs=0' fs_attribute = '' else fs_param = '' fs_attribute = append_boolean_attribute 'allowfullscreen', xml end modest_param = (node.option? 'modest') ? '&modestbranding=1' : '' theme_param = (node.attr? 'theme') ? %(&theme=#{node.attr 'theme'}) : '' hl_param = (node.attr? 'lang') ? %(&hl=#{node.attr 'lang'}) : '' # parse video_id/list_id syntax where list_id (i.e., playlist) is optional target, list = (node.attr 'target').split '/', 2 if (list ||= (node.attr 'list')) list_param = %(&list=#{list}) else # parse dynamic playlist syntax: video_id1,video_id2,... target, playlist = target.split ',', 2 if (playlist ||= (node.attr 'playlist')) # INFO playlist bar doesn't appear in Firefox unless showinfo=1 and modestbranding=1 list_param = %(&playlist=#{playlist}) else # NOTE for loop to work, playlist must be specified; use VIDEO_ID if there's no explicit playlist list_param = has_loop_param ? %(&playlist=#{target}) : '' end end %(<div#{id_attribute}#{class_attribute}>#{title_element} iv class="content"> frame#{width_attribute}#{height_attribute} src="#{asset_uri_scheme}//www.youtube.com/embed/#{target}?rel=#{rel_param_val}#{start_param}#{end_param}#{autoplay_param}#{loop_param}#{mute_param}#{controls_param}#{list_param}#{fs_param}#{modest_param}#{theme_param}#{hl_param}" frameborder="0"#{fs_attribute}></iframe> div> div>) else poster_attribute = (val = node.attr 'poster').nil_or_empty? ? '' : %( poster="#{node.media_uri val}") preload_attribute = (val = node.attr 'preload').nil_or_empty? ? '' : %( preload="#{val}") start_t = node.attr 'start' end_t = node.attr 'end' time_anchor = (start_t || end_t) ? %(#t=#{start_t || ''}#{end_t ? ",#{end_t}" : ''}) : '' %(<div#{id_attribute}#{class_attribute}>#{title_element} iv class="content"> ideo src="#{node.media_uri(node.attr 'target')}#{time_anchor}"#{width_attribute}#{height_attribute}#{poster_attribute}#{(node.option? 'autoplay') ? (append_boolean_attribute 'autoplay', xml) : ''}#{(node.option? 'nocontrols') ? '' : (append_boolean_attribute 'controls', xml)}#{(node.option? 'loop') ? (append_boolean_attribute 'loop', xml) : ''}#{preload_attribute}> ur browser does not support the video tag. video> div> div>) end end