Implemented pullquoteleft functionality

This commit is contained in:
strand 2011-10-11 15:59:25 -07:00
parent 86c72a4ca6
commit 8897083cf7

View File

@ -1,6 +1,6 @@
#
# Author: Brandon Mathis
# Based on the sematic pullquote technique by Maykel Loomans at http://miekd.com/articles/pull-quotes-with-html5-and-css/
# Based on the semantic pullquote technique by Maykel Loomans at http://miekd.com/articles/pull-quotes-with-html5-and-css/
#
# Outputs a span with a data-pullquote attribute set from the marked pullquote. Example:
#
@ -17,11 +17,13 @@
# </span>
# </p>
#
# Strand's modification adds the ability to call this plugin with {% pullquote align:left %} which duplicates the current behavior of the pullquote plugin, with a left float and appropriate margins.
module Jekyll
class PullquoteTag < Liquid::Block
def initialize(tag_name, markup, tokens)
markup =~ /align:left/i ? @align = "left" : @align = ""
super
end
@ -29,7 +31,7 @@ module Jekyll
output = super
if output.join =~ /\{"\s*(.+)\s*"\}/
@quote = $1
"<span class='has-pullquote' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>"
"<span class='has-pullquote#{@align}' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>" # TODO Determine how to makethis span have a left or right flag.
else
return "Surround your pullquote like this {\" text to be quoted \"}"
end