| ... | ... |
@@ -1,17 +1,17 @@ |
| 1 | 1 |
# |
| 2 | 2 |
# Author: Brandon Mathis |
| 3 |
-# Based on the work of: Josediaz Gonzalez - https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/blockquote.rb |
|
| 3 |
+# A full rewrite based on the work of: Josediaz Gonzalez - https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/blockquote.rb |
|
| 4 | 4 |
# |
| 5 | 5 |
# Outputs a string with a given attribution as a quote |
| 6 | 6 |
# |
| 7 |
-# {% blockquote Bobby Willis http://google.com/blah the search for bobby's mom %}
|
|
| 7 |
+# {% blockquote Bobby Willis http://google.com/search?q=pants the search for bobby's pants %}
|
|
| 8 | 8 |
# Wheeee! |
| 9 | 9 |
# {% endblockquote %}
|
| 10 | 10 |
# ... |
| 11 | 11 |
# <blockquote> |
| 12 | 12 |
# <p>Wheeee!</p> |
| 13 | 13 |
# <footer> |
| 14 |
-# <strong>Bobby Willis</strong><cite><a href="http://google.com/blah">The Search For Bobby's Mom</a> |
|
| 14 |
+# <strong>Bobby Willis</strong><cite><a href="http://google.com/search?q=pants">The Search For Bobby's Pants</a> |
|
| 15 | 15 |
# </blockquote> |
| 16 | 16 |
# |
| 17 | 17 |
require './plugins/titlecase.rb' |
| ... | ... |
@@ -19,9 +19,9 @@ require './plugins/titlecase.rb' |
| 19 | 19 |
module Jekyll |
| 20 | 20 |
|
| 21 | 21 |
class Blockquote < Liquid::Block |
| 22 |
- FullCiteWithTitle = /([\w\s]+)(https?:\/\/)(\S+\s)([\w\s]+)/i |
|
| 23 |
- FullCite = /([\w\s]+)(https?:\/\/)(\S+)/i |
|
| 24 |
- Author = /([\w\s]+)/ |
|
| 22 |
+ FullCiteWithTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i |
|
| 23 |
+ FullCite = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i |
|
| 24 |
+ Author = /(\S[\S\s]*)/ |
|
| 25 | 25 |
|
| 26 | 26 |
def initialize(tag_name, markup, tokens) |
| 27 | 27 |
@by = nil |
| ... | ... |
@@ -55,14 +55,14 @@ module Jekyll |
| 55 | 55 |
source << '/…' unless source == @source |
| 56 | 56 |
end |
| 57 | 57 |
cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
|
| 58 |
- reply = if @by.nil? |
|
| 58 |
+ result = if @by.nil? |
|
| 59 | 59 |
output |
| 60 | 60 |
elsif !@source.nil? |
| 61 | 61 |
"#{output}<footer>#{author + cite}</footer>"
|
| 62 | 62 |
else |
| 63 | 63 |
"#{output}<footer>#{author}</footer>"
|
| 64 | 64 |
end |
| 65 |
- "<blockquote>#{reply}</blockquote>"
|
|
| 65 |
+ "<blockquote>#{result}</blockquote>"
|
|
| 66 | 66 |
end |
| 67 | 67 |
|
| 68 | 68 |
def paragraphize(input) |