aboutsummaryrefslogtreecommitdiff
path: root/_plugins
diff options
context:
space:
mode:
Diffstat (limited to '_plugins')
-rw-r--r--_plugins/blockquote.rb109
-rw-r--r--_plugins/category.rb65
-rw-r--r--_plugins/compass_compiler.rb1
-rw-r--r--_plugins/custom_filters.rb59
-rw-r--r--_plugins/generate_sitemap.rb133
-rw-r--r--_plugins/gist_tag.rb83
-rw-r--r--_plugins/haml.rb24
-rw-r--r--_plugins/iterator.rb49
-rw-r--r--_plugins/pygments_cache_patch.rb30
-rw-r--r--_plugins/titlecase.rb36
10 files changed, 0 insertions, 589 deletions
diff --git a/_plugins/blockquote.rb b/_plugins/blockquote.rb
deleted file mode 100644
index 7a885175..00000000
--- a/_plugins/blockquote.rb
+++ /dev/null
@@ -1,109 +0,0 @@
-#
-# Author: Josediaz Gonzalez - https://github.com/josegonzalez
-# Source URL: https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/blockquote.rb
-# Modified by Brandon Mathis
-#
-require './_plugins/titlecase.rb'
-module Jekyll
-
- # Outputs a string with a given attribution as a quote
- #
- # {% blockquote John Paul Jones %}
- # Monkeys!
- # {% endblockquote %}
- # ...
- # <blockquote>
- # Monkeys!
- # <br />
- # John Paul Jones
- # </blockquote>
- #
- class Blockquote < Liquid::Block
- FullCiteWithTitle = /([\w\s]+)(https?:\/\/)(\S+\s)([\w\s]+)/i
- FullCite = /([\w\s]+)(https?:\/\/)(\S+)/i
- Author = /([\w\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 = super
- if @by.nil?
- '<blockquote><p>' + output.join + '</p></blockquote>'
- elsif !@title.nil?
- '<blockquote><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + '<a class="source" href="' + @source + '">' + @title + '</a></cite></p>'
- elsif !@source.nil?
- '<blockquote><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + '<a class="source" href="' + @source + '">source</a></cite></p>'
- else
- '<blockquote><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong></cite></p>'
- end
- end
- end
-
- # Outputs a string with a given attribution as a pullquote
- #
- # {% blockquote John Paul Jones %}
- # Monkeys!
- # {% endblockquote %}
- # ...
- # <blockquote class="pullquote">
- # Monkeys!
- # <br />
- # John Paul Jones
- # </blockquote>
- #
- class Pullquote < Liquid::Block
- FullCiteWithTitle = /([\w\s]+)(http:\/\/|https:\/\/)(\S+)([\w\s]+)/i
- FullCite = /([\w\s]+)(http:\/\/|https:\/\/)(\S+)/i
- Author = /([\w\s]+)/
-
- def initialize(tag_name, markup, tokens)
- @by = nil
- @source = nil
- @title = nil
- if markup =~ FullCiteWithTitle
- @by = $1
- @source = $2 + $3
- @title = $4
- elsif markup =~ FullCite
- @by = $1
- @source = $2 + $3
- elsif markup =~ Author
- @by = $1
- end
- super
- end
-
- def render(context)
- output = super
- if @by.nil?
- '<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>'
- elsif @title
- '<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + ' <a class="source" href="' + @source + '">' + @title + '</a></cite></p>'
- elsif @source
- '<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong>' + ' <a class="source" href="' + @source + '">source</a></cite></p>'
- elsif @by
- '<blockquote class="pullquote"><p>' + output.join + '</p></blockquote>' + '<p><cite><strong>' + @by + '</strong></cite></p>'
- end
- end
- end
-end
-
-Liquid::Template.register_tag('blockquote', Jekyll::Blockquote)
-Liquid::Template.register_tag('pullquote', Jekyll::Pullquote)
-
-
diff --git a/_plugins/category.rb b/_plugins/category.rb
deleted file mode 100644
index b9accdec..00000000
--- a/_plugins/category.rb
+++ /dev/null
@@ -1,65 +0,0 @@
-module Jekyll
-
- class CategoryIndex < Page
- def initialize(site, base, dir, category)
- @site = site
- @base = base
- @dir = dir
- @name = 'index.html'
-
- self.process(@name)
- self.read_yaml(File.join(base, '_layouts'), 'category_index.html')
- self.data['category'] = category
-
- category_title_prefix = site.config['category_title_prefix'] || 'Category: '
- self.data['title'] = "#{category_title_prefix}#{category}"
- end
- end
-
- class CategoryList < Page
- def initialize(site, base, dir, categories)
- @site = site
- @base = base
- @dir = dir
- @name = 'index.html'
-
- self.process(@name)
- self.read_yaml(File.join(base, '_layouts'), 'category_list.html')
- self.data['categories'] = categories
- end
- end
-
- class CategoryGenerator < Generator
- safe true
-
- def generate(site)
- if site.layouts.key? 'category_index'
- dir = site.config['category_dir'] || 'categories'
- site.categories.keys.each do |category|
- write_category_index(site, File.join(dir, category.gsub(/\s/, "-").gsub(/[^\w-]/, '').downcase), category)
- end
- end
-
- if site.layouts.key? 'category_list'
- dir = site.config['category_dir'] || 'categories'
- write_category_list(site, dir, site.categories.keys.sort)
- end
- end
-
- def write_category_index(site, dir, category)
- index = CategoryIndex.new(site, site.source, dir, category)
- index.render(site.layouts, site.site_payload)
- index.write(site.dest)
- site.static_files << index
- end
-
- def write_category_list(site, dir, categories)
- index = CategoryList.new(site, site.source, dir, categories)
- index.render(site.layouts, site.site_payload)
- index.write(site.dest)
- site.static_files << index
- end
- end
-
-end
-
diff --git a/_plugins/compass_compiler.rb b/_plugins/compass_compiler.rb
deleted file mode 100644
index dcec746a..00000000
--- a/_plugins/compass_compiler.rb
+++ /dev/null
@@ -1 +0,0 @@
-system "compass compile --css-dir source/stylesheets"
diff --git a/_plugins/custom_filters.rb b/_plugins/custom_filters.rb
deleted file mode 100644
index 158586af..00000000
--- a/_plugins/custom_filters.rb
+++ /dev/null
@@ -1,59 +0,0 @@
-#custom filters for Octopress
-
-module OctopressFilters
- def exerpt(input, url, url_text="Reade more&hellip;", permalink_text=false)
- if input.index(/<!--\s?more\s?-->/i)
- input.split(/<!--\s?more\s?-->/i)[0] + "<p><a href='#{url}'>#{url_text}</a></p>"
- elsif permalink_text
- input + "<p><a href='#{url}'>#{permalink_text}</a></p>"
- else
- input
- end
- end
- def full_urls(input, url='')
- input.gsub /(\s+(href|src)\s*=\s*["|']{1})(\/[^\"'>]+)/ do
- $1+url+$3
- end
- end
- def search_url(input)
- input.gsub /(http:\/\/)(\S+)/ do
- $2
- end
- end
- def smart_quotes(input)
- require 'rubypants'
- RubyPants.new(input).to_html
- end
- def titlecase(input)
- input.titlecase
- end
- def datetime(date)
- if date.class == String
- date = Time.parse(date)
- end
- date
- end
- def ordinalize(date)
- date = datetime(date)
- "#{date.strftime('%B')} #{ordinal(date.strftime('%e').to_i)}, #{date.strftime('%Y')}"
- end
- def ordinal(number)
- if (11..13).include?(number.to_i % 100)
- "#{number}<span>th</span>"
- else
- case number.to_i % 10
- when 1; "#{number}<span>st</span>"
- when 2; "#{number}<span>nd<span>"
- when 3; "#{number}<span>rd</span>"
- else "#{number}<span>th</span>"
- end
- end
- end
- #YearlyPost = Struct.new('YearlyPost', :year, :posts)
- def yearly_posts(site)
- #site.posts.reverse.group_by { |p| p.date.strftime("%Y") }.map { |k,v| YearlyPost.new(k,v) }
- site
- end
-end
-Liquid::Template.register_filter OctopressFilters
-
diff --git a/_plugins/generate_sitemap.rb b/_plugins/generate_sitemap.rb
deleted file mode 100644
index 4d580c47..00000000
--- a/_plugins/generate_sitemap.rb
+++ /dev/null
@@ -1,133 +0,0 @@
-# Jekyll sitemap page generator.
-# http://recursive-design.com/projects/jekyll-plugins/
-#
-# Version: 0.1.3 (201101061053)
-#
-# Copyright (c) 2010 Dave Perrett, http://recursive-design.com/
-# Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
-#
-# A generator that creates a sitemap.xml page for jekyll sites, suitable for submission to
-# google etc.
-#
-# To use it, simply drop this script into the _plugins directory of your Jekyll site.
-#
-# When you compile your jekyll site, this plugin will loop through the list of pages in your
-# site, and generate an entry in sitemap.xml for each one.
-
-require 'pathname'
-
-module Jekyll
-
-
- # Monkey-patch an accessor for a page's containing folder, since
- # we need it to generate the sitemap.
- class Page
- def subfolder
- @dir
- end
- end
-
-
- # Sub-class Jekyll::StaticFile to allow recovery from unimportant exception
- # when writing the sitemap file.
- class StaticSitemapFile < StaticFile
- def write(dest)
- super(dest) rescue ArgumentError
- true
- end
- end
-
-
- # Generates a sitemap.xml file containing URLs of all pages and posts.
- class SitemapGenerator < Generator
- safe true
- priority :low
-
- # Domain that you are generating the sitemap for - update this to match your site.
-
- # Generates the sitemap.xml file.
- #
- # +site+ is the global Site object.
- def generate(site)
- # Create the destination folder if necessary.
- site_folder = site.config['destination']
- unless File.directory?(site_folder)
- p = Pathname.new(site_folder)
- p.mkdir
- end
-
- # Write the contents of sitemap.xml.
- File.open(File.join(site_folder, 'sitemap.xml'), 'w') do |f|
- f.write(generate_header())
- f.write(generate_content(site))
- f.write(generate_footer())
- f.close
- end
-
- # Add a static file entry for the zip file, otherwise Site::cleanup will remove it.
- site.static_files << Jekyll::StaticSitemapFile.new(site, site.dest, '/', 'sitemap.xml')
- end
-
- private
-
- # Returns the XML header.
- def generate_header
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">"
- end
-
- # Returns a string containing the the XML entries.
- #
- # +site+ is the global Site object.
- def generate_content(site)
- result = ''
-
- base_url = site.config['url']
-
- # First, try to find any stand-alone pages.
- site.pages.each{ |page|
- path = page.subfolder + '/' + page.name
- mod_date = File.mtime(site.source + path)
-
- # Remove the trailing 'index.html' if there is one, and just output the folder name.
- if path=~/index.html$/
- path = path[0..-11]
- end
-
- unless path =~/error/
- result += entry(base_url, path, mod_date)
- end
- }
-
- # Next, find all the posts.
- posts = site.site_payload['site']['posts']
- for post in posts do
- result += entry(base_url, post.id, post.date)
- end
-
- result
- end
-
- # Returns the XML footer.
- def generate_footer
- "\n</urlset>"
- end
-
- # Creates an XML entry from the given path and date.
- #
- # +path+ is the URL path to the page.
- # +date+ is the date the file was modified (in the case of regular pages), or published (for blog posts).
- def entry(base_url, path, date)
- # Force extensions to .html from markdown, textile.
- path = path.gsub(/\.(markdown|textile)$/i, '.html')
- "
- <url>
- <loc>#{base_url}#{path}</loc>
- <lastmod>#{date.strftime("%Y-%m-%d")}</lastmod>
- </url>"
- end
-
- end
-
-end
-
-
diff --git a/_plugins/gist_tag.rb b/_plugins/gist_tag.rb
deleted file mode 100644
index 1f37416e..00000000
--- a/_plugins/gist_tag.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-# Nicked from Brandon Tilly
-# Gist https://gist.github.com/803483
-# Post http://brandontilley.com/2011/01/31/gist-tag-for-jekyll.html
-#
-# Example usage: {% gist 803483 gist_tag.rb %} //embeds a gist for this plugin
-
-require 'digest/md5'
-require 'net/https'
-require 'uri'
-
-module Jekyll
- class GistTag < Liquid::Tag
- def initialize(tag_name, text, token)
- super
- system('mkdir -p .gist_cache')
- @text = text
- @cache = true
- @cache_folder = File.expand_path "../.gist_cache", File.dirname(__FILE__)
- end
-
- def render(context)
- return "" unless @text =~ /([\d]*) (.*)/
-
- gist, file = $1.strip, $2.strip
- script_url = "https://gist.github.com/#{gist}.js?file=#{file}"
-
- code = get_cached_gist(gist, file) || get_gist_from_web(gist, file)
- code = code.gsub "<", "&lt;"
- string = "<script src='#{script_url}'></script>"
- string += "<noscript><pre><code>#{code}</code></pre></noscript>"
- return string
- end
-
- def get_gist_url_for(gist, file)
- "https://gist.github.com/raw/#{gist}/#{file}"
- end
-
- def cache_gist(gist, file, data)
- file = get_cache_file_for gist, file
- File.open(file, "w+") do |f|
- f.write(data)
- end
- end
-
- def get_cached_gist(gist, file)
- return nil if @cache == false
- file = get_cache_file_for gist, file
- return nil unless File.exist?(file)
- return File.new(file).readlines.join
- end
-
- def get_cache_file_for(gist, file)
- gist.gsub! /[^a-zA-Z0-9\-_\.]/, ''
- file.gsub! /[^a-zA-Z0-9\-_\.]/, ''
- md5 = Digest::MD5.hexdigest "#{gist}-#{file}"
- File.join @cache_folder, "#{gist}-#{file}-#{md5}.cache"
- end
-
- def get_gist_from_web(gist, file)
- gist_url = get_gist_url_for(gist, file)
- raw_uri = URI.parse(gist_url)
- https = Net::HTTP.new(raw_uri.host, raw_uri.port)
- https.use_ssl = true
- https.verify_mode = OpenSSL::SSL::VERIFY_NONE
- request = Net::HTTP::Get.new(raw_uri.request_uri)
- data = https.request(request)
- data = data.body
- cache_gist(gist, file, data) unless @cache == false
- data
- end
- end
-
- class GistTagNoCache < GistTag
- def initialize(tag_name, text, token)
- super
- @cache = false
- end
- end
-end
-
-Liquid::Template.register_tag('gist', Jekyll::GistTag)
-Liquid::Template.register_tag('gistnocache', Jekyll::GistTagNoCache)
-
diff --git a/_plugins/haml.rb b/_plugins/haml.rb
deleted file mode 100644
index 7e548dec..00000000
--- a/_plugins/haml.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-module Jekyll
- require 'haml'
- class HamlConverter < Converter
- safe true
- priority :low
-
- def matches(ext)
- ext =~ /haml/i
- end
-
- def output_ext(ext)
- ".html"
- end
-
- def convert(content)
- begin
- engine = Haml::Engine.new(content)
- engine.render
- rescue StandardError => e
- puts "!!! HAML Error: " + e.message
- end
- end
- end
-end
diff --git a/_plugins/iterator.rb b/_plugins/iterator.rb
deleted file mode 100644
index da0b5f0a..00000000
--- a/_plugins/iterator.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-##
-## Author: Jose Gonzalez - https://github.com/josegonzalez
-## Source URL: https://github.com/josegonzalez/josediazgonzalez.com/blob/master/_plugins/iterator.rb
-##
-
-#module Jekyll
- #class Site
- #alias_method :orig_site_payload, :site_payload
-
- ## Constuct an array of hashes that will allow the user, using Liquid, to
- ## iterate through the keys of _kv_hash_ and be able to iterate through the
- ## elements under each key.
- ##
- ## Example:
- ## categories = { 'Ruby' => [<Post>, <Post>] }
- ## make_iterable(categories, :index => 'name', :items => 'posts')
- ## Will allow the user to iterate through all categories and then iterate
- ## though each post in the current category like so:
- ## {% for category in site.categories %}
- ## h1. {{ category.name }}
- ## <ul>
- ## {% for post in category.posts %}
- ## <li>{{ post.title }}</li>
- ## {% endfor %}
- ## </ul>
- ## {% endfor %}
- ##
- ## Returns [ {<index> => <kv_hash_key>, <items> => kv_hash[<kv_hash_key>]}, ... ]
-
- #def make_iterable(kv_hash, options)
- #options = {:index => 'name', :items => 'items'}.merge(options)
- #result = []
- #kv_hash.sort.each do |key, value|
- #result << { options[:index] => key, options[:items] => value }
- #end
- #result
- #end
-
- #def site_payload
- #payload = orig_site_payload
- #payload['site']['iterable'].merge!({
- #'categories' => make_iterable(self.categories, :index => 'name', :items => 'posts'),
- #'tags' => make_iterable(self.tags, :index => 'name', :items => 'posts')
- #})
- #payload
- #end
-
- #end
-#end
diff --git a/_plugins/pygments_cache_patch.rb b/_plugins/pygments_cache_patch.rb
deleted file mode 100644
index 36c78d20..00000000
--- a/_plugins/pygments_cache_patch.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-#
-# Author: Raimonds Simanovskis, http://blog.rayapps.com/
-# Source URL: https://github.com/rsim/blog.rayapps.com/blob/master/_plugins/pygments_cache_patch.rb
-#
-
-require 'fileutils'
-require 'digest/md5'
-
-PYGMENTS_CACHE_DIR = File.expand_path('../../_cache', __FILE__)
-FileUtils.mkdir_p(PYGMENTS_CACHE_DIR)
-
-Jekyll::HighlightBlock.class_eval do
- def render_pygments(context, code)
- if defined?(PYGMENTS_CACHE_DIR)
- path = File.join(PYGMENTS_CACHE_DIR, "#{@lang}-#{Digest::MD5.hexdigest(code)}.html")
- if File.exist?(path)
- highlighted_code = File.read(path)
- else
- highlighted_code = Albino.new(code, @lang).to_s(@options)
- File.open(path, 'w') {|f| f.print(highlighted_code) }
- end
- else
- highlighted_code = Albino.new(code, @lang).to_s(@options)
- end
- output = add_code_tags(highlighted_code, @lang)
- output = context["pygments_prefix"] + output if context["pygments_prefix"]
- output = output + context["pygments_suffix"] if context["pygments_suffix"]
- output
- end
-end
diff --git a/_plugins/titlecase.rb b/_plugins/titlecase.rb
deleted file mode 100644
index 103bf702..00000000
--- a/_plugins/titlecase.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-class String
- def titlecase
- small_words = %w(a an and as at but by en for if in of on or the to v v. via vs vs.)
-
- x = split(" ").map do |word|
- # note: word could contain non-word characters!
- # downcase all small_words, capitalize the rest
- small_words.include?(word.gsub(/\W/, "").downcase) ? word.downcase! : word.smart_capitalize!
- word
- end
- # capitalize first and last words
- x.first.to_s.smart_capitalize!
- x.last.to_s.smart_capitalize!
- # small words after colons are capitalized
- x.join(" ").gsub(/:\s?(\W*#{small_words.join("|")}\W*)\s/) { ": #{$1.smart_capitalize} " }
- end
-
- def titlecase!
- replace(titlecase)
- end
-
- def smart_capitalize
- # ignore any leading crazy characters and capitalize the first real character
- if self =~ /^['"\(\[']*([a-z])/
- i = index($1)
- x = self[i,self.length]
- # word with capitals and periods mid-word are left alone
- self[i,1] = self[i,1].upcase unless x =~ /[A-Z]/ or x =~ /\.\w+/
- end
- self
- end
-
- def smart_capitalize!
- replace(smart_capitalize)
- end
-end