Created
March 6, 2012 15:55
-
-
Save oparrish/1987007 to your computer and use it in GitHub Desktop.
Jekyll tag plugin for creating HTML 5 audio element based on a list of source files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Jekyll | |
class AudioTag < Liquid::Tag | |
def initialize(tag_name, files, tokens) | |
super | |
@files = files | |
end | |
def render(context) | |
HTML << '<audio controls="controls">' | |
for file in files | |
HTML << '<source src="#{file}"/>' | |
end | |
HTML << '<audio/>' | |
HTML | |
end | |
end | |
end | |
Liquid::Template.register_tag('audio', AudioTag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment