Browse code

Adds parameter for left aligned pullquotes, fixes #215

Frederic Hemberger authored on 16/10/2011 at 11:37:06
Showing 2 changed files
... ...
@@ -115,7 +115,8 @@ blockquote {
115 115
   }
116 116
 }
117 117
 
118
-.pullquote-right:before, .pullquote-left:before {
118
+.pullquote-right:before,
119
+.pullquote-left:before {
119 120
   /* Reset metrics. */
120 121
   padding: 0;
121 122
   border: none;
... ...
@@ -136,11 +137,9 @@ blockquote {
136 136
 }
137 137
 
138 138
 .pullquote-left:before {
139
-
140 139
   /* Make left pullquotes align properly. */
141 140
   float: left;
142 141
   margin: .5em 1.5em 1em 0;
143
-
144 142
 }
145 143
 
146 144
 /* @extend this to force long lines of continuous text to wrap */
... ...
@@ -13,18 +13,20 @@
13 13
 #   <p>
14 14
 #     <span data-pullquote="pullquotes are merely visual in presentation and should not appear twice in the text.">
15 15
 #       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.
16
-#       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.
16
+#       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
17
+#       for styling pullquotes is prefered.
17 18
 #     </span>
18 19
 #   </p>
19 20
 #
20
-#  Strand's modification adds the ability to call this plugin with {% pullquote left %} which duplicates the current behavior of the pullquote plugin, with a left float and appropriate margins.
21
-#  Note: this version of the plugin now creates pullquotes with the class of pullquote-right by default
21
+# {% pullquote left %} will create a left-aligned pullquote instead.
22
+#
23
+# Note: this plugin now creates pullquotes with the class of pullquote-right by default
22 24
 
23 25
 module Jekyll
24 26
 
25 27
   class PullquoteTag < Liquid::Block
26 28
     def initialize(tag_name, markup, tokens)
27
-      markup =~ /left/i ? @align = "left" : @align = "right"
29
+      @align = (markup =~ /left/i) ? "left" : "right"
28 30
       super
29 31
     end
30 32
 
... ...
@@ -32,7 +34,7 @@ module Jekyll
32 32
       output = super
33 33
       if output.join =~ /\{"\s*(.+)\s*"\}/
34 34
         @quote = $1
35
-         "<span class='pullquote-#{@align}' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>" # TODO Determine how to makethis span have a left or right flag.
35
+        "<span class='pullquote-#{@align}' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>"
36 36
       else
37 37
         return "Surround your pullquote like this {\" text to be quoted \"}"
38 38
       end