From ffa9118e9ca4267a0c29a3edd065bf26915e1ce6 Mon Sep 17 00:00:00 2001 From: Jon Frisby Date: Thu, 21 Feb 2013 21:53:04 -0800 Subject: [PATCH] Grand whitespace cleanup. --- .powrc | 1 - Rakefile | 6 +++--- config.ru | 6 +++--- lib/Gemfile | 1 - lib/console | 1 - lib/octopress/configuration.rb | 4 ++-- lib/octopress/core_ext.rb | 6 +++--- lib/spec/octopress/configuration_spec.rb | 4 ++-- plugins/gist_tag.rb | 2 +- plugins/include_code.rb | 2 +- plugins/octopress_filters.rb | 1 - plugins/pagination.rb | 1 - plugins/pygments_code.rb | 8 ++++---- plugins/render_partial.rb | 4 ++-- plugins/sitemap_generator.rb | 1 - plugins/video_tag.rb | 1 - 16 files changed, 21 insertions(+), 28 deletions(-) diff --git a/.powrc b/.powrc index 4777f08..b70ad36 100644 --- a/.powrc +++ b/.powrc @@ -2,4 +2,3 @@ if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ] ; then source "$rvm_path/scripts/rvm" source ".rvmrc" fi - \ No newline at end of file diff --git a/Rakefile b/Rakefile index b19832d..936f6dd 100644 --- a/Rakefile +++ b/Rakefile @@ -353,7 +353,7 @@ task :set_root_dir, :dir do |t, args| site_configs[:subscribe_rss] = "#{dir}/atom.xml" site_configs[:root] = "/#{dir.sub(/^\//, '')}" configurator.write_config('site.yml', site_configs) - + rm_rf configuration[:destination] mkdir_p site_configs[:destination] puts "\n========================================================" @@ -456,7 +456,7 @@ end # usage rake list_posts or rake list_posts[pub|unpub] desc "List all unpublished/draft posts" task :list_drafts do - posts = Dir.glob("#{configuration[:source]}/#{configuration[:posts_dir]}/*.*") + posts = Dir.glob("#{configuration[:source]}/#{configuration[:posts_dir]}/*.*") unpublished = get_unpublished(posts) puts unpublished.empty? ? "There are no posts currently in draft" : unpublished end @@ -467,7 +467,7 @@ def get_unpublished(posts, options={}) posts.sort.each do |post| file = File.read(post) data = YAML.load file.match(/(^-{3}\n)(.+?)(\n-{3})/m)[2] - + if options[:no_future] future = Time.now < Time.parse(data['date'].to_s) ? "future date: #{data['date']}" : false end diff --git a/config.ru b/config.ru index 4b01539..c444156 100644 --- a/config.ru +++ b/config.ru @@ -4,7 +4,7 @@ require 'sinatra/base' # The project root directory $root = ::File.dirname(__FILE__) -class SinatraStaticServer < Sinatra::Base +class SinatraStaticServer < Sinatra::Base get(/.+/) do send_sinatra_file(unescape request.path) {404} @@ -16,10 +16,10 @@ class SinatraStaticServer < Sinatra::Base def send_sinatra_file(path, &missing_file_block) file_path = File.join(File.dirname(__FILE__), 'public', path) - file_path = File.join(file_path, 'index.html') unless file_path =~ /\.[a-z]+$/i + file_path = File.join(file_path, 'index.html') unless file_path =~ /\.[a-z]+$/i File.exist?(file_path) ? send_file(file_path) : missing_file_block.call end end -run SinatraStaticServer \ No newline at end of file +run SinatraStaticServer diff --git a/lib/Gemfile b/lib/Gemfile index 0366e84..485d68d 100644 --- a/lib/Gemfile +++ b/lib/Gemfile @@ -5,4 +5,3 @@ gem "rake", "~> 10.0" group :test do gem "rspec" end - diff --git a/lib/console b/lib/console index 86db944..c6f3ed0 100755 --- a/lib/console +++ b/lib/console @@ -15,4 +15,3 @@ ARGV.delete_if do |arg| end IRB.start - diff --git a/lib/octopress/configuration.rb b/lib/octopress/configuration.rb index 76b8a45..1c4abab 100644 --- a/lib/octopress/configuration.rb +++ b/lib/octopress/configuration.rb @@ -4,7 +4,7 @@ module Octopress class Configuration DEFAULT_CONFIG_DIR = File.join(File.dirname(__FILE__), '../', '../' '_config') attr_accessor :config_directory - + def initialize(config_dir = DEFAULT_CONFIG_DIR) self.config_directory = config_dir end @@ -79,7 +79,7 @@ module Octopress jekyll_configs = config.to_string_keys.to_yaml :canonical => false f.write(jekyll_configs) end - + jekyll_configs end diff --git a/lib/octopress/core_ext.rb b/lib/octopress/core_ext.rb index bf7bd5b..5459fa6 100644 --- a/lib/octopress/core_ext.rb +++ b/lib/octopress/core_ext.rb @@ -18,9 +18,9 @@ class Hash target end def to_symbol_keys - inject({}) { |memo,(k,v)| memo[k.to_sym] = v; memo } + inject({}) { |memo,(k,v)| memo[k.to_sym] = v; memo } end def to_string_keys - inject({}) { |memo,(k,v)| memo[k.to_s] = v; memo } + inject({}) { |memo,(k,v)| memo[k.to_s] = v; memo } end -end \ No newline at end of file +end diff --git a/lib/spec/octopress/configuration_spec.rb b/lib/spec/octopress/configuration_spec.rb index 908dc21..8f9ceb3 100644 --- a/lib/spec/octopress/configuration_spec.rb +++ b/lib/spec/octopress/configuration_spec.rb @@ -7,7 +7,7 @@ describe Octopress::Configuration do before do @octo_config = Octopress::Configuration.new(File.join(File.dirname(__FILE__), '../', 'fixtures', 'no_override')) end - + subject do @octo_config.read_configuration end @@ -27,7 +27,7 @@ describe Octopress::Configuration do before do @octo_config = Octopress::Configuration.new(File.join(File.dirname(__FILE__), '../', 'fixtures', 'override')) end - + subject do @octo_config.read_configuration end diff --git a/plugins/gist_tag.rb b/plugins/gist_tag.rb index 6f03edb..483d1c8 100644 --- a/plugins/gist_tag.rb +++ b/plugins/gist_tag.rb @@ -42,7 +42,7 @@ module Jekyll if parts = @markup.match(/([\d]*) (.*)/) gist, file = parts[1].strip, parts[2].strip - @options[:title] ||= file.empty? ? "Gist: #{gist}" : file + @options[:title] ||= file.empty? ? "Gist: #{gist}" : file @options[:url] ||= "https://gist.github.com/#{gist}" @options[:lang] ||= file.empty? ? @options[:lang] || '' : file.split('.')[-1] @options[:no_cache] = @cache_disabled diff --git a/plugins/include_code.rb b/plugins/include_code.rb index 21c3a41..9ac2104 100644 --- a/plugins/include_code.rb +++ b/plugins/include_code.rb @@ -67,7 +67,7 @@ module Jekyll puts "Update include for #{filepath}" puts "### --------------------------------- ###" end - + if File.symlink?(code_path) puts "Code directory '#{code_path}' cannot be a symlink" return "Code directory '#{code_path}' cannot be a symlink" diff --git a/plugins/octopress_filters.rb b/plugins/octopress_filters.rb index 62ee080..5ffeef6 100644 --- a/plugins/octopress_filters.rb +++ b/plugins/octopress_filters.rb @@ -119,4 +119,3 @@ module OctopressLiquidFilters end Liquid::Template.register_filter OctopressLiquidFilters - diff --git a/plugins/pagination.rb b/plugins/pagination.rb index a318754..c3ee2b1 100644 --- a/plugins/pagination.rb +++ b/plugins/pagination.rb @@ -118,4 +118,3 @@ module Jekyll end end - diff --git a/plugins/pygments_code.rb b/plugins/pygments_code.rb index 0ce0594..0ec5872 100644 --- a/plugins/pygments_code.rb +++ b/plugins/pygments_code.rb @@ -15,10 +15,10 @@ module HighlightCode include TemplateWrapper include SiteConfig def pygments(code, lang) - highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'}) + highlighted_code = Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8'}) highlighted_code = highlighted_code.gsub(/{{/, '{{').gsub(/{%/, '{%') highlighted_code.to_s - rescue + rescue puts $!,$@ end @@ -134,7 +134,7 @@ module HighlightCode url: (url.nil? ? nil : url[3] || url[5] || url[6]), start: (start.nil? ? nil : start[1].to_i), end: (endline.nil? ? nil : endline[1].to_i), - link_text: (link_text.nil? ? nil : link_text[3] || link_text[5] || link_text[6]) + link_text: (link_text.nil? ? nil : link_text[3] || link_text[5] || link_text[6]) } opts.merge(parse_range(input, opts[:start], opts[:end])) end @@ -172,7 +172,7 @@ module HighlightCode end {start: start, end: endline} end - + def get_range (code, start, endline) length = code.lines.count start ||= 1 diff --git a/plugins/render_partial.rb b/plugins/render_partial.rb index 916f9da..268300c 100644 --- a/plugins/render_partial.rb +++ b/plugins/render_partial.rb @@ -60,10 +60,10 @@ module Jekyll partial = Liquid::Template.parse(contents) context.stack do contents = partial.render(context) - + site = context.registers[:site] converter = site.converters.find { |c| c.matches(ext) } - + if converter.nil? contents else diff --git a/plugins/sitemap_generator.rb b/plugins/sitemap_generator.rb index fa20714..70d316a 100644 --- a/plugins/sitemap_generator.rb +++ b/plugins/sitemap_generator.rb @@ -309,4 +309,3 @@ module Jekyll end end end - diff --git a/plugins/video_tag.rb b/plugins/video_tag.rb index c6e67b7..60412fe 100644 --- a/plugins/video_tag.rb +++ b/plugins/video_tag.rb @@ -53,4 +53,3 @@ module Jekyll end Liquid::Template.register_tag('video', Jekyll::VideoTag) -