Skip to content

Instantly share code, notes, and snippets.

@oparrish
Created March 6, 2012 15:55
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oparrish/1987007 to your computer and use it in GitHub Desktop.
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
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