diff options
author | Brandon Mathis <brandon@imathis.com> | 2011-07-11 11:17:15 -0400 |
---|---|---|
committer | Brandon Mathis <brandon@imathis.com> | 2011-07-11 11:17:15 -0400 |
commit | ee7b9dd9581a048cee17e89181cba94254033fb2 (patch) | |
tree | 42c7d47ebfcaf9faf68a302a39a4815ef2e8f5ec /.themes/classic/plugins/pullquote.rb | |
parent | d4139e394ec9f70acfcb35f25340bdb541d0d7ee (diff) | |
download | my_new_personal_website-ee7b9dd9581a048cee17e89181cba94254033fb2.tar.xz my_new_personal_website-ee7b9dd9581a048cee17e89181cba94254033fb2.zip |
Changed _plugins folder to plugins and updated rake tasks accordingly
Diffstat (limited to '.themes/classic/plugins/pullquote.rb')
-rw-r--r-- | .themes/classic/plugins/pullquote.rb | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/.themes/classic/plugins/pullquote.rb b/.themes/classic/plugins/pullquote.rb new file mode 100644 index 00000000..2b8544ab --- /dev/null +++ b/.themes/classic/plugins/pullquote.rb @@ -0,0 +1,42 @@ +# +# Author: Brandon Mathis +# Based on the sematic 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: +# +# {% pullquote %} +# When writing longform posts, I find it helpful to include pullquotes, which help those scanning a post discern whether or not a post is helpful. +# It is important to note, {" pullquotes are merely visual in presentation and should not appear twice in the text. "} That is why it is prefered +# to use a CSS only technique for styling pullquotes. +# {% endpullquote %} +# ...will output... +# <p> +# <span data-pullquote="pullquotes are merely visual in presentation and should not appear twice in the text."> +# When writing longform posts, I find it helpful to include pullquotes, which help those scanning a post discern whether or not a post is helpful. +# It is important to note, pullquotes are merely visual in presentation and should not appear twice in the text. This is why a CSS only approach # for styling pullquotes is prefered. +# </span> +# </p> +# + +module Jekyll + + class PullquoteTag < Liquid::Block + PullQuoteMarkup = /\{(.+)\}/i + + def initialize(tag_name, markup, tokens) + super + end + + def render(context) + output = super + if output.join =~ /\{"\s*(.+)\s*"\}/ + @quote = $1 + "<span class='has-pullquote' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>" + else + return "Surround your pullquote like this {! text to be quoted !}" + end + end + end +end + +Liquid::Template.register_tag('pullquote', Jekyll::PullquoteTag) |