diff --git a/plugins/blockquote.rb b/plugins/blockquote.rb index e6388db..a0bf12c 100644 --- a/plugins/blockquote.rb +++ b/plugins/blockquote.rb @@ -19,9 +19,9 @@ require './plugins/titlecase.rb' module Jekyll class Blockquote < Liquid::Block - FullCiteWithTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i - FullCite = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i - Author = /(\S[\S\s]*)/ + FullCiteWithTitle = /(\S.*)\s+(https?:\/\/)(\S+)\s+(.+)/i + FullCite = /(\S.*)\s+(https?:\/\/)(\S+)/i + Author = /(.+)/ def initialize(tag_name, markup, tokens) @by = nil @@ -35,7 +35,12 @@ module Jekyll @by = $1 @source = $2 + $3 elsif markup =~ Author - @by = $1 + if $1 =~ /([^,]+),([^,]+)/ + @by = $1 + @title = $2.titlecase + else + @by = $1 + end end super end @@ -54,15 +59,19 @@ module Jekyll source = parts.join('/') source << '/…' unless source == @source end - cite = "#{(@title || source)}" - quote_only = if @by.nil? + if !@source.nil? + cite = "#{(@title || source)}" + elsif !@title.nil? + cite = "#{@title}" + end + blockquote = if @by.nil? quote - elsif !@source.nil? + elsif cite "#{quote}" else "#{quote}" end - "
#{quote_only}
" + "
#{blockquote}
" end def paragraphize(input)