Browse code

Implemented pullquoteleft functionality

strand authored on 11/10/2011 at 22:59:25
Showing 1 changed files
... ...
@@ -1,10 +1,10 @@
1 1
 #
2 2
 # Author: Brandon Mathis
3
-# Based on the sematic pullquote technique by Maykel Loomans at http://miekd.com/articles/pull-quotes-with-html5-and-css/
3
+# Based on the semantic pullquote technique by Maykel Loomans at http://miekd.com/articles/pull-quotes-with-html5-and-css/
4 4
 #
5 5
 # Outputs a span with a data-pullquote attribute set from the marked pullquote. Example:
6 6
 #
7
-#   {% pullquote %}
7
+#   {% pullquote %} 
8 8
 #     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.
9 9
 #     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
10 10
 #     to use a CSS only technique for styling pullquotes.
... ...
@@ -17,11 +17,13 @@
17 17
 #     </span>
18 18
 #   </p>
19 19
 #
20
+#  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.
20 21
 
21 22
 module Jekyll
22 23
 
23 24
   class PullquoteTag < Liquid::Block
24 25
     def initialize(tag_name, markup, tokens)
26
+      markup =~ /align:left/i ? @align = "left" : @align = ""
25 27
       super
26 28
     end
27 29
 
... ...
@@ -29,7 +31,7 @@ module Jekyll
29 29
       output = super
30 30
       if output.join =~ /\{"\s*(.+)\s*"\}/
31 31
         @quote = $1
32
-        "<span class='has-pullquote' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>"
32
+         "<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.
33 33
       else
34 34
         return "Surround your pullquote like this {\" text to be quoted \"}"
35 35
       end