| ... | ... |
@@ -19,9 +19,9 @@ require './plugins/titlecase.rb' |
| 19 | 19 |
module Jekyll |
| 20 | 20 |
|
| 21 | 21 |
class Blockquote < Liquid::Block |
| 22 |
- FullCiteWithTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i |
|
| 23 |
- FullCite = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i |
|
| 24 |
- Author = /(\S[\S\s]*)/ |
|
| 22 |
+ FullCiteWithTitle = /(\S.*)\s+(https?:\/\/)(\S+)\s+(.+)/i |
|
| 23 |
+ FullCite = /(\S.*)\s+(https?:\/\/)(\S+)/i |
|
| 24 |
+ Author = /(.+)/ |
|
| 25 | 25 |
|
| 26 | 26 |
def initialize(tag_name, markup, tokens) |
| 27 | 27 |
@by = nil |
| ... | ... |
@@ -35,7 +35,12 @@ module Jekyll |
| 35 | 35 |
@by = $1 |
| 36 | 36 |
@source = $2 + $3 |
| 37 | 37 |
elsif markup =~ Author |
| 38 |
- @by = $1 |
|
| 38 |
+ if $1 =~ /([^,]+),([^,]+)/ |
|
| 39 |
+ @by = $1 |
|
| 40 |
+ @title = $2.titlecase |
|
| 41 |
+ else |
|
| 42 |
+ @by = $1 |
|
| 43 |
+ end |
|
| 39 | 44 |
end |
| 40 | 45 |
super |
| 41 | 46 |
end |
| ... | ... |
@@ -54,15 +59,19 @@ module Jekyll |
| 54 | 54 |
source = parts.join('/')
|
| 55 | 55 |
source << '/…' unless source == @source |
| 56 | 56 |
end |
| 57 |
- cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
|
|
| 58 |
- quote_only = if @by.nil? |
|
| 57 |
+ if !@source.nil? |
|
| 58 |
+ cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
|
|
| 59 |
+ elsif !@title.nil? |
|
| 60 |
+ cite = "<cite>#{@title}</cite>"
|
|
| 61 |
+ end |
|
| 62 |
+ blockquote = if @by.nil? |
|
| 59 | 63 |
quote |
| 60 |
- elsif !@source.nil? |
|
| 64 |
+ elsif cite |
|
| 61 | 65 |
"#{quote}<footer>#{author + cite}</footer>"
|
| 62 | 66 |
else |
| 63 | 67 |
"#{quote}<footer>#{author}</footer>"
|
| 64 | 68 |
end |
| 65 |
- "<blockquote>#{quote_only}</blockquote>"
|
|
| 69 |
+ "<blockquote>#{blockquote}</blockquote>"
|
|
| 66 | 70 |
end |
| 67 | 71 |
|
| 68 | 72 |
def paragraphize(input) |