|
|
@ -1,17 +1,17 @@
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Author: Brandon Mathis
|
|
|
|
# Author: Brandon Mathis
|
|
|
|
# Based on the work of: Josediaz Gonzalez - https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/blockquote.rb
|
|
|
|
# A full rewrite based on the work of: Josediaz Gonzalez - https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/blockquote.rb
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Outputs a string with a given attribution as a quote
|
|
|
|
# Outputs a string with a given attribution as a quote
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# {% blockquote Bobby Willis http://google.com/blah the search for bobby's mom %}
|
|
|
|
# {% blockquote Bobby Willis http://google.com/search?q=pants the search for bobby's pants %}
|
|
|
|
# Wheeee!
|
|
|
|
# Wheeee!
|
|
|
|
# {% endblockquote %}
|
|
|
|
# {% endblockquote %}
|
|
|
|
# ...
|
|
|
|
# ...
|
|
|
|
# <blockquote>
|
|
|
|
# <blockquote>
|
|
|
|
# <p>Wheeee!</p>
|
|
|
|
# <p>Wheeee!</p>
|
|
|
|
# <footer>
|
|
|
|
# <footer>
|
|
|
|
# <strong>Bobby Willis</strong><cite><a href="http://google.com/blah">The Search For Bobby's Mom</a>
|
|
|
|
# <strong>Bobby Willis</strong><cite><a href="http://google.com/search?q=pants">The Search For Bobby's Pants</a>
|
|
|
|
# </blockquote>
|
|
|
|
# </blockquote>
|
|
|
|
#
|
|
|
|
#
|
|
|
|
require './plugins/titlecase.rb'
|
|
|
|
require './plugins/titlecase.rb'
|
|
|
@ -19,9 +19,9 @@ require './plugins/titlecase.rb'
|
|
|
|
module Jekyll
|
|
|
|
module Jekyll
|
|
|
|
|
|
|
|
|
|
|
|
class Blockquote < Liquid::Block
|
|
|
|
class Blockquote < Liquid::Block
|
|
|
|
FullCiteWithTitle = /([\w\s]+)(https?:\/\/)(\S+\s)([\w\s]+)/i
|
|
|
|
FullCiteWithTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i
|
|
|
|
FullCite = /([\w\s]+)(https?:\/\/)(\S+)/i
|
|
|
|
FullCite = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i
|
|
|
|
Author = /([\w\s]+)/
|
|
|
|
Author = /(\S[\S\s]*)/
|
|
|
|
|
|
|
|
|
|
|
|
def initialize(tag_name, markup, tokens)
|
|
|
|
def initialize(tag_name, markup, tokens)
|
|
|
|
@by = nil
|
|
|
|
@by = nil
|
|
|
@ -55,14 +55,14 @@ module Jekyll
|
|
|
|
source << '/…' unless source == @source
|
|
|
|
source << '/…' unless source == @source
|
|
|
|
end
|
|
|
|
end
|
|
|
|
cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
|
|
|
|
cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
|
|
|
|
reply = if @by.nil?
|
|
|
|
result = if @by.nil?
|
|
|
|
output
|
|
|
|
output
|
|
|
|
elsif !@source.nil?
|
|
|
|
elsif !@source.nil?
|
|
|
|
"#{output}<footer>#{author + cite}</footer>"
|
|
|
|
"#{output}<footer>#{author + cite}</footer>"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
"#{output}<footer>#{author}</footer>"
|
|
|
|
"#{output}<footer>#{author}</footer>"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
"<blockquote>#{reply}</blockquote>"
|
|
|
|
"<blockquote>#{result}</blockquote>"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def paragraphize(input)
|
|
|
|
def paragraphize(input)
|
|
|
|