aboutsummaryrefslogtreecommitdiff
path: root/plugins/blockquote.rb
diff options
context:
space:
mode:
authorZhiming Wang <zmwangx@gmail.com>2015-05-04 14:55:10 -0700
committerZhiming Wang <zmwangx@gmail.com>2015-05-04 14:55:10 -0700
commit301679861a2440a10c9eac746cec86459f445ef9 (patch)
tree5aad22ead01cf0da226623f603f33867896c0fea /plugins/blockquote.rb
parentd0a07c64afba47bbe8bfb56ba9893296a73fc7db (diff)
downloadmy_new_personal_website-301679861a2440a10c9eac746cec86459f445ef9.tar.xz
my_new_personal_website-301679861a2440a10c9eac746cec86459f445ef9.zip
remove all Octopress stuff
Diffstat (limited to '')
-rw-r--r--plugins/blockquote.rb82
1 files changed, 0 insertions, 82 deletions
diff --git a/plugins/blockquote.rb b/plugins/blockquote.rb
deleted file mode 100644
index ebdc0e89..00000000
--- a/plugins/blockquote.rb
+++ /dev/null
@@ -1,82 +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+(https?:\/\/)(\S+)\s+(.+)/i
- FullCite = /(\S.*)\s+(https?:\/\/)(\S+)/i
- AuthorTitle = /([^,]+),([^,]+)/
- Author = /(.+)/
-
- def initialize(tag_name, markup, tokens)
- @by = nil
- @source = nil
- @title = nil
- if markup =~ FullCiteWithTitle
- @by = $1
- @source = $2 + $3
- @title = $4.titlecase.strip
- elsif markup =~ FullCite
- @by = $1
- @source = $2 + $3
- elsif markup =~ AuthorTitle
- @by = $1
- @title = $2.titlecase.strip
- elsif markup =~ Author
- @by = $1
- end
- super
- end
-
- def render(context)
- quote = paragraphize(super)
- author = "<strong>#{@by.strip}</strong>" if @by
- 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
- if !@source.nil?
- cite = " <cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
- elsif !@title.nil?
- cite = " <cite>#{@title}</cite>"
- end
- blockquote = if @by.nil?
- quote
- elsif cite
- "#{quote}<footer>#{author + cite}</footer>"
- else
- "#{quote}<footer>#{author}</footer>"
- end
- "<blockquote>#{blockquote}</blockquote>"
- end
-
- def paragraphize(input)
- "<p>#{input.lstrip.rstrip.gsub(/\n\n/, '</p><p>').gsub(/\n/, '<br/>')}</p>"
- end
- end
-end
-
-Liquid::Template.register_tag('blockquote', Jekyll::Blockquote)