Skip to content

Instantly share code, notes, and snippets.

@pjf
Created February 17, 2014 23:59
Show Gist options
  • Save pjf/9061813 to your computer and use it in GitHub Desktop.
Save pjf/9061813 to your computer and use it in GitHub Desktop.
# Usage: {% pullquote : Here's some pullquote text. %}
module Jekyll
class PullQuote < Liquid::Tag
# (Options) : (Message)
Syntax = /^(.*?)\s*:\s*(.*)/
def initialize(tag_name, markup, tokens)
super
if markup =~ Syntax then
@quote = $2
else
raise "Failed to parse #{tag_name}: #{markup} #{tokens}"
end
end
def render(context)
markup = "<div class=\"pullquote\"><p><i class=\"fa fa-quote-left fa-2x pull-left\"></i> #{@quote} </p></div>"
puts(markup)
markup
end
end
end
Liquid::Template.register_tag('pullquote', Jekyll::PullQuote)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment