Last active
September 18, 2016 23:59
-
-
Save ishani/ee160ca4eabb32ceb411 to your computer and use it in GitHub Desktop.
Gfycat for Jekyll
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
# Title: Gfycat JS tags for Jekyll | |
# Author: Harry Denholm, ishani.org | |
# Description: plug the custom gfycat image tags into a page | |
# | |
# updated 02/02/2016 | |
# | |
# Syntax {% gfycat gfy_name %} | |
# | |
# Example: | |
# {% gfycat LateLikelyDassierat %} | |
# | |
# Output: | |
# <img class="gfyitem" data-id="LateLikelyDassierat" /> | |
# | |
module Jekyll | |
class GfyCatTag < Liquid::Tag | |
@video = nil | |
@videoname = '' | |
def initialize(tag_name, markup, tokens) | |
@videoname = markup.strip | |
super | |
end | |
def render(context) | |
output = super | |
video = "<div class='gfyitem' data-controls='false' data-expand='true' data-id='#{@videoname}'>" | |
end | |
end | |
class GfyCatJS < Liquid::Tag | |
def render(context) | |
'<script type"text/javascript" src="https://assets.gfycat.com/gfycat.js"></script>' | |
end | |
end | |
end | |
Liquid::Template.register_tag('gfycat', Jekyll::GfyCatTag) | |
Liquid::Template.register_tag('gfycat_js', Jekyll::GfyCatJS) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment