Sha256: 6329fcda23231dd22a289a8cffc7ec5cb68928a0a57f4504c3c4799f211d7bbc
Contents?: true
Size: 943 Bytes
Versions: 10
Compression:
Stored size: 943 Bytes
Contents
module ReverseAsciidoctor module Converters class Audio < 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, "audio::", src, "[", options(node), "]"].join("") end 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 end register :audio, Audio.new end end
Version data entries
10 entries across 10 versions & 2 rubygems