summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Allen <dan.j.allen@gmail.com>2023-10-30 12:56:11 -0600
committerDan Allen <dan.j.allen@gmail.com>2023-10-30 12:56:11 -0600
commitc7277233c8488a887bc9a4c4689d88e7ed42cc80 (patch)
tree69ab5169aa26f1ff421e7bec49ef508cdd5f4456
parent73067abce52d978221a6e2b4619b86179b5f603d (diff)
prefer option over attribute to control end behavior of wistia video (loop or reset, mutually exclusive)
-rw-r--r--lib/asciidoctor/converter/html5.rb4
-rw-r--r--test/blocks_test.rb6
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/asciidoctor/converter/html5.rb b/lib/asciidoctor/converter/html5.rb
index 48ca4db8..9b9febe4 100644
--- a/lib/asciidoctor/converter/html5.rb
+++ b/lib/asciidoctor/converter/html5.rb
@@ -1101,13 +1101,13 @@ Your browser does not support the audio tag.
end
delimiter = ['?']
start_anchor = (node.attr? 'start') ? %(#{delimiter.pop || '&amp;'}time=#{node.attr 'start'}) : ''
- loop_param = (node.attr? 'loopBehavior') ? %(#{delimiter.pop || '&amp;'}endVideoBehavior=#{node.attr 'loopBehavior'}) : ''
+ end_video_behavior_param = (node.option? 'loop') ? %(#{delimiter.pop || '&amp;'}endVideoBehavior=loop) : ((node.option? 'reset') ? %(#{delimiter.pop || '&amp;'}endVideoBehavior=reset) : '')
target = (node.attr 'target')
autoplay_param = (node.option? 'autoplay') ? %(#{delimiter.pop || '&amp;'}autoPlay=true) : ''
muted_param = (node.option? 'muted') ? %(#{delimiter.pop || '&amp;'}muted=true) : ''
%(<div#{id_attribute}#{class_attribute}>#{title_element}
<div class="content">
-<iframe#{width_attribute}#{height_attribute} src="#{asset_uri_scheme}//fast.wistia.com/embed/iframe/#{target}#{start_anchor}#{autoplay_param}#{loop_param}#{muted_param}" frameborder="0"#{(node.option? 'nofullscreen') ? '' : (append_boolean_attribute 'allowfullscreen', xml)} class="wistia_embed" name="wistia_embed"></iframe>
+<iframe#{width_attribute}#{height_attribute} src="#{asset_uri_scheme}//fast.wistia.com/embed/iframe/#{target}#{start_anchor}#{autoplay_param}#{end_video_behavior_param}#{muted_param}" frameborder="0"#{(node.option? 'nofullscreen') ? '' : (append_boolean_attribute 'allowfullscreen', xml)} class="wistia_embed" name="wistia_embed"></iframe>
</div>
</div>)
else
diff --git a/test/blocks_test.rb b/test/blocks_test.rb
index 1cb9cd4d..78e9ed0c 100644
--- a/test/blocks_test.rb
+++ b/test/blocks_test.rb
@@ -3261,17 +3261,17 @@ context 'Blocks' do
end
test 'video macro should output custom HTML with iframe for wistia service' do
- input = 'video::be5gtsbaco[wistia,640,360,start=60,options="autoplay,muted"]'
+ input = 'video::be5gtsbaco[wistia,640,360,start=60,options="autoplay,loop,muted"]'
output = convert_string_to_embedded input
assert_css 'video', output, 0
assert_css 'iframe', output, 1
- assert_css 'iframe[src="https://fast.wistia.com/embed/iframe/be5gtsbaco?time=60&autoPlay=true&muted=true"]', output, 1
+ assert_css 'iframe[src="https://fast.wistia.com/embed/iframe/be5gtsbaco?time=60&autoPlay=true&endVideoBehavior=loop&muted=true"]', output, 1
assert_css 'iframe[width="640"]', output, 1
assert_css 'iframe[height="360"]', output, 1
end
test 'video macro should output custom HTML with iframe for wistia service with loop behavior set' do
- input = 'video::be5gtsbaco[wistia,640,360,start=60,loopBehavior="reset",options="autoplay,muted"]'
+ input = 'video::be5gtsbaco[wistia,640,360,start=60,options="autoplay,reset,muted"]'
output = convert_string_to_embedded input
assert_css 'video', output, 0
assert_css 'iframe', output, 1