Merge branch '2.1' of github.com:imathis/octopress into 2.1

* '2.1' of github.com:imathis/octopress:
  Adding a default for comment disabling.
  Make it possible to disable the comments section entirely without having to muck with theme files.
  An update of rretsiem's pull request, for 2.1.
  Removal of apparently unreferenced, dangling method.
  Grand whitespace cleanup.
  Some Jekyll plugins confuse Compass by mucking around with the CWD.
  Allow .md for markdown files.
  Bring over a couple little things from master...
  Simplifying clean task.
  Fix static reference to instance method in Compass' config.
  Remove cruft from Gemfile.lock since rspec is no longer specified in the Gemfile.
  Ignore all generated JS bundles, preview-mode flag, generated _config.yml, and most editor temp files.
  Remove redundant require statement from Rakefile.
  Bump Rack version to leverage security fixes.
This commit is contained in:
Parker Moore 2013-02-28 12:23:29 +01:00
commit bd6b92a5e3
27 changed files with 54 additions and 60 deletions

6
.gitignore vendored
View File

@ -1,5 +1,7 @@
.bundle
.DS_Store
*.sw[mnop]
*~
.sass-cache
.gist-cache
.pygments-cache
@ -9,7 +11,9 @@ sass.old
source.old
source/_stash
source/stylesheets/screen.css
source/javascripts/octopress.min.js
source/javascripts/*.min.js
source/images/icon-*.png
vendor
node_modules
/.preview-mode
/_config.yml

1
.powrc
View File

@ -2,4 +2,3 @@ if [ -f "$rvm_path/scripts/rvm" ] && [ -f ".rvmrc" ] ; then
source "$rvm_path/scripts/rvm"
source ".rvmrc"
fi

View File

@ -1,3 +1,4 @@
{% if site.use_comments %}
<section>
<h1>Comments</h1>
{% include custom/comments.html %}
@ -5,3 +6,4 @@
<div id="disqus_thread" aria-live="polite">{% include post/disqus_thread.html %}</div>
{% endif %}
</section>
{% endif %}

View File

@ -1,3 +1,5 @@
{% comment %}
To use a custom comment system, add the javascript to custom/after_footer.html then add the container for your comments here.
Be sure to set "use_comments: true" in site.yml or the comments section will not be displayed!
{% endcomment %}

View File

@ -3,7 +3,7 @@
<script type="text/javascript">(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {return;}
js = d.createElement(s); js.id = id;
js = d.createElement(s); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js#appId=212934732101925&xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

View File

@ -2,7 +2,7 @@ source "http://rubygems.org"
group :development do
gem 'rake', '~> 10.0.3'
gem 'rack', '~> 1.4.1'
gem 'rack', '~> 1.5.0'
gem 'jekyll', '~> 0.12.0'
gem 'redcarpet', '~> 2.2.2'
gem 'pygments.rb', '~> 0.3.4'

View File

@ -9,7 +9,6 @@ GEM
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
diff-lcs (1.1.3)
directory_watcher (1.4.1)
fast-stemmer (1.0.1)
fssm (0.2.9)
@ -30,7 +29,7 @@ GEM
pygments.rb (0.3.4)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0)
rack (1.4.1)
rack (1.5.2)
rack-protection (1.3.2)
rack
rake (10.0.3)
@ -40,14 +39,6 @@ GEM
rb-fsevent (0.9.3)
rdiscount (1.6.8)
redcarpet (2.2.2)
rspec (2.12.0)
rspec-core (~> 2.12.0)
rspec-expectations (~> 2.12.0)
rspec-mocks (~> 2.12.0)
rspec-core (2.12.2)
rspec-expectations (2.12.1)
diff-lcs (~> 1.1.3)
rspec-mocks (2.12.2)
rubypants (0.2.0)
sass (3.2.4)
sinatra (1.3.3)
@ -70,13 +61,12 @@ DEPENDENCIES
jekyll (~> 0.12.0)
liquid (~> 2.3.0)
pygments.rb (~> 0.3.4)
rack (~> 1.4.1)
rack (~> 1.5.0)
rake (~> 10.0.3)
rake-minify
rb-fsevent (~> 0.9.3)
rdiscount (~> 1.6.8)
redcarpet (~> 2.2.2)
rspec
rubypants (~> 0.2.0)
sinatra (~> 1.3.3)
stringex (~> 1.4.0)

View File

@ -6,7 +6,6 @@ require "stringex"
require 'time'
require 'tzinfo'
require 'rake/minify'
require 'time'
require 'yaml'
require 'octopress'
@ -197,7 +196,7 @@ task :new_page, :filename do |t, args|
end
# usage rake isolate[my-post]
desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much quicker."
desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much more quickly."
task :isolate, :filename do |t, args|
if args.filename
filename = args.filename
@ -215,12 +214,11 @@ task :integrate do
FileUtils.mv Dir.glob("#{full_stash_dir}/*.*"), "#{configuration[:source]}/#{configuration[:posts_dir]}/"
end
desc "Clean out caches: .pygments-cache, .gist-cache, .sass-cache"
desc "Clean out caches: .pygments-cache, .gist-cache, .sass-cache, and Compass-generated files."
task :clean do
[".pygments-cache/**", ".gist-cache/**"].each { |dir| rm_rf Dir.glob(dir) }
rm "#{configuration[:source]}/stylesheets/screen.css" if File.exists?("#{configuration[:source]}/stylesheets/screen.css")
rm_rf [".pygments-cache", ".gist-cache"]
system "compass clean"
puts "## Cleaned Sass, Pygments and Gist caches, removed generated stylesheets ##"
puts "## Cleaned Sass-generated files, and various caches ##"
end
desc "Update theme source and style"
@ -354,7 +352,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========================================================"
@ -369,7 +367,9 @@ task :setup_github_pages, :repo do |t, args|
if args.repo
repo_url = args.repo
else
repo_url = get_stdin("Enter the read/write url for your repository: ")
puts "Enter the read/write url for your repository"
puts "(For example, 'git@github.com:your_username/your_username.github.com)"
repo_url = get_stdin("Repository url: ")
end
unless repo_url[-4..-1] == ".git"
repo_url << ".git"
@ -455,7 +455,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
@ -466,7 +466,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

View File

@ -42,3 +42,7 @@ linklog_marker: "&rarr;"
linklog_marker_position: after
linklog_marker_position_feed: after
standard_post_marker:
# Disable all comments by default. If you're using Disqus, or a custom comment system, add
# "use_comments: true" to your site.yml.
use_comments: false

View File

@ -3,6 +3,8 @@
# Disqus Comments Configuration #
# --------------------------------- #
# In order to use Disqus you must both set the short name here, AND set
# "use_comments: true" in site.yml.
disqus_short_name:
disqus_show_comment_count: false
disqus_developer: 0

View File

@ -1,8 +1,9 @@
$:.unshift File.expand_path("lib", File.dirname(__FILE__)) # For use/testing when no gem is installed
require "octopress"
config = Octopress::Configuration.read_configuration
config = Octopress::Configuration.new.read_configuration
project_path = File.dirname(__FILE__)
project_type = :stand_alone
compass_http_path = config[:destination].gsub('public', '')

View File

@ -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
run SinatraStaticServer

View File

@ -5,4 +5,3 @@ gem "rake", "~> 10.0"
group :test do
gem "rspec"
end

View File

@ -15,4 +15,3 @@ ARGV.delete_if do |arg|
end
IRB.start

View File

@ -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

View File

@ -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
end

View File

@ -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

View File

@ -208,7 +208,3 @@ HTML
end
end
def parse_category
{ slug: slug, title: title }
end

View File

@ -95,4 +95,4 @@ module Jekyll
self.data['updated_formatted'] = format_date(self.data['updated'], date_format) if self.data.has_key?('updated')
end
end
end
end

View File

@ -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

View File

@ -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"

View File

@ -17,7 +17,7 @@ module Jekyll
class ContentFilters < PostFilter
include OctopressFilters
def pre_render(post)
if post.ext.match('html|textile|markdown|haml|slim|xml')
if post.ext.match('html|textile|markdown|md|haml|slim|xml')
post.content = pre_filter(post.content, post.ext)
end
end
@ -119,4 +119,3 @@ module OctopressLiquidFilters
end
Liquid::Template.register_filter OctopressLiquidFilters

View File

@ -118,4 +118,3 @@ module Jekyll
end
end

View File

@ -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(/{{/, '&#x7b;&#x7b;').gsub(/{%/, '&#x7b;&#x25;')
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

View File

@ -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

View File

@ -1,6 +1,6 @@
# Sitemap.xml Generator is a Jekyll plugin that generates a sitemap.xml file by
# traversing all of the available posts and pages.
#
#
# How To Use:
# 1) Copy source file into your _plugins folder within your Jekyll project.
# 2) Change modify the url variable in _config.yml to reflect your domain name.
@ -28,12 +28,12 @@
# system modified date of the page or post, system modified date of
# included layout, system modified date of included layout within that
# layout, ...
#
#
# Author: Michael Levin
# Site: http://www.kinnetica.com
# Distributed Under A Creative Commons License
# - http://creativecommons.org/licenses/by/3.0/
#
#
# Modified for Octopress by John W. Long
#
require 'rexml/document'
@ -309,4 +309,3 @@ module Jekyll
end
end
end

View File

@ -53,4 +53,3 @@ module Jekyll
end
Liquid::Template.register_tag('video', Jekyll::VideoTag)