|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
|
|
# Transistor embed tag for Jekyll/Liquid
|
|
|
|
|
#
|
|
|
|
|
# Usage:
|
|
|
|
@ -16,22 +18,22 @@
|
|
|
|
|
require 'shellwords'
|
|
|
|
|
|
|
|
|
|
module Jekyll
|
|
|
|
|
# Transistor sound tag for Jekyll
|
|
|
|
|
class TransistorSoundTag < Liquid::Tag
|
|
|
|
|
|
|
|
|
|
def initialize(tag_name, markup, tokens)
|
|
|
|
|
super
|
|
|
|
|
params = Shellwords.shellwords markup
|
|
|
|
|
@sound = { :id => params[0], :color => params[1] || "light" }
|
|
|
|
|
@sound = { id: params[0], color: params[1] || 'light' }
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def render(context)
|
|
|
|
|
def render(_context)
|
|
|
|
|
url = "https://share.transistor.fm/e/#{@sound[:id]}"
|
|
|
|
|
url += "/dark" if @sound[:color] == 'dark'
|
|
|
|
|
"<iframe src='#{url}' width='100%' height='180' frameborder='0' scrolling='no' seamless='true' style='width:100%; height:180px;'></iframe>"
|
|
|
|
|
url += '/dark' if @sound[:color] == 'dark'
|
|
|
|
|
"<iframe src='#{url}' width='100%' height='180' frameborder='0' "\
|
|
|
|
|
"scrolling='no' seamless='true' style='width:100%; height:180px;'>"\
|
|
|
|
|
'</iframe>'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Liquid::Template.register_tag('transistor_sound', Jekyll::TransistorSoundTag)
|
|
|
|
|