mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-26 09:28:52 -05:00
Merge pull request #1058 from MrJoy/grand_whitespace_cleanup
Grand whitespace cleanup.
This commit is contained in:
commit
b849ee56a3
1
.powrc
1
.powrc
@ -2,4 +2,3 @@ if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ] ; then
|
|||||||
source "$rvm_path/scripts/rvm"
|
source "$rvm_path/scripts/rvm"
|
||||||
source ".rvmrc"
|
source ".rvmrc"
|
||||||
fi
|
fi
|
||||||
|
|
6
Rakefile
6
Rakefile
@ -353,7 +353,7 @@ task :set_root_dir, :dir do |t, args|
|
|||||||
site_configs[:subscribe_rss] = "#{dir}/atom.xml"
|
site_configs[:subscribe_rss] = "#{dir}/atom.xml"
|
||||||
site_configs[:root] = "/#{dir.sub(/^\//, '')}"
|
site_configs[:root] = "/#{dir.sub(/^\//, '')}"
|
||||||
configurator.write_config('site.yml', site_configs)
|
configurator.write_config('site.yml', site_configs)
|
||||||
|
|
||||||
rm_rf configuration[:destination]
|
rm_rf configuration[:destination]
|
||||||
mkdir_p site_configs[:destination]
|
mkdir_p site_configs[:destination]
|
||||||
puts "\n========================================================"
|
puts "\n========================================================"
|
||||||
@ -456,7 +456,7 @@ end
|
|||||||
# usage rake list_posts or rake list_posts[pub|unpub]
|
# usage rake list_posts or rake list_posts[pub|unpub]
|
||||||
desc "List all unpublished/draft posts"
|
desc "List all unpublished/draft posts"
|
||||||
task :list_drafts do
|
task :list_drafts do
|
||||||
posts = Dir.glob("#{configuration[:source]}/#{configuration[:posts_dir]}/*.*")
|
posts = Dir.glob("#{configuration[:source]}/#{configuration[:posts_dir]}/*.*")
|
||||||
unpublished = get_unpublished(posts)
|
unpublished = get_unpublished(posts)
|
||||||
puts unpublished.empty? ? "There are no posts currently in draft" : unpublished
|
puts unpublished.empty? ? "There are no posts currently in draft" : unpublished
|
||||||
end
|
end
|
||||||
@ -467,7 +467,7 @@ def get_unpublished(posts, options={})
|
|||||||
posts.sort.each do |post|
|
posts.sort.each do |post|
|
||||||
file = File.read(post)
|
file = File.read(post)
|
||||||
data = YAML.load file.match(/(^-{3}\n)(.+?)(\n-{3})/m)[2]
|
data = YAML.load file.match(/(^-{3}\n)(.+?)(\n-{3})/m)[2]
|
||||||
|
|
||||||
if options[:no_future]
|
if options[:no_future]
|
||||||
future = Time.now < Time.parse(data['date'].to_s) ? "future date: #{data['date']}" : false
|
future = Time.now < Time.parse(data['date'].to_s) ? "future date: #{data['date']}" : false
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ require 'sinatra/base'
|
|||||||
# The project root directory
|
# The project root directory
|
||||||
$root = ::File.dirname(__FILE__)
|
$root = ::File.dirname(__FILE__)
|
||||||
|
|
||||||
class SinatraStaticServer < Sinatra::Base
|
class SinatraStaticServer < Sinatra::Base
|
||||||
|
|
||||||
get(/.+/) do
|
get(/.+/) do
|
||||||
send_sinatra_file(unescape request.path) {404}
|
send_sinatra_file(unescape request.path) {404}
|
||||||
@ -16,10 +16,10 @@ class SinatraStaticServer < Sinatra::Base
|
|||||||
|
|
||||||
def send_sinatra_file(path, &missing_file_block)
|
def send_sinatra_file(path, &missing_file_block)
|
||||||
file_path = File.join(File.dirname(__FILE__), 'public', path)
|
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
|
File.exist?(file_path) ? send_file(file_path) : missing_file_block.call
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
run SinatraStaticServer
|
run SinatraStaticServer
|
||||||
|
@ -5,4 +5,3 @@ gem "rake", "~> 10.0"
|
|||||||
group :test do
|
group :test do
|
||||||
gem "rspec"
|
gem "rspec"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -15,4 +15,3 @@ ARGV.delete_if do |arg|
|
|||||||
end
|
end
|
||||||
|
|
||||||
IRB.start
|
IRB.start
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ module Octopress
|
|||||||
class Configuration
|
class Configuration
|
||||||
DEFAULT_CONFIG_DIR = File.join(File.dirname(__FILE__), '../', '../' '_config')
|
DEFAULT_CONFIG_DIR = File.join(File.dirname(__FILE__), '../', '../' '_config')
|
||||||
attr_accessor :config_directory
|
attr_accessor :config_directory
|
||||||
|
|
||||||
def initialize(config_dir = DEFAULT_CONFIG_DIR)
|
def initialize(config_dir = DEFAULT_CONFIG_DIR)
|
||||||
self.config_directory = config_dir
|
self.config_directory = config_dir
|
||||||
end
|
end
|
||||||
@ -79,7 +79,7 @@ module Octopress
|
|||||||
jekyll_configs = config.to_string_keys.to_yaml :canonical => false
|
jekyll_configs = config.to_string_keys.to_yaml :canonical => false
|
||||||
f.write(jekyll_configs)
|
f.write(jekyll_configs)
|
||||||
end
|
end
|
||||||
|
|
||||||
jekyll_configs
|
jekyll_configs
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@ class Hash
|
|||||||
target
|
target
|
||||||
end
|
end
|
||||||
def to_symbol_keys
|
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
|
end
|
||||||
def to_string_keys
|
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
|
||||||
end
|
end
|
||||||
|
@ -7,7 +7,7 @@ describe Octopress::Configuration do
|
|||||||
before do
|
before do
|
||||||
@octo_config = Octopress::Configuration.new(File.join(File.dirname(__FILE__), '../', 'fixtures', 'no_override'))
|
@octo_config = Octopress::Configuration.new(File.join(File.dirname(__FILE__), '../', 'fixtures', 'no_override'))
|
||||||
end
|
end
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
@octo_config.read_configuration
|
@octo_config.read_configuration
|
||||||
end
|
end
|
||||||
@ -27,7 +27,7 @@ describe Octopress::Configuration do
|
|||||||
before do
|
before do
|
||||||
@octo_config = Octopress::Configuration.new(File.join(File.dirname(__FILE__), '../', 'fixtures', 'override'))
|
@octo_config = Octopress::Configuration.new(File.join(File.dirname(__FILE__), '../', 'fixtures', 'override'))
|
||||||
end
|
end
|
||||||
|
|
||||||
subject do
|
subject do
|
||||||
@octo_config.read_configuration
|
@octo_config.read_configuration
|
||||||
end
|
end
|
||||||
|
@ -42,7 +42,7 @@ module Jekyll
|
|||||||
if parts = @markup.match(/([\d]*) (.*)/)
|
if parts = @markup.match(/([\d]*) (.*)/)
|
||||||
gist, file = parts[1].strip, parts[2].strip
|
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[:url] ||= "https://gist.github.com/#{gist}"
|
||||||
@options[:lang] ||= file.empty? ? @options[:lang] || '' : file.split('.')[-1]
|
@options[:lang] ||= file.empty? ? @options[:lang] || '' : file.split('.')[-1]
|
||||||
@options[:no_cache] = @cache_disabled
|
@options[:no_cache] = @cache_disabled
|
||||||
|
@ -67,7 +67,7 @@ module Jekyll
|
|||||||
puts "Update include for #{filepath}"
|
puts "Update include for #{filepath}"
|
||||||
puts "### --------------------------------- ###"
|
puts "### --------------------------------- ###"
|
||||||
end
|
end
|
||||||
|
|
||||||
if File.symlink?(code_path)
|
if File.symlink?(code_path)
|
||||||
puts "Code directory '#{code_path}' cannot be a symlink"
|
puts "Code directory '#{code_path}' cannot be a symlink"
|
||||||
return "Code directory '#{code_path}' cannot be a symlink"
|
return "Code directory '#{code_path}' cannot be a symlink"
|
||||||
|
@ -119,4 +119,3 @@ module OctopressLiquidFilters
|
|||||||
|
|
||||||
end
|
end
|
||||||
Liquid::Template.register_filter OctopressLiquidFilters
|
Liquid::Template.register_filter OctopressLiquidFilters
|
||||||
|
|
||||||
|
@ -118,4 +118,3 @@ module Jekyll
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -15,10 +15,10 @@ module HighlightCode
|
|||||||
include TemplateWrapper
|
include TemplateWrapper
|
||||||
include SiteConfig
|
include SiteConfig
|
||||||
def pygments(code, lang)
|
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 = highlighted_code.gsub(/{{/, '{{').gsub(/{%/, '{%')
|
||||||
highlighted_code.to_s
|
highlighted_code.to_s
|
||||||
rescue
|
rescue
|
||||||
puts $!,$@
|
puts $!,$@
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -134,7 +134,7 @@ module HighlightCode
|
|||||||
url: (url.nil? ? nil : url[3] || url[5] || url[6]),
|
url: (url.nil? ? nil : url[3] || url[5] || url[6]),
|
||||||
start: (start.nil? ? nil : start[1].to_i),
|
start: (start.nil? ? nil : start[1].to_i),
|
||||||
end: (endline.nil? ? nil : endline[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]))
|
opts.merge(parse_range(input, opts[:start], opts[:end]))
|
||||||
end
|
end
|
||||||
@ -172,7 +172,7 @@ module HighlightCode
|
|||||||
end
|
end
|
||||||
{start: start, end: endline}
|
{start: start, end: endline}
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_range (code, start, endline)
|
def get_range (code, start, endline)
|
||||||
length = code.lines.count
|
length = code.lines.count
|
||||||
start ||= 1
|
start ||= 1
|
||||||
|
@ -60,10 +60,10 @@ module Jekyll
|
|||||||
partial = Liquid::Template.parse(contents)
|
partial = Liquid::Template.parse(contents)
|
||||||
context.stack do
|
context.stack do
|
||||||
contents = partial.render(context)
|
contents = partial.render(context)
|
||||||
|
|
||||||
site = context.registers[:site]
|
site = context.registers[:site]
|
||||||
converter = site.converters.find { |c| c.matches(ext) }
|
converter = site.converters.find { |c| c.matches(ext) }
|
||||||
|
|
||||||
if converter.nil?
|
if converter.nil?
|
||||||
contents
|
contents
|
||||||
else
|
else
|
||||||
|
@ -309,4 +309,3 @@ module Jekyll
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -53,4 +53,3 @@ module Jekyll
|
|||||||
end
|
end
|
||||||
|
|
||||||
Liquid::Template.register_tag('video', Jekyll::VideoTag)
|
Liquid::Template.register_tag('video', Jekyll::VideoTag)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user