blockquote plugin now allows for source attribution with out a link, see docs
This commit is contained in:
parent
ba0e5ef4a3
commit
967eeb46e8
@ -19,9 +19,9 @@ require './plugins/titlecase.rb'
|
|||||||
module Jekyll
|
module Jekyll
|
||||||
|
|
||||||
class Blockquote < Liquid::Block
|
class Blockquote < Liquid::Block
|
||||||
FullCiteWithTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i
|
FullCiteWithTitle = /(\S.*)\s+(https?:\/\/)(\S+)\s+(.+)/i
|
||||||
FullCite = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i
|
FullCite = /(\S.*)\s+(https?:\/\/)(\S+)/i
|
||||||
Author = /(\S[\S\s]*)/
|
Author = /(.+)/
|
||||||
|
|
||||||
def initialize(tag_name, markup, tokens)
|
def initialize(tag_name, markup, tokens)
|
||||||
@by = nil
|
@by = nil
|
||||||
@ -35,7 +35,12 @@ module Jekyll
|
|||||||
@by = $1
|
@by = $1
|
||||||
@source = $2 + $3
|
@source = $2 + $3
|
||||||
elsif markup =~ Author
|
elsif markup =~ Author
|
||||||
@by = $1
|
if $1 =~ /([^,]+),([^,]+)/
|
||||||
|
@by = $1
|
||||||
|
@title = $2.titlecase
|
||||||
|
else
|
||||||
|
@by = $1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
@ -54,15 +59,19 @@ module Jekyll
|
|||||||
source = parts.join('/')
|
source = parts.join('/')
|
||||||
source << '/…' unless source == @source
|
source << '/…' unless source == @source
|
||||||
end
|
end
|
||||||
cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
|
if !@source.nil?
|
||||||
quote_only = if @by.nil?
|
cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
|
||||||
|
elsif !@title.nil?
|
||||||
|
cite = "<cite>#{@title}</cite>"
|
||||||
|
end
|
||||||
|
blockquote = if @by.nil?
|
||||||
quote
|
quote
|
||||||
elsif !@source.nil?
|
elsif cite
|
||||||
"#{quote}<footer>#{author + cite}</footer>"
|
"#{quote}<footer>#{author + cite}</footer>"
|
||||||
else
|
else
|
||||||
"#{quote}<footer>#{author}</footer>"
|
"#{quote}<footer>#{author}</footer>"
|
||||||
end
|
end
|
||||||
"<blockquote>#{quote_only}</blockquote>"
|
"<blockquote>#{blockquote}</blockquote>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def paragraphize(input)
|
def paragraphize(input)
|
||||||
|
Loading…
Reference in New Issue
Block a user