Adds parameter for left aligned pullquotes, fixes #215
This commit is contained in:
parent
2dedad6176
commit
21803814bc
@ -115,7 +115,8 @@ blockquote {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.pullquote-right:before, .pullquote-left:before {
|
.pullquote-right:before,
|
||||||
|
.pullquote-left:before {
|
||||||
/* Reset metrics. */
|
/* Reset metrics. */
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: none;
|
border: none;
|
||||||
@ -136,11 +137,9 @@ blockquote {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.pullquote-left:before {
|
.pullquote-left:before {
|
||||||
|
|
||||||
/* Make left pullquotes align properly. */
|
/* Make left pullquotes align properly. */
|
||||||
float: left;
|
float: left;
|
||||||
margin: .5em 1.5em 1em 0;
|
margin: .5em 1.5em 1em 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* @extend this to force long lines of continuous text to wrap */
|
/* @extend this to force long lines of continuous text to wrap */
|
||||||
|
@ -13,18 +13,20 @@
|
|||||||
# <p>
|
# <p>
|
||||||
# <span data-pullquote="pullquotes are merely visual in presentation and should not appear twice in the text.">
|
# <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.
|
# 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.
|
# 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>
|
# </span>
|
||||||
# </p>
|
# </p>
|
||||||
#
|
#
|
||||||
# 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.
|
# {% pullquote left %} will create a left-aligned pullquote instead.
|
||||||
# Note: this version of the plugin now creates pullquotes with the class of pullquote-right by default
|
#
|
||||||
|
# Note: this plugin now creates pullquotes with the class of pullquote-right by default
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
|
|
||||||
class PullquoteTag < Liquid::Block
|
class PullquoteTag < Liquid::Block
|
||||||
def initialize(tag_name, markup, tokens)
|
def initialize(tag_name, markup, tokens)
|
||||||
markup =~ /left/i ? @align = "left" : @align = "right"
|
@align = (markup =~ /left/i) ? "left" : "right"
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -32,7 +34,7 @@ module Jekyll
|
|||||||
output = super
|
output = super
|
||||||
if output.join =~ /\{"\s*(.+)\s*"\}/
|
if output.join =~ /\{"\s*(.+)\s*"\}/
|
||||||
@quote = $1
|
@quote = $1
|
||||||
"<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.
|
"<span class='pullquote-#{@align}' data-pullquote='#{@quote}'>#{output.join.gsub(/\{"\s*|\s*"\}/, '')}</span>"
|
||||||
else
|
else
|
||||||
return "Surround your pullquote like this {\" text to be quoted \"}"
|
return "Surround your pullquote like this {\" text to be quoted \"}"
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user