Class: ReverseAdoc::Converters::Audio
- Inherits:
-
Base
- Object
- Base
- ReverseAdoc::Converters::Audio
show all
- Defined in:
- lib/reverse_adoc/converters/audio.rb
Instance Method Summary
collapse
Methods inherited from Base
#escape_keychars, #extract_title, #treat, #treat_children
Instance Method Details
#convert(node, state = {}) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
|
# File 'lib/reverse_adoc/converters/audio.rb', line 4
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 = (node)
title = ".#{title}\n" unless title.empty?
[anchor, title, "audio::", src, "[", options(node), "]"].join("")
end
|
#options(node) ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/reverse_adoc/converters/audio.rb', line 16
def options(node)
autoplay = node['autoplay']
loop_attr = node['loop']
controls = node['controls']
ret = ""
if autoplay || loop_attr || controls
out = []
out << "autoplay" if autoplay
out << "loop" if loop_attr
out << "controls" if controls
ret = %{options="#{out.join(',')}"}
end
ret
end
|