Merge branch 'master' into changelist_page
This commit is contained in:
commit
20eda0e89f
|
@ -2,13 +2,38 @@
|
||||||
### Major Enhancements
|
### Major Enhancements
|
||||||
|
|
||||||
### Minor Enhancements
|
### Minor Enhancements
|
||||||
|
* Move the building of related posts into their own class (#1057)
|
||||||
|
* Removed trailing spaces in several places throughout the code (#1116)
|
||||||
|
* Add a `--force` option to `jekyll new` (#1115)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
* Rename Jekyll::Logger to Jekyll::Stevenson to fix inheritance issue (#1106)
|
||||||
|
* Exit with a non-zero exit code when dealing with a Liquid error (#1121)
|
||||||
|
* Make the `exclude` and `include` options backwards compatible with
|
||||||
|
versions of Jekyll prior to 1.0 (#1114)
|
||||||
|
* Fix pagination on Windows (#1063)
|
||||||
|
* Fix the application of Pygments' Generic Output style to Go code
|
||||||
|
(#1156)
|
||||||
|
|
||||||
### Site Enhancements
|
### Site Enhancements
|
||||||
|
* Documentation for `date_to_rfc822` and `uri_escape` (#1142)
|
||||||
|
* Documentation highlight boxes shouldn't show scrollbars if not necessary (#1123)
|
||||||
|
* Add link to jekyll-minibundle in the doc's plugins list (#1035)
|
||||||
|
* Quick patch for importers documentation
|
||||||
|
* Fix prefix for WordpressDotCom importer in docs (#1107)
|
||||||
|
* Add jekyll-contentblocks plugin to docs (#1068)
|
||||||
|
* Make code bits in notes look more natural, more readable (#1089)
|
||||||
|
* Fix logic for `relative_permalinks` instructions on Upgrading page (#1101)
|
||||||
|
* Add docs for post excerpt (#1072)
|
||||||
* Add docs for gist tag (#1072)
|
* Add docs for gist tag (#1072)
|
||||||
|
* Add docs indicating that Pygments does not need to be installed
|
||||||
|
separately (#1099, #1119)
|
||||||
|
* Update the migrator docs to be current (#1136)
|
||||||
|
* Add the Jekyll Gallery Plugin to the plugin list (#1143)
|
||||||
|
|
||||||
### Development Fixes
|
### Development Fixes
|
||||||
|
* Fix pesky Cucumber infinite loop (#1139)
|
||||||
|
* Do not write posts with timezones in Cucumber tests (#1124)
|
||||||
|
|
||||||
## 1.0.2 / 2013-05-12
|
## 1.0.2 / 2013-05-12
|
||||||
|
|
||||||
|
|
|
@ -37,8 +37,10 @@ command :new do |c|
|
||||||
c.syntax = 'jekyll new PATH'
|
c.syntax = 'jekyll new PATH'
|
||||||
c.description = 'Creates a new Jekyll site scaffold in PATH'
|
c.description = 'Creates a new Jekyll site scaffold in PATH'
|
||||||
|
|
||||||
|
c.option '--force', 'Force creation even if PATH already exists'
|
||||||
|
|
||||||
c.action do |args, options|
|
c.action do |args, options|
|
||||||
Jekyll::Commands::New.process(args)
|
Jekyll::Commands::New.process(args, options.__hash__)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ Feature: Draft Posts
|
||||||
As a hacker who likes to blog
|
As a hacker who likes to blog
|
||||||
I want to be able to preview drafts locally
|
I want to be able to preview drafts locally
|
||||||
In order to see if they look alright before publishing
|
In order to see if they look alright before publishing
|
||||||
|
|
||||||
Scenario: Preview a draft
|
Scenario: Preview a draft
|
||||||
Given I have a configuration file with "permalink" set to "none"
|
Given I have a configuration file with "permalink" set to "none"
|
||||||
And I have a _drafts directory
|
And I have a _drafts directory
|
||||||
|
|
|
@ -117,7 +117,7 @@ Feature: Post data
|
||||||
When I run jekyll
|
When I run jekyll
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
||||||
|
|
||||||
Scenario: Use post.categories variable when category is in YAML and is mixed-case
|
Scenario: Use post.categories variable when category is in YAML and is mixed-case
|
||||||
Given I have a _posts directory
|
Given I have a _posts directory
|
||||||
And I have a _layouts directory
|
And I have a _layouts directory
|
||||||
|
@ -128,7 +128,7 @@ Feature: Post data
|
||||||
When I run jekyll
|
When I run jekyll
|
||||||
Then the _site directory should exist
|
Then the _site directory should exist
|
||||||
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
And I should see "Post category: movies" in "_site/movies/2009/03/27/star-wars.html"
|
||||||
|
|
||||||
Scenario: Use post.categories variable when category is in YAML
|
Scenario: Use post.categories variable when category is in YAML
|
||||||
Given I have a _posts directory
|
Given I have a _posts directory
|
||||||
And I have a _layouts directory
|
And I have a _layouts directory
|
||||||
|
|
|
@ -47,44 +47,38 @@ Given /^I have an? (.*) directory$/ do |dir|
|
||||||
FileUtils.mkdir_p(dir)
|
FileUtils.mkdir_p(dir)
|
||||||
end
|
end
|
||||||
|
|
||||||
Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, direction, folder, table|
|
Given /^I have the following (draft|post)s?(?: (in|under) "([^"]+)")?:$/ do |status, direction, folder, table|
|
||||||
table.hashes.each do |post|
|
table.hashes.each do |post|
|
||||||
title = post['title'].downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-')
|
title = slug(post['title'])
|
||||||
|
|
||||||
if direction && direction == "in"
|
|
||||||
before = folder || '.'
|
|
||||||
elsif direction && direction == "under"
|
|
||||||
after = folder || '.'
|
|
||||||
end
|
|
||||||
|
|
||||||
ext = post['type'] || 'textile'
|
ext = post['type'] || 'textile'
|
||||||
|
before, after = location(folder, direction)
|
||||||
|
|
||||||
|
if post['date']
|
||||||
|
in_format, out_format = time_format(post['date'])
|
||||||
|
parsed_date = DateTime.strptime(post['date'], in_format)
|
||||||
|
post['date'] = parsed_date.strftime(out_format)
|
||||||
|
end
|
||||||
|
|
||||||
if "draft" == status
|
if "draft" == status
|
||||||
path = File.join(before || '.', '_drafts', after || '.', "#{title}.#{ext}")
|
folder_post = '_drafts'
|
||||||
else
|
filename = "#{title}.#{ext}"
|
||||||
format = if has_time_component?(post['date'])
|
elsif "post" == status
|
||||||
'%Y-%m-%d %H:%M %z'
|
folder_post = '_posts'
|
||||||
else
|
filename = "#{parsed_date.strftime('%Y-%m-%d')}-#{title}.#{ext}"
|
||||||
'%m/%d/%Y' # why even
|
|
||||||
end
|
|
||||||
parsed_date = DateTime.strptime(post['date'], format)
|
|
||||||
post['date'] = parsed_date.to_s
|
|
||||||
date = parsed_date.strftime('%Y-%m-%d')
|
|
||||||
path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{ext}")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
path = File.join(before, folder_post, after, filename)
|
||||||
|
|
||||||
matter_hash = {}
|
matter_hash = {}
|
||||||
%w(title layout tag tags category categories published author path).each do |key|
|
%w(title layout tag tags category categories published author path date).each do |key|
|
||||||
matter_hash[key] = post[key] if post[key]
|
matter_hash[key] = post[key] if post[key]
|
||||||
end
|
end
|
||||||
if "post" == status
|
|
||||||
matter_hash["date"] = post["date"] if post["date"]
|
|
||||||
end
|
|
||||||
matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp
|
matter = matter_hash.map { |k, v| "#{k}: #{v}\n" }.join.chomp
|
||||||
|
|
||||||
content = post['content']
|
content = if post['input'] && post['filter']
|
||||||
if post['input'] && post['filter']
|
"{{ #{post['input']} | #{post['filter']} }}"
|
||||||
content = "{{ #{post['input']} | #{post['filter']} }}"
|
else
|
||||||
|
post['content']
|
||||||
end
|
end
|
||||||
|
|
||||||
File.open(path, 'w') do |f|
|
File.open(path, 'w') do |f|
|
||||||
|
|
|
@ -2,10 +2,6 @@ require 'fileutils'
|
||||||
require 'rr'
|
require 'rr'
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
|
||||||
World do
|
|
||||||
include Test::Unit::Assertions
|
|
||||||
end
|
|
||||||
|
|
||||||
TEST_DIR = File.join('/', 'tmp', 'jekyll')
|
TEST_DIR = File.join('/', 'tmp', 'jekyll')
|
||||||
JEKYLL_PATH = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jekyll')
|
JEKYLL_PATH = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jekyll')
|
||||||
|
|
||||||
|
@ -17,9 +13,29 @@ def run_jekyll(opts = {})
|
||||||
system command
|
system command
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def time_format(date)
|
||||||
|
if has_time_component?(date)
|
||||||
|
['%Y-%m-%d %H:%M %z'] * 2
|
||||||
|
else
|
||||||
|
['%m/%d/%Y', '%Y-%m-%d %H:%M']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def has_time_component?(date_string)
|
def has_time_component?(date_string)
|
||||||
date_string.split(" ").size > 1
|
date_string.split(" ").size > 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def slug(title)
|
||||||
|
title.downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-')
|
||||||
|
end
|
||||||
|
|
||||||
|
def location(folder, direction)
|
||||||
|
if folder
|
||||||
|
before = folder if direction == "in"
|
||||||
|
after = folder if direction == "under"
|
||||||
|
end
|
||||||
|
[before || '.', after || '.']
|
||||||
|
end
|
||||||
|
|
||||||
# work around "invalid option: --format" cucumber bug (see #296)
|
# work around "invalid option: --format" cucumber bug (see #296)
|
||||||
Test::Unit.run = true if RUBY_VERSION < '1.9'
|
Test::Unit.run = true if RUBY_VERSION < '1.9'
|
||||||
|
|
|
@ -37,7 +37,7 @@ Gem::Specification.new do |s|
|
||||||
s.add_development_dependency('rdoc', "~> 3.11")
|
s.add_development_dependency('rdoc', "~> 3.11")
|
||||||
s.add_development_dependency('redgreen', "~> 1.2")
|
s.add_development_dependency('redgreen', "~> 1.2")
|
||||||
s.add_development_dependency('shoulda', "~> 3.3.2")
|
s.add_development_dependency('shoulda', "~> 3.3.2")
|
||||||
s.add_development_dependency('rr', "~> 1.0")
|
s.add_development_dependency('rr', "~> 1.0.0")
|
||||||
s.add_development_dependency('cucumber', "~> 1.2.1", '!= 1.2.4')
|
s.add_development_dependency('cucumber', "~> 1.2.1", '!= 1.2.4')
|
||||||
s.add_development_dependency('RedCloth', "~> 4.2")
|
s.add_development_dependency('RedCloth', "~> 4.2")
|
||||||
s.add_development_dependency('rdiscount', "~> 1.6")
|
s.add_development_dependency('rdiscount', "~> 1.6")
|
||||||
|
@ -92,13 +92,14 @@ Gem::Specification.new do |s|
|
||||||
lib/jekyll/generator.rb
|
lib/jekyll/generator.rb
|
||||||
lib/jekyll/generators/pagination.rb
|
lib/jekyll/generators/pagination.rb
|
||||||
lib/jekyll/layout.rb
|
lib/jekyll/layout.rb
|
||||||
lib/jekyll/logger.rb
|
|
||||||
lib/jekyll/mime.types
|
lib/jekyll/mime.types
|
||||||
lib/jekyll/page.rb
|
lib/jekyll/page.rb
|
||||||
lib/jekyll/plugin.rb
|
lib/jekyll/plugin.rb
|
||||||
lib/jekyll/post.rb
|
lib/jekyll/post.rb
|
||||||
|
lib/jekyll/related_posts.rb
|
||||||
lib/jekyll/site.rb
|
lib/jekyll/site.rb
|
||||||
lib/jekyll/static_file.rb
|
lib/jekyll/static_file.rb
|
||||||
|
lib/jekyll/stevenson.rb
|
||||||
lib/jekyll/tags/gist.rb
|
lib/jekyll/tags/gist.rb
|
||||||
lib/jekyll/tags/highlight.rb
|
lib/jekyll/tags/highlight.rb
|
||||||
lib/jekyll/tags/include.rb
|
lib/jekyll/tags/include.rb
|
||||||
|
@ -236,6 +237,7 @@ Gem::Specification.new do |s|
|
||||||
test/test_rdiscount.rb
|
test/test_rdiscount.rb
|
||||||
test/test_redcarpet.rb
|
test/test_redcarpet.rb
|
||||||
test/test_redcloth.rb
|
test/test_redcloth.rb
|
||||||
|
test/test_related_posts.rb
|
||||||
test/test_site.rb
|
test/test_site.rb
|
||||||
test/test_tags.rb
|
test/test_tags.rb
|
||||||
]
|
]
|
||||||
|
|
|
@ -28,7 +28,7 @@ require 'colorator'
|
||||||
|
|
||||||
# internal requires
|
# internal requires
|
||||||
require 'jekyll/core_ext'
|
require 'jekyll/core_ext'
|
||||||
require 'jekyll/logger'
|
require 'jekyll/stevenson'
|
||||||
require 'jekyll/deprecator'
|
require 'jekyll/deprecator'
|
||||||
require 'jekyll/configuration'
|
require 'jekyll/configuration'
|
||||||
require 'jekyll/site'
|
require 'jekyll/site'
|
||||||
|
@ -40,6 +40,7 @@ require 'jekyll/draft'
|
||||||
require 'jekyll/filters'
|
require 'jekyll/filters'
|
||||||
require 'jekyll/static_file'
|
require 'jekyll/static_file'
|
||||||
require 'jekyll/errors'
|
require 'jekyll/errors'
|
||||||
|
require 'jekyll/related_posts'
|
||||||
|
|
||||||
# extensions
|
# extensions
|
||||||
require 'jekyll/plugin'
|
require 'jekyll/plugin'
|
||||||
|
|
|
@ -18,9 +18,9 @@ module Jekyll
|
||||||
site.process
|
site.process
|
||||||
rescue Jekyll::FatalException => e
|
rescue Jekyll::FatalException => e
|
||||||
puts
|
puts
|
||||||
Jekyll::Logger.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
|
Jekyll::Stevenson.error "ERROR:", "YOUR SITE COULD NOT BE BUILT:"
|
||||||
Jekyll::Logger.error "", "------------------------------------"
|
Jekyll::Stevenson.error "", "------------------------------------"
|
||||||
Jekyll::Logger.error "", e.message
|
Jekyll::Stevenson.error "", e.message
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,9 +17,9 @@ module Jekyll
|
||||||
def self.build(site, options)
|
def self.build(site, options)
|
||||||
source = options['source']
|
source = options['source']
|
||||||
destination = options['destination']
|
destination = options['destination']
|
||||||
Jekyll::Logger.info "Source:", source
|
Jekyll::Stevenson.info "Source:", source
|
||||||
Jekyll::Logger.info "Destination:", destination
|
Jekyll::Stevenson.info "Destination:", destination
|
||||||
print Jekyll::Logger.formatted_topic "Generating..."
|
print Jekyll::Stevenson.formatted_topic "Generating..."
|
||||||
self.process_site(site)
|
self.process_site(site)
|
||||||
puts "done."
|
puts "done."
|
||||||
end
|
end
|
||||||
|
@ -36,14 +36,14 @@ module Jekyll
|
||||||
source = options['source']
|
source = options['source']
|
||||||
destination = options['destination']
|
destination = options['destination']
|
||||||
|
|
||||||
Jekyll::Logger.info "Auto-regeneration:", "enabled"
|
Jekyll::Stevenson.info "Auto-regeneration:", "enabled"
|
||||||
|
|
||||||
dw = DirectoryWatcher.new(source, :glob => self.globs(source, destination), :pre_load => true)
|
dw = DirectoryWatcher.new(source, :glob => self.globs(source, destination), :pre_load => true)
|
||||||
dw.interval = 1
|
dw.interval = 1
|
||||||
|
|
||||||
dw.add_observer do |*args|
|
dw.add_observer do |*args|
|
||||||
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
print Jekyll::Logger.formatted_topic("Regenerating:") + "#{args.size} files at #{t} "
|
print Jekyll::Stevenson.formatted_topic("Regenerating:") + "#{args.size} files at #{t} "
|
||||||
self.process_site(site)
|
self.process_site(site)
|
||||||
puts "...done."
|
puts "...done."
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,7 +7,7 @@ module Jekyll
|
||||||
site.read
|
site.read
|
||||||
|
|
||||||
unless deprecated_relative_permalinks(site)
|
unless deprecated_relative_permalinks(site)
|
||||||
Jekyll::Logger.info "Your test results", "are in. Everything looks fine."
|
Jekyll::Stevenson.info "Your test results", "are in. Everything looks fine."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ module Jekyll
|
||||||
contains_deprecated_pages = false
|
contains_deprecated_pages = false
|
||||||
site.pages.each do |page|
|
site.pages.each do |page|
|
||||||
if page.uses_relative_permalinks
|
if page.uses_relative_permalinks
|
||||||
Jekyll::Logger.warn "Deprecation:", "'#{page.path}' uses relative" +
|
Jekyll::Stevenson.warn "Deprecation:", "'#{page.path}' uses relative" +
|
||||||
" permalinks which will be deprecated in" +
|
" permalinks which will be deprecated in" +
|
||||||
" Jekyll v1.1 and beyond."
|
" Jekyll v1.1 and beyond."
|
||||||
contains_deprecated_pages = true
|
contains_deprecated_pages = true
|
||||||
|
|
|
@ -3,13 +3,13 @@ require 'erb'
|
||||||
module Jekyll
|
module Jekyll
|
||||||
module Commands
|
module Commands
|
||||||
class New < Command
|
class New < Command
|
||||||
def self.process(args)
|
def self.process(args, options = {})
|
||||||
raise ArgumentError.new('You must specify a path.') if args.empty?
|
raise ArgumentError.new('You must specify a path.') if args.empty?
|
||||||
|
|
||||||
new_blog_path = File.expand_path(args.join(" "), Dir.pwd)
|
new_blog_path = File.expand_path(args.join(" "), Dir.pwd)
|
||||||
FileUtils.mkdir_p new_blog_path
|
FileUtils.mkdir_p new_blog_path
|
||||||
unless Dir["#{new_blog_path}/**/*"].empty?
|
if preserve_source_location?(new_blog_path, options)
|
||||||
Jekyll::Logger.error "Conflict:", "#{new_blog_path} exists and is not empty."
|
Jekyll::Stevenson.error "Conflict:", "#{new_blog_path} exists and is not empty."
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -33,6 +33,11 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def self.preserve_source_location?(path, options)
|
||||||
|
!options[:force] && !Dir["#{path}/**/*"].empty?
|
||||||
|
end
|
||||||
|
|
||||||
def self.create_sample_files(path)
|
def self.create_sample_files(path)
|
||||||
FileUtils.cp_r site_template + '/.', path
|
FileUtils.cp_r site_template + '/.', path
|
||||||
FileUtils.rm File.expand_path(scaffold_path, path)
|
FileUtils.rm File.expand_path(scaffold_path, path)
|
||||||
|
|
|
@ -115,7 +115,7 @@ module Jekyll
|
||||||
def read_config_file(file)
|
def read_config_file(file)
|
||||||
next_config = YAML.safe_load_file(file)
|
next_config = YAML.safe_load_file(file)
|
||||||
raise "Configuration file: (INVALID) #{file}".yellow if !next_config.is_a?(Hash)
|
raise "Configuration file: (INVALID) #{file}".yellow if !next_config.is_a?(Hash)
|
||||||
Jekyll::Logger.info "Configuration file:", file
|
Jekyll::Stevenson.info "Configuration file:", file
|
||||||
next_config
|
next_config
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -135,9 +135,9 @@ module Jekyll
|
||||||
end
|
end
|
||||||
rescue SystemCallError
|
rescue SystemCallError
|
||||||
# Errno:ENOENT = file not found
|
# Errno:ENOENT = file not found
|
||||||
Jekyll::Logger.warn "Configuration file:", "none"
|
Jekyll::Stevenson.warn "Configuration file:", "none"
|
||||||
rescue => err
|
rescue => err
|
||||||
Jekyll::Logger.warn "WARNING:", "Error reading configuration. " +
|
Jekyll::Stevenson.warn "WARNING:", "Error reading configuration. " +
|
||||||
"Using defaults (and options)."
|
"Using defaults (and options)."
|
||||||
$stderr.puts "#{err}"
|
$stderr.puts "#{err}"
|
||||||
end
|
end
|
||||||
|
@ -145,6 +145,15 @@ module Jekyll
|
||||||
configuration.backwards_compatibilize
|
configuration.backwards_compatibilize
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Public: Split a CSV string into an array containing its values
|
||||||
|
#
|
||||||
|
# csv - the string of comma-separated values
|
||||||
|
#
|
||||||
|
# Returns an array of the values contained in the CSV
|
||||||
|
def csv_to_array(csv)
|
||||||
|
csv.split(",").map(&:strip)
|
||||||
|
end
|
||||||
|
|
||||||
# Public: Ensure the proper options are set in the configuration to allow for
|
# Public: Ensure the proper options are set in the configuration to allow for
|
||||||
# backwards-compatibility with Jekyll pre-1.0
|
# backwards-compatibility with Jekyll pre-1.0
|
||||||
#
|
#
|
||||||
|
@ -153,7 +162,7 @@ module Jekyll
|
||||||
config = clone
|
config = clone
|
||||||
# Provide backwards-compatibility
|
# Provide backwards-compatibility
|
||||||
if config.has_key?('auto') || config.has_key?('watch')
|
if config.has_key?('auto') || config.has_key?('watch')
|
||||||
Jekyll::Logger.warn "Deprecation:", "Auto-regeneration can no longer" +
|
Jekyll::Stevenson.warn "Deprecation:", "Auto-regeneration can no longer" +
|
||||||
" be set from your configuration file(s). Use the"+
|
" be set from your configuration file(s). Use the"+
|
||||||
" --watch/-w command-line option instead."
|
" --watch/-w command-line option instead."
|
||||||
config.delete('auto')
|
config.delete('auto')
|
||||||
|
@ -161,14 +170,14 @@ module Jekyll
|
||||||
end
|
end
|
||||||
|
|
||||||
if config.has_key? 'server'
|
if config.has_key? 'server'
|
||||||
Jekyll::Logger.warn "Deprecation:", "The 'server' configuration option" +
|
Jekyll::Stevenson.warn "Deprecation:", "The 'server' configuration option" +
|
||||||
" is no longer accepted. Use the 'jekyll serve'" +
|
" is no longer accepted. Use the 'jekyll serve'" +
|
||||||
" subcommand to serve your site with WEBrick."
|
" subcommand to serve your site with WEBrick."
|
||||||
config.delete('server')
|
config.delete('server')
|
||||||
end
|
end
|
||||||
|
|
||||||
if config.has_key? 'server_port'
|
if config.has_key? 'server_port'
|
||||||
Jekyll::Logger.warn "Deprecation:", "The 'server_port' configuration option" +
|
Jekyll::Stevenson.warn "Deprecation:", "The 'server_port' configuration option" +
|
||||||
" has been renamed to 'port'. Please update your config" +
|
" has been renamed to 'port'. Please update your config" +
|
||||||
" file accordingly."
|
" file accordingly."
|
||||||
# copy but don't overwrite:
|
# copy but don't overwrite:
|
||||||
|
@ -176,6 +185,22 @@ module Jekyll
|
||||||
config.delete('server_port')
|
config.delete('server_port')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if config.has_key?('exclude') && config['exclude'].is_a?(String)
|
||||||
|
Jekyll::Stevenson.warn "Deprecation:", "The 'exclude' configuration option" +
|
||||||
|
" must now be specified as an array, but you specified" +
|
||||||
|
" a string. For now, we've treated the string you provided" +
|
||||||
|
" as a list of comma-separated values."
|
||||||
|
config['exclude'] = csv_to_array(config['exclude'])
|
||||||
|
end
|
||||||
|
|
||||||
|
if config.has_key?('include') && config['include'].is_a?(String)
|
||||||
|
Jekyll::Stevenson.warn "Deprecation:", "The 'include' configuration option" +
|
||||||
|
" must now be specified as an array, but you specified" +
|
||||||
|
" a string. For now, we've treated the string you provided" +
|
||||||
|
" as a list of comma-separated values."
|
||||||
|
config['include'] = csv_to_array(config['include'])
|
||||||
|
end
|
||||||
|
|
||||||
config
|
config
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ module Jekyll
|
||||||
self.data = YAML.safe_load($1)
|
self.data = YAML.safe_load($1)
|
||||||
end
|
end
|
||||||
rescue SyntaxError => e
|
rescue SyntaxError => e
|
||||||
puts "YAML Exception reading #{File.join(base, name)}: #{e.message}"
|
puts "YAML Exception reading #{File.join(base, name)}: #{e.message}"
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
puts "Error reading file #{File.join(base, name)}: #{e.message}"
|
puts "Error reading file #{File.join(base, name)}: #{e.message}"
|
||||||
end
|
end
|
||||||
|
@ -76,11 +76,8 @@ module Jekyll
|
||||||
def render_liquid(content, payload, info)
|
def render_liquid(content, payload, info)
|
||||||
Liquid::Template.parse(content).render!(payload, info)
|
Liquid::Template.parse(content).render!(payload, info)
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
Jekyll::Logger.error "Liquid Exception:", "#{e.message} in #{payload[:file]}"
|
Jekyll::Stevenson.error "Liquid Exception:", "#{e.message} in #{payload[:file]}"
|
||||||
e.backtrace.each do |backtrace|
|
raise e
|
||||||
puts backtrace
|
|
||||||
end
|
|
||||||
abort("Build Failed")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Recursively render layouts
|
# Recursively render layouts
|
||||||
|
@ -99,7 +96,7 @@ module Jekyll
|
||||||
payload = payload.deep_merge({"content" => self.output, "page" => layout.data})
|
payload = payload.deep_merge({"content" => self.output, "page" => layout.data})
|
||||||
|
|
||||||
self.output = self.render_liquid(layout.content,
|
self.output = self.render_liquid(layout.content,
|
||||||
payload.merge({:file => self.data["layout"]}),
|
payload.merge({:file => layout.name}),
|
||||||
info)
|
info)
|
||||||
|
|
||||||
if layout = layouts[layout.data["layout"]]
|
if layout = layouts[layout.data["layout"]]
|
||||||
|
|
|
@ -18,14 +18,14 @@ module Jekyll
|
||||||
|
|
||||||
def self.no_subcommand(args)
|
def self.no_subcommand(args)
|
||||||
if args.size > 0 && args.first =~ /^--/ && !%w[--help --version].include?(args.first)
|
if args.size > 0 && args.first =~ /^--/ && !%w[--help --version].include?(args.first)
|
||||||
Jekyll::Logger.error "Deprecation:", "Jekyll now uses subcommands instead of just \
|
Jekyll::Stevenson.error "Deprecation:", "Jekyll now uses subcommands instead of just \
|
||||||
switches. Run `jekyll help' to find out more."
|
switches. Run `jekyll help' to find out more."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.deprecation_message(args, deprecated_argument, message)
|
def self.deprecation_message(args, deprecated_argument, message)
|
||||||
if args.include?(deprecated_argument)
|
if args.include?(deprecated_argument)
|
||||||
Jekyll::Logger.error "Deprecation:", message
|
Jekyll::Stevenson.error "Deprecation:", message
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -99,7 +99,17 @@ module Jekyll
|
||||||
def cgi_escape(input)
|
def cgi_escape(input)
|
||||||
CGI::escape(input)
|
CGI::escape(input)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# URI escape a string.
|
||||||
|
#
|
||||||
|
# input - The String to escape.
|
||||||
|
#
|
||||||
|
# Examples
|
||||||
|
#
|
||||||
|
# uri_escape('foo, bar \\baz?')
|
||||||
|
# # => "foo,%20bar%20%5Cbaz?"
|
||||||
|
#
|
||||||
|
# Returns the escaped String.
|
||||||
def uri_escape(input)
|
def uri_escape(input)
|
||||||
URI.escape(input)
|
URI.escape(input)
|
||||||
end
|
end
|
||||||
|
@ -146,7 +156,7 @@ module Jekyll
|
||||||
when String
|
when String
|
||||||
Time.parse(input)
|
Time.parse(input)
|
||||||
else
|
else
|
||||||
Jekyll::Logger.error "Invalid Date:", "'#{input}' is not a valid datetime."
|
Jekyll::Stevenson.error "Invalid Date:", "'#{input}' is not a valid datetime."
|
||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -92,8 +92,9 @@ module Jekyll
|
||||||
# Returns the pagination path as a string
|
# Returns the pagination path as a string
|
||||||
def self.paginate_path(site_config, num_page)
|
def self.paginate_path(site_config, num_page)
|
||||||
return nil if num_page.nil? || num_page <= 1
|
return nil if num_page.nil? || num_page <= 1
|
||||||
format = File.basename(site_config['paginate_path'])
|
format = site_config['paginate_path']
|
||||||
format.sub(':num', num_page.to_s)
|
format = format.sub(':num', num_page.to_s)
|
||||||
|
File.basename(format)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Initialize a new Pager.
|
# Initialize a new Pager.
|
||||||
|
|
|
@ -5,6 +5,9 @@ module Jekyll
|
||||||
# Gets the Site object.
|
# Gets the Site object.
|
||||||
attr_reader :site
|
attr_reader :site
|
||||||
|
|
||||||
|
# Gets the name of this layout.
|
||||||
|
attr_reader :name
|
||||||
|
|
||||||
# Gets/Sets the extension of this layout.
|
# Gets/Sets the extension of this layout.
|
||||||
attr_accessor :ext
|
attr_accessor :ext
|
||||||
|
|
||||||
|
|
|
@ -244,29 +244,7 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns an Array of related Posts.
|
# Returns an Array of related Posts.
|
||||||
def related_posts(posts)
|
def related_posts(posts)
|
||||||
return [] unless posts.size > 1
|
Jekyll::RelatedPosts.new(self).build
|
||||||
|
|
||||||
if self.site.lsi
|
|
||||||
build_index
|
|
||||||
|
|
||||||
related = self.class.lsi.find_related(self.content, 11)
|
|
||||||
related - [self]
|
|
||||||
else
|
|
||||||
(posts - [self])[0..9]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def build_index
|
|
||||||
self.class.lsi ||= begin
|
|
||||||
puts "Starting the classifier..."
|
|
||||||
lsi = Classifier::LSI.new(:auto_rebuild => false)
|
|
||||||
$stdout.print(" Populating LSI... "); $stdout.flush
|
|
||||||
self.site.posts.each { |x| $stdout.print("."); $stdout.flush; lsi.add_item(x) }
|
|
||||||
$stdout.print("\n Rebuilding LSI index... ")
|
|
||||||
lsi.build_index
|
|
||||||
puts ""
|
|
||||||
lsi
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Add any necessary layouts to this post.
|
# Add any necessary layouts to this post.
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
module Jekyll
|
||||||
|
class RelatedPosts
|
||||||
|
|
||||||
|
class << self
|
||||||
|
attr_accessor :lsi
|
||||||
|
end
|
||||||
|
|
||||||
|
attr_reader :post, :site
|
||||||
|
|
||||||
|
def initialize(post)
|
||||||
|
@post = post
|
||||||
|
@site = post.site
|
||||||
|
require 'classifier' if site.lsi
|
||||||
|
end
|
||||||
|
|
||||||
|
def build
|
||||||
|
return [] unless self.site.posts.size > 1
|
||||||
|
|
||||||
|
if self.site.lsi
|
||||||
|
build_index
|
||||||
|
lsi_related_posts
|
||||||
|
else
|
||||||
|
most_recent_posts
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def build_index
|
||||||
|
self.class.lsi ||= begin
|
||||||
|
lsi = Classifier::LSI.new(:auto_rebuild => false)
|
||||||
|
display("Populating LSI...")
|
||||||
|
|
||||||
|
self.site.posts.each do |x|
|
||||||
|
lsi.add_item(x)
|
||||||
|
end
|
||||||
|
|
||||||
|
display("Rebuilding index...")
|
||||||
|
lsi.build_index
|
||||||
|
display("")
|
||||||
|
lsi
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def lsi_related_posts
|
||||||
|
self.class.lsi.find_related(post.content, 11) - [self.post]
|
||||||
|
end
|
||||||
|
|
||||||
|
def most_recent_posts
|
||||||
|
(self.site.posts - [self.post])[0..9]
|
||||||
|
end
|
||||||
|
|
||||||
|
def display(output)
|
||||||
|
$stdout.print("\n")
|
||||||
|
$stdout.print(Jekyll::Stevenson.formatted_topic(output))
|
||||||
|
$stdout.flush
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -71,8 +71,6 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def setup
|
def setup
|
||||||
require 'classifier' if self.lsi
|
|
||||||
|
|
||||||
# Check that the destination dir isn't the source dir or a directory
|
# Check that the destination dir isn't the source dir or a directory
|
||||||
# parent to the source dir.
|
# parent to the source dir.
|
||||||
if self.source =~ /^#{self.dest}/
|
if self.source =~ /^#{self.dest}/
|
||||||
|
@ -423,12 +421,12 @@ module Jekyll
|
||||||
def relative_permalinks_deprecation_method
|
def relative_permalinks_deprecation_method
|
||||||
if config['relative_permalinks'] && !@deprecated_relative_permalinks
|
if config['relative_permalinks'] && !@deprecated_relative_permalinks
|
||||||
$stderr.puts # Places newline after "Generating..."
|
$stderr.puts # Places newline after "Generating..."
|
||||||
Jekyll::Logger.warn "Deprecation:", "Starting in 1.1, permalinks for pages" +
|
Jekyll::Stevenson.warn "Deprecation:", "Starting in 1.1, permalinks for pages" +
|
||||||
" in subfolders must be relative to the" +
|
" in subfolders must be relative to the" +
|
||||||
" site source directory, not the parent" +
|
" site source directory, not the parent" +
|
||||||
" directory. Check http://jekyllrb.com/docs/upgrading/"+
|
" directory. Check http://jekyllrb.com/docs/upgrading/"+
|
||||||
" for more info."
|
" for more info."
|
||||||
$stderr.print Jekyll::Logger.formatted_topic("") + "..." # for "done."
|
$stderr.print Jekyll::Stevenson.formatted_topic("") + "..." # for "done."
|
||||||
@deprecated_relative_permalinks = true
|
@deprecated_relative_permalinks = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
require 'logger'
|
require 'logger'
|
||||||
|
|
||||||
module Jekyll
|
module Jekyll
|
||||||
class Logger < Logger
|
class Stevenson
|
||||||
# Public: Print a jekyll message to stdout
|
# Public: Print a jekyll message to stdout
|
||||||
#
|
#
|
||||||
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
|
# topic - the topic of the message, e.g. "Configuration file", "Deprecation", etc.
|
|
@ -21,7 +21,7 @@
|
||||||
<h1 class="title"><a href="/">{{ site.name }}</a></h1>
|
<h1 class="title"><a href="/">{{ site.name }}</a></h1>
|
||||||
<a class="extra" href="/">home</a>
|
<a class="extra" href="/">home</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
|
||||||
<div class="footer">
|
<div class="footer">
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
.highlight .gr { color: #c0c0c0; font-weight: bold; background-color: #c00000 } /* Generic.Error */
|
.highlight .gr { color: #c0c0c0; font-weight: bold; background-color: #c00000 } /* Generic.Error */
|
||||||
.highlight .gh { color: #cd5c5c} /* Generic.Heading */
|
.highlight .gh { color: #cd5c5c} /* Generic.Heading */
|
||||||
.highlight .gi { color: #ffffff; background-color: #0000c0 } /* Generic.Inserted */
|
.highlight .gi { color: #ffffff; background-color: #0000c0 } /* Generic.Inserted */
|
||||||
.highlight .go { color: #add8e6; font-weight: bold; background-color: #4d4d4d } /* Generic.Output */
|
.highlight span.go { color: #add8e6; font-weight: bold; background-color: #4d4d4d } /* Generic.Output, qualified with span to prevent applying this style to the Go language, see #1153. */
|
||||||
.highlight .gp { color: #ffffff} /* Generic.Prompt */
|
.highlight .gp { color: #ffffff} /* Generic.Prompt */
|
||||||
.highlight .gs { color: #ffffff} /* Generic.Strong */
|
.highlight .gs { color: #ffffff} /* Generic.Strong */
|
||||||
.highlight .gu { color: #cd5c5c} /* Generic.Subheading */
|
.highlight .gu { color: #cd5c5c} /* Generic.Subheading */
|
||||||
|
|
|
@ -519,7 +519,7 @@ pre, code {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.highlight, p > pre, p > code, p > nobr > code, li > code {
|
.highlight, p > pre, p > code, p > nobr > code, li > code, h5 > code, .note > code {
|
||||||
background: #333;
|
background: #333;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
@ -528,10 +528,17 @@ pre, code {
|
||||||
0 -1px 0 rgba(0,0,0,.5);
|
0 -1px 0 rgba(0,0,0,.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.note code {
|
||||||
|
background-color: rgba(0,0,0,0.2);
|
||||||
|
margin-left: 2.5px;
|
||||||
|
margin-right: 2.5px;
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
.highlight {
|
.highlight {
|
||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: scroll;
|
overflow: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* HTML Elements */
|
/* HTML Elements */
|
||||||
|
|
|
@ -50,10 +50,8 @@ community can improve the experience for everyone.
|
||||||
|
|
||||||
There are a number of (optional) extra features that Jekyll supports that you
|
There are a number of (optional) extra features that Jekyll supports that you
|
||||||
may want to install, depending on how you plan to use Jekyll. These extras
|
may want to install, depending on how you plan to use Jekyll. These extras
|
||||||
include syntax highlighting of code snippets using
|
include LaTeX support, and the use of alternative content rendering engines.
|
||||||
[Pygments](http://pygments.org/), LaTeX support, and the use of alternative
|
Check out [the extras page](../extras) for more information.
|
||||||
content rendering engines. Check out [the extras page](../extras) for more
|
|
||||||
information.
|
|
||||||
|
|
||||||
<div class="note">
|
<div class="note">
|
||||||
<h5>ProTip™: Enable Syntax Highlighting</h5>
|
<h5>ProTip™: Enable Syntax Highlighting</h5>
|
||||||
|
|
|
@ -15,12 +15,13 @@ the foreign system.
|
||||||
## Preparing for migrations
|
## Preparing for migrations
|
||||||
|
|
||||||
Because the importers have many of their own dependencies, they are made
|
Because the importers have many of their own dependencies, they are made
|
||||||
available via a separate gem called `jekyll-import`. To use them, all you need
|
available via a separate gem called
|
||||||
to do is install the gem, and they will become available as part of Jekyll's
|
[`jekyll-import`](https://github.com/jekyll/jekyll-import). To use them, all
|
||||||
standard command line interface.
|
you need to do is install the gem, and they will become available as part of
|
||||||
|
Jekyll's standard command line interface.
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ gem install jekyll-import
|
$ gem install jekyll-import --pre
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
You should now be all set to run the importers below. If you ever get stuck, you
|
You should now be all set to run the importers below. If you ever get stuck, you
|
||||||
|
@ -55,13 +56,13 @@ Next, export your blog using the Wordpress export utility. Assuming that the
|
||||||
exported file is saved as `wordpress.xml`, here is the command you need to run:
|
exported file is saved as `wordpress.xml`, here is the command you need to run:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/wordpressdotcom";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/wordpressdotcom";
|
||||||
Jekyll::WordpressDotCom.process("wordpress.xml")'
|
JekyllImport::WordpressDotCom.process("wordpress.xml")'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
<div class="note">
|
<div class="note">
|
||||||
<h5>ProTip™: Wordpress.com Export Tool</h5>
|
<h5>ProTip™: Wordpress.com Export Tool</h5>
|
||||||
<p>If you are migrating from a Wordpress.com account, you can access the export tool at the following URL: `https://YOUR-USER-NAME.wordpress.com/wp-admin/export.php`.</p>
|
<p markdown="1">If you are migrating from a Wordpress.com account, you can access the export tool at the following URL: `https://YOUR-USER-NAME.wordpress.com/wp-admin/export.php`.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
### Using Wordpress MySQL server connection
|
### Using Wordpress MySQL server connection
|
||||||
|
@ -69,8 +70,8 @@ $ ruby -rubygems -e 'require "jekyll/migrators/wordpressdotcom";
|
||||||
If you want to import using a direct connection to the Wordpress MySQL server, here's how:
|
If you want to import using a direct connection to the Wordpress MySQL server, here's how:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/wordpress";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/wordpress";
|
||||||
Jekyll::WordPress.process("database", "user", "pass")'
|
JekyllImport::WordPress.process("database", "user", "pass")'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
If you are using Webfaction and have to set up an [SSH
|
If you are using Webfaction and have to set up an [SSH
|
||||||
|
@ -80,8 +81,8 @@ your access based on `localhost` and `127.0.0.1` not being equivalent in its
|
||||||
authentication system:
|
authentication system:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/wordpress";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/wordpress";
|
||||||
Jekyll::WordPress.process("database", "user", "pass", "127.0.0.1")'
|
JekyllImport::WordPress.process("database", "user", "pass", "127.0.0.1")'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
### Further Wordpress migration alternatives
|
### Further Wordpress migration alternatives
|
||||||
|
@ -104,29 +105,38 @@ might be useful to you:
|
||||||
|
|
||||||
## Drupal
|
## Drupal
|
||||||
|
|
||||||
If you’re migrating from [Drupal](http://drupal.org), there is [a
|
If you’re migrating from [Drupal](http://drupal.org), there are two migrators
|
||||||
migrator](https://github.com/mojombo/jekyll/blob/master/lib/jekyll/migrators/drupal.rb)
|
for you, depending upon your Drupal version:
|
||||||
for you too:
|
- [Drupal 6](https://github.com/jekyll/jekyll-import/blob/v0.1.0.beta1/lib/jekyll/jekyll-import/drupal6.rb)
|
||||||
|
- [Drupal 7](https://github.com/jekyll/jekyll-import/blob/v0.1.0.beta1/lib/jekyll/jekyll-import/drupal7.rb)
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/drupal";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/drupal6";
|
||||||
Jekyll::Drupal.process("database", "user", "pass")'
|
JekyllImport::Drupal6.process("dbname", "user", "pass")'
|
||||||
|
# ... or ...
|
||||||
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/drupal7";
|
||||||
|
JekyllImport::Drupal7.process("dbname", "user", "pass")'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
<div class="note warning">
|
If you are connecting to a different host or need to specify a table prefix for
|
||||||
<h5>Warning: Drupal Version Compatibility</h5>
|
your database, you may optionally add those two parameters to the end of either
|
||||||
<p>This migrator was written for Drupal 6.1 and may not work as expected with
|
Drupal migrator execution:
|
||||||
newer versions of Drupal. Please update it and send us a pull request if
|
|
||||||
necessary.</p>
|
{% highlight bash %}
|
||||||
</div>
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/drupal6";
|
||||||
|
JekyllImport::Drupal6.process("dbname", "user", "pass", "host", "table_prefix")'
|
||||||
|
# ... or ...
|
||||||
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/drupal7";
|
||||||
|
JekyllImport::Drupal7.process("dbname", "user", "pass", "host", "table_prefix")'
|
||||||
|
{% endhighlight %}
|
||||||
|
|
||||||
## Movable Type
|
## Movable Type
|
||||||
|
|
||||||
To import posts from Movable Type:
|
To import posts from Movable Type:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/mt";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/mt";
|
||||||
Jekyll::MT.process("database", "user", "pass")'
|
JekyllImport::MT.process("database", "user", "pass")'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
## Typo
|
## Typo
|
||||||
|
@ -134,8 +144,8 @@ $ ruby -rubygems -e 'require "jekyll/migrators/mt";
|
||||||
To import posts from Typo:
|
To import posts from Typo:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/typo";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/typo";
|
||||||
Jekyll::Typo.process("database", "user", "pass")'
|
JekyllImport::Typo.process("database", "user", "pass")'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
This code has only been tested with Typo version 4+.
|
This code has only been tested with Typo version 4+.
|
||||||
|
@ -145,8 +155,8 @@ This code has only been tested with Typo version 4+.
|
||||||
To import posts from TextPattern:
|
To import posts from TextPattern:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/textpattern";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/textpattern";
|
||||||
Jekyll::TextPattern.process("database_name", "username", "password", "hostname")'
|
JekyllImport::TextPattern.process("database_name", "username", "password", "hostname")'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
You will need to run the above from the parent directory of your `_import`
|
You will need to run the above from the parent directory of your `_import`
|
||||||
|
@ -161,15 +171,15 @@ sticky.
|
||||||
To import posts from Mephisto:
|
To import posts from Mephisto:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/mephisto";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/mephisto";
|
||||||
Jekyll::Mephisto.process("database", "user", "password")'
|
JekyllImport::Mephisto.process("database", "user", "password")'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
If your data is in Postgres, you should do this instead:
|
If your data is in Postgres, you should do this instead:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/mephisto";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/mephisto";
|
||||||
Jekyll::Mephisto.postgres({:database => "database", :username=>"username", :password =>"password"})'
|
JekyllImport::Mephisto.postgres({:database => "database", :username=>"username", :password =>"password"})'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
## Blogger (Blogspot)
|
## Blogger (Blogspot)
|
||||||
|
@ -196,16 +206,16 @@ alternatives:
|
||||||
To import posts from your primary Posterous blog:
|
To import posts from your primary Posterous blog:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/posterous";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/posterous";
|
||||||
Jekyll::Posterous.process("my_email", "my_pass")'
|
JekyllImport::Posterous.process("my_email", "my_pass")'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
For any other Posterous blog on your account, you will need to specify the
|
For any other Posterous blog on your account, you will need to specify the
|
||||||
`blog_id` for the blog:
|
`blog_id` for the blog:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/posterous";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/posterous";
|
||||||
Jekyll::Posterous.process("my_email", "my_pass", "blog_id")'
|
JekyllImport::Posterous.process("my_email", "my_pass", "blog_id")'
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
There is also an [alternative Posterous
|
There is also an [alternative Posterous
|
||||||
|
@ -217,30 +227,19 @@ that maintains permalinks and attempts to import images too.
|
||||||
To import posts from Tumblr:
|
To import posts from Tumblr:
|
||||||
|
|
||||||
{% highlight bash %}
|
{% highlight bash %}
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/tumblr";
|
$ ruby -rubygems -e 'require "jekyll/jekyll-import/tumblr";
|
||||||
Jekyll::Tumblr.process("http://www.your_blog_url.com", true)'
|
JekyllImport::Tumblr.process(url, format, grab_images, add_highlights, rewrite_urls)'
|
||||||
{% endhighlight %}
|
# url - String: your blog's URL
|
||||||
|
# format - String: the output file extension. Use "md" to have your content
|
||||||
There is also [a modified Tumblr
|
# converted from HTML to Markdown. Defaults to "html".
|
||||||
migrator](https://github.com/stephenmcd/jekyll/blob/master/lib/jekyll/migrators/tumblr.rb)
|
# grab_images - Boolean: whether to download images as well. Defaults to false.
|
||||||
that exports posts as Markdown and preserves post tags.
|
# add_highlights - Boolean: whether to wrap code blocks (indented 4 spaces) in a Liquid
|
||||||
|
"highlight" tag. Defaults to false.
|
||||||
The migrator above requires the `json` gem and Python's `html2text` to be
|
# rewrite_urls - Boolean: whether to write pages that redirect from the old Tumblr paths
|
||||||
installed as follows:
|
to the new Jekyll paths. Defaults to false.
|
||||||
|
|
||||||
{% highlight bash %}
|
|
||||||
$ gem install json
|
|
||||||
$ pip install html2text
|
|
||||||
{% endhighlight %}
|
|
||||||
|
|
||||||
Once installed, simply use the format argument:
|
|
||||||
|
|
||||||
{% highlight bash %}
|
|
||||||
$ ruby -rubygems -e 'require "jekyll/migrators/tumblr";
|
|
||||||
Jekyll::Tumblr.process("http://www.your_blog_url.com", format="md")'
|
|
||||||
{% endhighlight %}
|
{% endhighlight %}
|
||||||
|
|
||||||
## Other Systems
|
## Other Systems
|
||||||
|
|
||||||
If you have a system for which there is currently no migrator, consider writing
|
If you have a system for which there is currently no migrator, consider writing
|
||||||
one and sending us a pull request.
|
one and sending us [a pull request](https://github.com/jekyll/jekyll-import).
|
||||||
|
|
|
@ -404,6 +404,7 @@ There are a few useful, prebuilt plugins at the following locations:
|
||||||
- [jekyll-rendering](https://github.com/blackwinter/jekyll-rendering): Jekyll plugin to provide alternative rendering engines.
|
- [jekyll-rendering](https://github.com/blackwinter/jekyll-rendering): Jekyll plugin to provide alternative rendering engines.
|
||||||
- [jekyll-pagination](https://github.com/blackwinter/jekyll-pagination): Jekyll plugin to extend the pagination generator.
|
- [jekyll-pagination](https://github.com/blackwinter/jekyll-pagination): Jekyll plugin to extend the pagination generator.
|
||||||
- [jekyll-tagging](https://github.com/pattex/jekyll-tagging): Jekyll plugin to automatically generate a tag cloud and tag pages.
|
- [jekyll-tagging](https://github.com/pattex/jekyll-tagging): Jekyll plugin to automatically generate a tag cloud and tag pages.
|
||||||
|
- [jekyll-contentblocks](https://github.com/rustygeldmacher/jekyll-contentblocks): Lets you use Rails-like content_for tags in your templates, for passing content from your posts up to your layouts.
|
||||||
- [Generate YouTube Embed (tag)](https://gist.github.com/1805814) by [joelverhagen](https://github.com/joelverhagen): Jekyll plugin which allows you to embed a YouTube video in your page with the YouTube ID. Optionally specify width and height dimensions. Like “oEmbed Tag” but just for YouTube.
|
- [Generate YouTube Embed (tag)](https://gist.github.com/1805814) by [joelverhagen](https://github.com/joelverhagen): Jekyll plugin which allows you to embed a YouTube video in your page with the YouTube ID. Optionally specify width and height dimensions. Like “oEmbed Tag” but just for YouTube.
|
||||||
- [JSON Filter](https://gist.github.com/1850654) by [joelverhagen](https://github.com/joelverhagen): filter that takes input text and outputs it as JSON. Great for rendering JavaScript.
|
- [JSON Filter](https://gist.github.com/1850654) by [joelverhagen](https://github.com/joelverhagen): filter that takes input text and outputs it as JSON. Great for rendering JavaScript.
|
||||||
- [jekyll-beastiepress](https://github.com/okeeblow/jekyll-beastiepress): FreeBSD utility tags for Jekyll sites.
|
- [jekyll-beastiepress](https://github.com/okeeblow/jekyll-beastiepress): FreeBSD utility tags for Jekyll sites.
|
||||||
|
@ -426,6 +427,8 @@ There are a few useful, prebuilt plugins at the following locations:
|
||||||
- [File compressor](https://gist.github.com/2758691) by [mytharcher](https://github.com/mytharcher): Compress HTML (\*.html) and JavaScript(\*.js) files when output.
|
- [File compressor](https://gist.github.com/2758691) by [mytharcher](https://github.com/mytharcher): Compress HTML (\*.html) and JavaScript(\*.js) files when output.
|
||||||
- [smilify](https://github.com/SaswatPadhi/jekyll_smilify) by [SaswatPadhi](https://github.com/SaswatPadhi): Convert text emoticons in your content to themeable smiley pics. [Demo](http://saswatpadhi.github.com/)
|
- [smilify](https://github.com/SaswatPadhi/jekyll_smilify) by [SaswatPadhi](https://github.com/SaswatPadhi): Convert text emoticons in your content to themeable smiley pics. [Demo](http://saswatpadhi.github.com/)
|
||||||
- [excerpts](http://blog.darkrefraction.com/2012/jekyll-excerpt-plugin.html) by [drawoc](https://github.com/drawoc): provides a nice way to implement page excerpts.
|
- [excerpts](http://blog.darkrefraction.com/2012/jekyll-excerpt-plugin.html) by [drawoc](https://github.com/drawoc): provides a nice way to implement page excerpts.
|
||||||
|
- [jekyll-minibundle](https://github.com/tkareine/jekyll-minibundle): Asset bundling and cache busting using external minification tool of your choice, no gem dependencies.
|
||||||
|
- [JekyllGalleryTag](https://github.com/redwallhp/JekyllGalleryTag) by [redwallhp](https://github.com/redwallhp): Generates thumbnails from a directory of images and displays them in a grid with a Liquid tag.
|
||||||
|
|
||||||
<div class="note info">
|
<div class="note info">
|
||||||
<h5>Jekyll Plugins Wanted</h5>
|
<h5>Jekyll Plugins Wanted</h5>
|
||||||
|
|
|
@ -113,11 +113,33 @@ Of course, you have full control over how (and where) you display your posts,
|
||||||
and how you structure your site. You should read more about [how templates
|
and how you structure your site. You should read more about [how templates
|
||||||
work](../templates) with Jekyll if you want to know more.
|
work](../templates) with Jekyll if you want to know more.
|
||||||
|
|
||||||
|
## Post excerpts
|
||||||
|
|
||||||
|
Each post automatically takes the first block of text, from the beginning of the content
|
||||||
|
to the first occurrence of `excerpt_separator`, and sets it as the `post.excerpt`.
|
||||||
|
Take the above example of an index of posts. Perhaps you want to include
|
||||||
|
a little hint about the post's content by adding the first paragraph of each of your
|
||||||
|
posts:
|
||||||
|
|
||||||
|
{% highlight html %}
|
||||||
|
<ul>
|
||||||
|
{% raw %}{% for post in site.posts %}{% endraw %}
|
||||||
|
<li>
|
||||||
|
<a href="{% raw %}{{ post.url }}{% endraw %}">{% raw %}{{ post.title }}{% endraw %}</a>
|
||||||
|
<p>{% raw %}{{ post.excerpt }}{% endraw %}</p>
|
||||||
|
</li>
|
||||||
|
{% raw %}{% endfor %}{% endraw %}
|
||||||
|
</ul>
|
||||||
|
{% endhighlight %}
|
||||||
|
|
||||||
|
If you don't like the automatically-generated post excerpt, it can be overridden by adding
|
||||||
|
`excerpt` to your post's YAML front-matter.
|
||||||
|
|
||||||
## Highlighting code snippets
|
## Highlighting code snippets
|
||||||
|
|
||||||
Jekyll also has built-in support for syntax highlighting of code snippets using
|
Jekyll also has built-in support for syntax highlighting of code snippets using
|
||||||
[Pygments](../extras), and including a code snippet in any post is easy. Just
|
Pygments, and including a code snippet in any post is easy. Just use the
|
||||||
use the dedicated Liquid tag as follows:
|
dedicated Liquid tag as follows:
|
||||||
|
|
||||||
{% highlight text %}
|
{% highlight text %}
|
||||||
{% raw %}{% highlight ruby %}{% endraw %}
|
{% raw %}{% highlight ruby %}{% endraw %}
|
||||||
|
|
|
@ -37,6 +37,20 @@ common tasks easier.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<p class='name'><strong>Date to RFC-822 Format</strong></p>
|
||||||
|
<p>Convert a Date into the RFC-822 format used for RSS feeds.</p>
|
||||||
|
</td>
|
||||||
|
<td class='align-center'>
|
||||||
|
<p>
|
||||||
|
<code class='filter'>{% raw %}{{ site.time | date_to_rfc822 }}{% endraw %}</code>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<code class='output'>Mon, 17 Nov 2008 13:07:54 -0800</code>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p class='name'><strong>Date to String</strong></p>
|
<p class='name'><strong>Date to String</strong></p>
|
||||||
|
@ -93,6 +107,22 @@ common tasks easier.
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<p class='name'><strong>URI Escape</strong></p>
|
||||||
|
<p>
|
||||||
|
URI escape a string.
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
<td class='align-center'>
|
||||||
|
<p>
|
||||||
|
<code class='filter'>{% raw %}{{ “'foo, bar \\baz?'” | uri_escape }}{% endraw %}</code>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
<code class='output'>foo,%20bar%20%5Cbaz?</code>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<p class='name'><strong>Number of Words</strong></p>
|
<p class='name'><strong>Number of Words</strong></p>
|
||||||
|
@ -166,9 +196,8 @@ root of your source directory. This will embed the contents of
|
||||||
|
|
||||||
Jekyll has built in support for syntax highlighting of [over 100
|
Jekyll has built in support for syntax highlighting of [over 100
|
||||||
languages](http://pygments.org/languages/) thanks to
|
languages](http://pygments.org/languages/) thanks to
|
||||||
[Pygments](http://pygments.org/). In order to take advantage of this you’ll need
|
[Pygments](http://pygments.org/). When you run Jekyll, make sure you run it
|
||||||
to have Pygments installed, and the `pygmentize` binary must be in your `$PATH`.
|
with `pygments` set to `true` in your configuration file.
|
||||||
When you run Jekyll, make sure you run it with [Pygments enabled](../extras).
|
|
||||||
|
|
||||||
To render a code block with syntax highlighting, surround your code as follows:
|
To render a code block with syntax highlighting, surround your code as follows:
|
||||||
|
|
||||||
|
|
|
@ -25,11 +25,11 @@ and `jekyll serve` to do the same. And if you want Jekyll to automatically
|
||||||
rebuild each time a file changes, just add the `--watch` flag at the end.
|
rebuild each time a file changes, just add the `--watch` flag at the end.
|
||||||
|
|
||||||
<div class="note info">
|
<div class="note info">
|
||||||
<h5 markdown="1">Watching and Serving</h5>
|
<h5>Watching and Serving</h5>
|
||||||
<p markdown="1">With the new subcommands, the way sites are previewed locally
|
<p markdown="1">With the new subcommands, the way sites are previewed locally
|
||||||
changed a bit. Instead of specifying `server: true` in the site's
|
changed a bit. Instead of specifying `server: true` in the site's
|
||||||
configuration file, use `jekyll serve`. The same hold's true for
|
configuration file, use `jekyll serve`. The same hold's true for
|
||||||
`watch: true`. Instead, use the `--watch` flag with either `jekyll serve`
|
`watch: true`. Instead, use the `--watch` flag with either `jekyll serve`
|
||||||
or `jekyll build`.</p>
|
or `jekyll build`.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ Until v1.1, it is **opt-in**. Starting with v1.1, however, absolute permalinks
|
||||||
will become **opt-out**, meaning Jekyll will default to using absolute permalinks
|
will become **opt-out**, meaning Jekyll will default to using absolute permalinks
|
||||||
instead of relative permalinks.
|
instead of relative permalinks.
|
||||||
|
|
||||||
* To use absolute permalinks, set `relative_permalinks: true` in your configuration file.
|
* To use absolute permalinks, set `relative_permalinks: false` in your configuration file.
|
||||||
* To continue using relative permalinks, set `relative_permalinks: false` in your configuration file.
|
* To continue using relative permalinks, set `relative_permalinks: true` in your configuration file.
|
||||||
|
|
||||||
<div class="note warning" id="absolute-permalinks-warning">
|
<div class="note warning" id="absolute-permalinks-warning">
|
||||||
<h5 markdown="1">Absolute permalinks will be default in v1.1 and on</h5>
|
<h5 markdown="1">Absolute permalinks will be default in v1.1 and on</h5>
|
||||||
|
@ -73,14 +73,14 @@ to one or more config files (comma-delimited, no spaces).
|
||||||
* `--paginate`
|
* `--paginate`
|
||||||
|
|
||||||
<div class="note info">
|
<div class="note info">
|
||||||
<h5 markdown="1">The `--config` explicitly specifies your configuration file(s)</h5>
|
<h5>The config flag explicitly specifies your configuration file(s)</h5>
|
||||||
<p markdown="1">If you use the `--config` flag, Jekyll will ignore your
|
<p markdown="1">If you use the `--config` flag, Jekyll will ignore your
|
||||||
`config.yml` file. Want to merge a custom configuration with the normal
|
`_config.yml` file. Want to merge a custom configuration with the normal
|
||||||
configuration? No problem. Jekyll will accept more than one custom config
|
configuration? No problem. Jekyll will accept more than one custom config
|
||||||
file via the command line. Config files cascade from right to left, such
|
file via the command line. Config files cascade from right to left, such
|
||||||
that if I run `jekyll serve --config config.yml,config-dev.yml`,
|
that if I run `jekyll serve --config _config.yml,_config-dev.yml`,
|
||||||
the values in the config files on the right (`config-dev.yml`) overwrite
|
the values in the config files on the right (`_config-dev.yml`) overwrite
|
||||||
those on the left (`config.yml`) when both contain the same key.</p>
|
those on the left (`_config.yml`) when both contain the same key.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
### Draft posts
|
### Draft posts
|
||||||
|
@ -89,14 +89,15 @@ Jekyll now lets you write draft posts, and allows you to easily preview how
|
||||||
they will look prior to publishing. To start a draft, simply create a folder
|
they will look prior to publishing. To start a draft, simply create a folder
|
||||||
called `_drafts` in your site's source directory (e.g., alongside `_posts`),
|
called `_drafts` in your site's source directory (e.g., alongside `_posts`),
|
||||||
and add a new markdown file to it. To preview your new post, simply run the
|
and add a new markdown file to it. To preview your new post, simply run the
|
||||||
`Jekyll serve` command with the `--drafts` flag.
|
`jekyll serve` command with the `--drafts` flag.
|
||||||
|
|
||||||
<div class="note info">
|
<div class="note info">
|
||||||
<h5 markdown="1">Drafts don't have dates</h5>
|
<h5 markdown="1">Drafts don't have dates</h5>
|
||||||
<p markdown="1">Unlike posts, drafts don't have a date, since they haven't
|
<p markdown="1">
|
||||||
been published yet. Rather than naming your draft something like
|
Unlike posts, drafts don't have a date, since they haven't
|
||||||
`2013-07-01-my-draft-post.md`, simply name the file what you'd like your
|
been published yet. Rather than naming your draft something like
|
||||||
post to eventually be titled, here `my-draft-post.md`.</p>
|
`2013-07-01-my-draft-post.md`, simply name the file what you'd like your
|
||||||
|
post to eventually be titled, here `my-draft-post.md`.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
### Baseurl
|
### Baseurl
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<div class="title">
|
<div class="title">
|
||||||
Tom Preston-Werner
|
Tom Preston-Werner
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ content }}
|
{{ content }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -51,9 +51,11 @@ class TestConfiguration < Test::Unit::TestCase
|
||||||
context "#backwards_compatibilize" do
|
context "#backwards_compatibilize" do
|
||||||
setup do
|
setup do
|
||||||
@config = Configuration[{
|
@config = Configuration[{
|
||||||
"auto" => true,
|
"auto" => true,
|
||||||
"watch" => true,
|
"watch" => true,
|
||||||
"server" => true
|
"server" => true,
|
||||||
|
"exclude" => "READ-ME.md, Gemfile,CONTRIBUTING.hello.markdown",
|
||||||
|
"include" => "STOP_THE_PRESSES.txt,.heloses, .git"
|
||||||
}]
|
}]
|
||||||
end
|
end
|
||||||
should "unset 'auto' and 'watch'" do
|
should "unset 'auto' and 'watch'" do
|
||||||
|
@ -66,6 +68,16 @@ class TestConfiguration < Test::Unit::TestCase
|
||||||
assert @config.has_key?("server")
|
assert @config.has_key?("server")
|
||||||
assert !@config.backwards_compatibilize.has_key?("server")
|
assert !@config.backwards_compatibilize.has_key?("server")
|
||||||
end
|
end
|
||||||
|
should "transform string exclude into an array" do
|
||||||
|
assert @config.has_key?("exclude")
|
||||||
|
assert @config.backwards_compatibilize.has_key?("exclude")
|
||||||
|
assert_equal @config.backwards_compatibilize["exclude"], %w[READ-ME.md Gemfile CONTRIBUTING.hello.markdown]
|
||||||
|
end
|
||||||
|
should "transform string include into an array" do
|
||||||
|
assert @config.has_key?("include")
|
||||||
|
assert @config.backwards_compatibilize.has_key?("include")
|
||||||
|
assert_equal @config.backwards_compatibilize["include"], %w[STOP_THE_PRESSES.txt .heloses .git]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
context "loading configuration" do
|
context "loading configuration" do
|
||||||
setup do
|
setup do
|
||||||
|
|
|
@ -102,7 +102,7 @@ class TestPage < Test::Unit::TestCase
|
||||||
assert_equal "/about/", @page.dir
|
assert_equal "/about/", @page.dir
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with specified layout of nil" do
|
context "with specified layout of nil" do
|
||||||
setup do
|
setup do
|
||||||
@page = setup_page('sitemap.xml')
|
@page = setup_page('sitemap.xml')
|
||||||
|
|
|
@ -11,6 +11,13 @@ class TestPager < Test::Unit::TestCase
|
||||||
assert_equal(3, Pager.calculate_pages([1,2,3,4,5], '2'))
|
assert_equal(3, Pager.calculate_pages([1,2,3,4,5], '2'))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
should "determine the pagination path" do
|
||||||
|
assert_nil(Pager.paginate_path(Jekyll::Configuration::DEFAULTS, 1))
|
||||||
|
assert_equal("page2", Pager.paginate_path(Jekyll::Configuration::DEFAULTS, 2))
|
||||||
|
assert_nil(Pager.paginate_path(Jekyll::Configuration::DEFAULTS.merge('paginate_path' => '/blog/page-:num'), 1))
|
||||||
|
assert_equal("page-2", Pager.paginate_path(Jekyll::Configuration::DEFAULTS.merge('paginate_path' => '/blog/page-:num'), 2))
|
||||||
|
end
|
||||||
|
|
||||||
context "pagination disabled" do
|
context "pagination disabled" do
|
||||||
setup do
|
setup do
|
||||||
stub(Jekyll).configuration do
|
stub(Jekyll).configuration do
|
||||||
|
|
|
@ -139,7 +139,7 @@ class TestPost < Test::Unit::TestCase
|
||||||
assert_equal "/2013/2008/09/09/foo-bar.html", @post.url
|
assert_equal "/2013/2008/09/09/foo-bar.html", @post.url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with specified layout of nil" do
|
context "with specified layout of nil" do
|
||||||
setup do
|
setup do
|
||||||
file = '2013-01-12-nil-layout.textile'
|
file = '2013-01-12-nil-layout.textile'
|
||||||
|
@ -422,7 +422,7 @@ class TestPost < Test::Unit::TestCase
|
||||||
post = setup_post("2009-01-27-empty-categories.textile")
|
post = setup_post("2009-01-27-empty-categories.textile")
|
||||||
assert_equal [], post.categories
|
assert_equal [], post.categories
|
||||||
end
|
end
|
||||||
|
|
||||||
should "recognize number category in yaml" do
|
should "recognize number category in yaml" do
|
||||||
post = setup_post("2013-05-10-number-category.textile")
|
post = setup_post("2013-05-10-number-category.textile")
|
||||||
assert post.categories.include?('2013')
|
assert post.categories.include?('2013')
|
||||||
|
@ -440,7 +440,7 @@ class TestPost < Test::Unit::TestCase
|
||||||
assert post.tags.include?('cooking')
|
assert post.tags.include?('cooking')
|
||||||
assert post.tags.include?('pizza')
|
assert post.tags.include?('pizza')
|
||||||
end
|
end
|
||||||
|
|
||||||
should "recognize empty tag in yaml" do
|
should "recognize empty tag in yaml" do
|
||||||
post = setup_post("2009-05-18-empty-tag.textile")
|
post = setup_post("2009-05-18-empty-tag.textile")
|
||||||
assert_equal [], post.tags
|
assert_equal [], post.tags
|
||||||
|
@ -528,46 +528,46 @@ class TestPost < Test::Unit::TestCase
|
||||||
assert_equal ['foo'], post.categories
|
assert_equal ['foo'], post.categories
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "converter file extension settings" do
|
context "converter file extension settings" do
|
||||||
setup do
|
setup do
|
||||||
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
|
stub(Jekyll).configuration { Jekyll::Configuration::DEFAULTS }
|
||||||
@site = Site.new(Jekyll.configuration)
|
@site = Site.new(Jekyll.configuration)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "process .md as markdown under default configuration" do
|
should "process .md as markdown under default configuration" do
|
||||||
post = setup_post '2011-04-12-md-extension.md'
|
post = setup_post '2011-04-12-md-extension.md'
|
||||||
conv = post.converter
|
conv = post.converter
|
||||||
assert conv.kind_of? Jekyll::Converters::Markdown
|
assert conv.kind_of? Jekyll::Converters::Markdown
|
||||||
end
|
end
|
||||||
|
|
||||||
should "process .text as identity under default configuration" do
|
should "process .text as identity under default configuration" do
|
||||||
post = setup_post '2011-04-12-text-extension.text'
|
post = setup_post '2011-04-12-text-extension.text'
|
||||||
conv = post.converter
|
conv = post.converter
|
||||||
assert conv.kind_of? Jekyll::Converters::Identity
|
assert conv.kind_of? Jekyll::Converters::Identity
|
||||||
end
|
end
|
||||||
|
|
||||||
should "process .text as markdown under alternate configuration" do
|
should "process .text as markdown under alternate configuration" do
|
||||||
@site.config['markdown_ext'] = 'markdown,mdw,mdwn,md,text'
|
@site.config['markdown_ext'] = 'markdown,mdw,mdwn,md,text'
|
||||||
post = setup_post '2011-04-12-text-extension.text'
|
post = setup_post '2011-04-12-text-extension.text'
|
||||||
conv = post.converter
|
conv = post.converter
|
||||||
assert conv.kind_of? Jekyll::Converters::Markdown
|
assert conv.kind_of? Jekyll::Converters::Markdown
|
||||||
end
|
end
|
||||||
|
|
||||||
should "process .md as markdown under alternate configuration" do
|
should "process .md as markdown under alternate configuration" do
|
||||||
@site.config['markdown_ext'] = 'markdown,mkd,mkdn,md,text'
|
@site.config['markdown_ext'] = 'markdown,mkd,mkdn,md,text'
|
||||||
post = setup_post '2011-04-12-text-extension.text'
|
post = setup_post '2011-04-12-text-extension.text'
|
||||||
conv = post.converter
|
conv = post.converter
|
||||||
assert conv.kind_of? Jekyll::Converters::Markdown
|
assert conv.kind_of? Jekyll::Converters::Markdown
|
||||||
end
|
end
|
||||||
|
|
||||||
should "process .text as textile under alternate configuration" do
|
should "process .text as textile under alternate configuration" do
|
||||||
@site.config['textile_ext'] = 'textile,text'
|
@site.config['textile_ext'] = 'textile,text'
|
||||||
post = setup_post '2011-04-12-text-extension.text'
|
post = setup_post '2011-04-12-text-extension.text'
|
||||||
conv = post.converter
|
conv = post.converter
|
||||||
assert conv.kind_of? Jekyll::Converters::Textile
|
assert conv.kind_of? Jekyll::Converters::Textile
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ class TestRedCloth < Test::Unit::TestCase
|
||||||
setup do
|
setup do
|
||||||
@textile = Converters::Textile.new
|
@textile = Converters::Textile.new
|
||||||
end
|
end
|
||||||
|
|
||||||
should "preserve single line breaks in HTML output" do
|
should "preserve single line breaks in HTML output" do
|
||||||
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
|
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
|
||||||
end
|
end
|
||||||
|
@ -19,7 +19,7 @@ class TestRedCloth < Test::Unit::TestCase
|
||||||
}
|
}
|
||||||
@textile = Converters::Textile.new config
|
@textile = Converters::Textile.new config
|
||||||
end
|
end
|
||||||
|
|
||||||
should "preserve single line breaks in HTML output" do
|
should "preserve single line breaks in HTML output" do
|
||||||
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
|
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
|
||||||
end
|
end
|
||||||
|
@ -34,7 +34,7 @@ class TestRedCloth < Test::Unit::TestCase
|
||||||
}
|
}
|
||||||
@textile = Converters::Textile.new config
|
@textile = Converters::Textile.new config
|
||||||
end
|
end
|
||||||
|
|
||||||
should "preserve single line breaks in HTML output" do
|
should "preserve single line breaks in HTML output" do
|
||||||
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
|
assert_equal "<p>line1<br />\nline2</p>", @textile.convert("p. line1\nline2").strip
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
require 'helper'
|
||||||
|
|
||||||
|
class TestRelatedPosts < Test::Unit::TestCase
|
||||||
|
context "building related posts without lsi" do
|
||||||
|
setup do
|
||||||
|
stub(Jekyll).configuration do
|
||||||
|
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir,
|
||||||
|
'destination' => dest_dir})
|
||||||
|
end
|
||||||
|
@site = Site.new(Jekyll.configuration)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "use the most recent posts for related posts" do
|
||||||
|
@site.reset
|
||||||
|
@site.read
|
||||||
|
assert_equal @site.posts[0..9], Jekyll::RelatedPosts.new(@site.posts.last).build
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "building related posts with lsi" do
|
||||||
|
setup do
|
||||||
|
stub(Jekyll).configuration do
|
||||||
|
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir,
|
||||||
|
'destination' => dest_dir,
|
||||||
|
'lsi' => true})
|
||||||
|
end
|
||||||
|
@site = Site.new(Jekyll.configuration)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "use lsi for the related posts" do
|
||||||
|
@site.reset
|
||||||
|
@site.read
|
||||||
|
require 'classifier'
|
||||||
|
any_instance_of(::Classifier::LSI) do |c|
|
||||||
|
stub(c).find_related { @site.posts[-1..-9] }
|
||||||
|
stub(c).build_index
|
||||||
|
end
|
||||||
|
assert_equal @site.posts[-1..-9], Jekyll::RelatedPosts.new(@site.posts.last).build
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -195,7 +195,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
@site.exclude = excludes + ["exclude*"]
|
@site.exclude = excludes + ["exclude*"]
|
||||||
assert_equal files, @site.filter_entries(excludes + files + ["excludeA"])
|
assert_equal files, @site.filter_entries(excludes + files + ["excludeA"])
|
||||||
end
|
end
|
||||||
|
|
||||||
should "not filter entries within include" do
|
should "not filter entries within include" do
|
||||||
includes = %w[_index.html .htaccess include*]
|
includes = %w[_index.html .htaccess include*]
|
||||||
files = %w[index.html _index.html .htaccess includeA]
|
files = %w[index.html _index.html .htaccess includeA]
|
||||||
|
@ -284,7 +284,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
File.open(dest_dir('.svn/HEAD'), 'w')
|
File.open(dest_dir('.svn/HEAD'), 'w')
|
||||||
File.open(dest_dir('.hg/HEAD'), 'w')
|
File.open(dest_dir('.hg/HEAD'), 'w')
|
||||||
end
|
end
|
||||||
|
|
||||||
teardown do
|
teardown do
|
||||||
FileUtils.rm_f(dest_dir('obsolete.html'))
|
FileUtils.rm_f(dest_dir('obsolete.html'))
|
||||||
FileUtils.rm_rf(dest_dir('qux'))
|
FileUtils.rm_rf(dest_dir('qux'))
|
||||||
|
@ -293,7 +293,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
FileUtils.rm_rf(dest_dir('.svn'))
|
FileUtils.rm_rf(dest_dir('.svn'))
|
||||||
FileUtils.rm_rf(dest_dir('.hg'))
|
FileUtils.rm_rf(dest_dir('.hg'))
|
||||||
end
|
end
|
||||||
|
|
||||||
should 'remove orphaned files in destination' do
|
should 'remove orphaned files in destination' do
|
||||||
@site.process
|
@site.process
|
||||||
assert !File.exist?(dest_dir('obsolete.html'))
|
assert !File.exist?(dest_dir('obsolete.html'))
|
||||||
|
@ -317,7 +317,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
assert File.exist?(dest_dir('.svn/HEAD'))
|
assert File.exist?(dest_dir('.svn/HEAD'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'with an invalid markdown processor in the configuration' do
|
context 'with an invalid markdown processor in the configuration' do
|
||||||
should 'not throw an error at initialization time' do
|
should 'not throw an error at initialization time' do
|
||||||
bad_processor = 'not a processor name'
|
bad_processor = 'not a processor name'
|
||||||
|
@ -325,7 +325,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
should 'throw FatalException at process time' do
|
should 'throw FatalException at process time' do
|
||||||
bad_processor = 'not a processor name'
|
bad_processor = 'not a processor name'
|
||||||
s = Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
s = Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
||||||
|
@ -334,6 +334,6 @@ class TestSite < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue