aboutsummaryrefslogtreecommitdiff
path: root/.themes/classic/plugins/blockquote.rb
diff options
context:
space:
mode:
authorBrandon Mathis <brandon@imathis.com>2011-07-19 09:06:54 -0400
committerBrandon Mathis <brandon@imathis.com>2011-07-19 09:06:54 -0400
commit17c59fb1d1bf3e0c05137af4b4bd09ae271a2d31 (patch)
treea4b3b5d43173f9b02ec4b6401cb6e14f6e716a35 /.themes/classic/plugins/blockquote.rb
parent873a604e144c53cfc5465a790e43db5b7ebb429e (diff)
downloadmy_new_personal_website-17c59fb1d1bf3e0c05137af4b4bd09ae271a2d31.tar.xz
my_new_personal_website-17c59fb1d1bf3e0c05137af4b4bd09ae271a2d31.zip
Moved plugins to root directory. I'm ditching the idea of shipping plugins with themes until it's more obviously necessary. This way it's easier to merge and update plugins.
Diffstat (limited to '.themes/classic/plugins/blockquote.rb')
-rw-r--r--.themes/classic/plugins/blockquote.rb74
1 files changed, 0 insertions, 74 deletions
diff --git a/.themes/classic/plugins/blockquote.rb b/.themes/classic/plugins/blockquote.rb
deleted file mode 100644
index d292ce8e..00000000
--- a/.themes/classic/plugins/blockquote.rb
+++ /dev/null
@@ -1,74 +0,0 @@
-#
-# Author: Brandon Mathis
-# 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
-#
-# {% blockquote Bobby Willis http://google.com/search?q=pants the search for bobby's pants %}
-# Wheeee!
-# {% endblockquote %}
-# ...
-# <blockquote>
-# <p>Wheeee!</p>
-# <footer>
-# <strong>Bobby Willis</strong><cite><a href="http://google.com/search?q=pants">The Search For Bobby's Pants</a>
-# </blockquote>
-#
-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]*)/
-
- def initialize(tag_name, markup, tokens)
- @by = nil
- @source = nil
- @title = nil
- if markup =~ FullCiteWithTitle
- @by = $1
- @source = $2 + $3
- @title = $4.titlecase
- elsif markup =~ FullCite
- @by = $1
- @source = $2 + $3
- elsif markup =~ Author
- @by = $1
- end
- super
- end
-
- def render(context)
- output = paragraphize(super.map(&:strip).join)
- author = "<strong>#{@by.strip}</strong>"
- if @source
- url = @source.match(/https?:\/\/(.+)/)[1].split('/')
- parts = []
- url.each do |part|
- if (parts + [part]).join('/').length < 32
- parts << part
- end
- end
- source = parts.join('/')
- source << '/&hellip;' unless source == @source
- end
- cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
- result = if @by.nil?
- output
- elsif !@source.nil?
- "#{output}<footer>#{author + cite}</footer>"
- else
- "#{output}<footer>#{author}</footer>"
- end
- "<blockquote>#{result}</blockquote>"
- end
-
- def paragraphize(input)
- "<p>#{input.gsub(/\n\n/, '</p><p>').gsub(/\n/, '<br/>')}</p>"
- end
- end
-end
-
-Liquid::Template.register_tag('blockquote', Jekyll::Blockquote)