Merge branch 'master' into frontmatter-defaults

This commit is contained in:
maul.esel 2013-12-05 19:29:57 +01:00
commit f1869cda98
46 changed files with 689 additions and 437 deletions

View File

@ -1,4 +1,5 @@
language: ruby
cache: bundler
before_install:
- gem install bundler
rvm:

View File

@ -1,9 +1,61 @@
## HEAD
### Major Enhancements
* Add support for TOML config files (#1765)
### Minor Enhancements
* Sort plugins as a way to establish a load order (#1682)
### Bug Fixes
* Add a space between two words in a Pagination warning message (#1769)
### Development Fixes
* Remove some whitespace in the code (#1755)
### Site Enhancements
* Fixed case of a word in the Jekyll v1.3.0 release post (#1762)
* Fixed the mime type for the favicon (#1772)
## 1.3.1 / 2013-11/26
### Minor Enhancements
* Add a `--prefix` option to passthrough for the importers (#1669)
* Push the paginator plugin lower in the plugin priority order so
other plugins run before it (#1759)
### Bug Fixes
* Fix the include tag when ran in a loop (#1726)
* Fix errors when using `--watch` on 1.8.7 (#1730)
* Specify where the include is called from if an included file is
missing (#1746)
### Development Fixes
* Extract `Site#filter_entries` into its own object (#1697)
* Enable Travis' bundle caching (#1734)
* Remove trailing whitespace in some files (#1736)
* Fix a duplicate test name (#1754)
### Site Enhancements
* Update link to example Rakefile to point to specific commit (#1741)
* Fix drafts docs to indicate that draft time is based on file modification
time, not `Time.now` (#1695)
* Add `jekyll-monthly-archive-plugin` and `jekyll-category-archive-plugin` to
list of third-party plugins (#1693)
* Add `jekyll-asset-path-plugin` to list of third-party plugins (#1670)
* Add `emoji-for-jekyll` to list of third-part plugins (#1708)
* Fix previous section link on plugins page to point to pagination page (#1707)
* Add `org-mode` converter plugin to third-party plugins (#1711)
* Point "Blog migrations" page to http://import.jekyllrb.com (#1732)
* Add docs for `post_url` when posts are in subdirectories (#1718)
* Update the docs to point to `example.com` (#1448)
## 1.3.0 / 2013-11-04
### Major Enhancements
* Add support for adding data as YAML files under a site's `_data`
directory (#1003)
* Allow variables to be used with `include` tags (#1495)
* Allow using gems for plugin management (#1557)
### Minor Enhancements
* Decrease the specificity in the site template CSS (#1574)
@ -17,6 +69,10 @@
* Update Kramdown dependency to `~> 1.2` (#1610)
* Update `safe_yaml` dependency to `~> 0.9.7` (#1602)
* Allow layouts to be in subfolders like includes (#1622)
* Switch to listen for site watching while serving (#1589)
* Add a `json` liquid filter to be used in sites (#1651)
* Point people to the migration docs when the `jekyll-import` gem is
missing (#1662)
### Bug Fixes
* Fix up matching against source and destination when the two
@ -27,6 +83,11 @@
* Downgrade to Maruku `~> 0.6.0` in order to avoid changes in rendering (#1598)
* Fix error with failing include tag when variable was file name (#1613)
* Downcase lexers before passing them to pygments (#1615)
* Capitalize the short verbose switch because it conflicts with the
built-in Commander switch (#1660)
* Fix compatibility with 1.8.x (#1665)
* Fix an error with the new file watching code due to library version
incompatibilities (#1687)
### Development Fixes
* Add coverage reporting with Coveralls (#1539)
@ -37,6 +98,12 @@
* Update coveralls dependency to `~> 0.7.0` (#1606)
* Update rake dependency to `~> 10.1` (#1603)
* Clean up `site.rb` comments to be more concise/uniform (#1616)
* Use the master branch for the build badge in the readme (#1636)
* Refactor Site#render (#1638)
* Remove duplication in command line options (#1637)
* Add tests for all the coderay options (#1543)
* Improve some of the cucumber test code (#1493)
* Improve comparisons of timestamps by ignoring the seconds (#1582)
### Site Enhancements
* Fix params for `JekyllImport::WordPress.process` arguments (#1554)
@ -49,6 +116,12 @@
* Improve the instructions for mimicking GitHub Flavored Markdown
(#1614)
* Add `jekyll-import` warning note of missing dependencies (#1626)
* Fix grammar in the Usage section (#1635)
* Add documentation for the use of gems as plugins (#1656)
* Document the existence of a few additional plugins (#1405)
* Document that the `date_to_string` always returns a two digit day (#1663)
* Fix navigation in the "Working with Drafts" page (#1667)
* Fix an error with the data documentation (#1691)
## 1.2.1 / 2013-09-14

View File

@ -2,7 +2,7 @@
[![Gem Version](https://badge.fury.io/rb/jekyll.png)](http://badge.fury.io/rb/jekyll)
[![Build Status](https://secure.travis-ci.org/mojombo/jekyll.png)](https://travis-ci.org/mojombo/jekyll)
[![Build Status](https://secure.travis-ci.org/mojombo/jekyll.png?branch=master)](https://travis-ci.org/mojombo/jekyll)
[![Code Climate](https://codeclimate.com/github/mojombo/jekyll.png)](https://codeclimate.com/github/mojombo/jekyll)
[![Dependency Status](https://gemnasium.com/mojombo/jekyll.png)](https://gemnasium.com/mojombo/jekyll)
[![Coverage Status](https://coveralls.io/repos/mojombo/jekyll/badge.png)](https://coveralls.io/r/mojombo/jekyll)

View File

@ -33,6 +33,16 @@ def normalize_options(options)
options
end
def add_build_options(c)
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
c.option '--future', 'Publishes posts with a future date'
c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
c.option '-w', '--watch', 'Watch for changes and rebuild'
c.option '--lsi', 'Use LSI for improved related posts'
c.option '-D', '--drafts', 'Render posts in the _drafts folder'
c.option '-V', '--verbose', 'Print verbose output.'
end
command :default do |c|
c.action do |args, options|
if args.empty?
@ -59,13 +69,7 @@ command :build do |c|
c.syntax = 'jekyll build [options]'
c.description = 'Build your site'
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
c.option '--future', 'Publishes posts with a future date'
c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
c.option '-w', '--watch', 'Watch for changes and rebuild'
c.option '--lsi', 'Use LSI for improved related posts'
c.option '-D', '--drafts', 'Render posts in the _drafts folder'
c.option '-v', '--verbose', 'Print verbose output.'
add_build_options(c)
c.action do |args, options|
options = normalize_options(options.__hash__)
@ -78,15 +82,9 @@ command :serve do |c|
c.syntax = 'jekyll serve [options]'
c.description = 'Serve your site locally'
c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file'
c.option '--future', 'Publishes posts with a future date'
c.option '--limit_posts MAX_POSTS', Integer, 'Limits the number of posts to parse and publish'
c.option '-w', '--watch', 'Watch for changes and rebuild'
c.option '--lsi', 'Use LSI for improved related posts'
c.option '-B', '--detach', 'Run the server in the background (detach)'
c.option '-D', '--drafts', 'Render posts in the _drafts folder'
c.option '-v', '--verbose', 'Print verbose output.'
add_build_options(c)
c.option '-B', '--detach', 'Run the server in the background (detach)'
c.option '-P', '--port [PORT]', 'Port to listen on'
c.option '-H', '--host [HOST]', 'Host to bind to'
c.option '-b', '--baseurl [URL]', 'Base URL'
@ -145,14 +143,14 @@ command :import do |c|
c.option '--user STRING', 'Username to use when migrating'
c.option '--pass STRING', 'Password to use when migrating'
c.option '--host STRING', 'Host address to use when migrating'
c.option '--prefix STRING', 'Database table prefix to use when migrating'
c.action do |args, options|
begin
require 'jekyll-import'
rescue LoadError
msg = "You must install the 'jekyll-import' gem before continuing.\n"
msg += "* Do this by running `gem install jekyll-import`.\n"
msg += "* Or if you need root privileges, run `sudo gem install jekyll-import`."
msg += "* Please see the documentation at http://jekyllrb.com/docs/migrations/ for instructions.\n"
abort msg
end
Jekyll::Commands::Import.process(args.first, options)

View File

@ -46,3 +46,12 @@ Feature: Include tags
When I run jekyll
Then the _site directory should exist
And I should see "a snippet that works with parameters" in "_site/index.html"
Scenario: Include a variable file in a loop
Given I have an _includes directory
And I have an "_includes/one.html" file that contains "one"
And I have an "_includes/two.html" file that contains "two"
And I have an "index.html" page with files "[one.html, two.html]" that contains "{% for file in page.files %}{% include {{file}} %} {% endfor %}"
When I run jekyll
Then the _site directory should exist
And I should see "one two" in "_site/index.html"

View File

@ -225,3 +225,11 @@ Feature: Site configuration
And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html"
And I should see "Post Layout: <p>content for entry1.</p>" in "_site/2007/12/31/entry1.html"
And I should see "Post Layout: <p>content for entry2.</p>" in "_site/2020/01/31/entry2.html"
Scenario: Add a gem-based plugin
Given I have an "index.html" file that contains "Whatever"
And I have a configuration file with "gems" set to "[jekyll_test_plugin]"
When I run jekyll
Then the _site directory should exist
And I should see "Whatever" in "_site/index.html"
And I should see "this is a test" in "_site/test.txt"

View File

@ -4,10 +4,10 @@ Feature: Site data
In order to make the site slightly dynamic
Scenario: Use page variable in a page
Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@me.com"
Given I have an "contact.html" page with title "Contact" that contains "{{ page.title }}: email@example.com"
When I run jekyll
Then the _site directory should exist
And I should see "Contact: email@me.com" in "_site/contact.html"
And I should see "Contact: email@example.com" in "_site/contact.html"
Scenario Outline: Use page.path variable in a page
Given I have a <dir> directory
@ -95,10 +95,10 @@ Feature: Site data
Scenario: Use configuration date in site payload
Given I have an "index.html" page that contains "{{ site.url }}"
And I have a configuration file with "url" set to "http://mysite.com"
And I have a configuration file with "url" set to "http://example.com"
When I run jekyll
Then the _site directory should exist
And I should see "http://mysite.com" in "_site/index.html"
And I should see "http://example.com" in "_site/index.html"
Scenario: Access Jekyll version via jekyll.version
Given I have an "index.html" page that contains "{{ jekyll.version }}"

View File

@ -157,19 +157,19 @@ Then /^the (.*) directory should not exist$/ do |dir|
end
Then /^I should see "(.*)" in "(.*)"$/ do |text, file|
assert Regexp.new(text).match(File.open(file).readlines.join)
assert_match Regexp.new(text), file_contents(file)
end
Then /^I should see exactly "(.*)" in "(.*)"$/ do |text, file|
assert_equal text, File.open(file).readlines.join.strip
assert_equal text, file_contents(file).strip
end
Then /^I should not see "(.*)" in "(.*)"$/ do |text, file|
assert_no_match Regexp.new(text), File.read(file)
assert_no_match Regexp.new(text), file_contents(file)
end
Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file|
assert Regexp.new(Regexp.escape(text)).match(File.open(file).readlines.join)
assert_match Regexp.new(Regexp.escape(text)), file_contents(file)
end
Then /^the "(.*)" file should +exist$/ do |file|
@ -181,9 +181,9 @@ Then /^the "(.*)" file should not exist$/ do |file|
end
Then /^I should see today's time in "(.*)"$/ do |file|
assert_match Regexp.new(Regexp.escape(Time.now.to_s)), File.open(file).readlines.join
assert_match Regexp.new(seconds_agnostic_time(Time.now)), file_contents(file)
end
Then /^I should see today's date in "(.*)"$/ do |file|
assert_match Regexp.new(Date.today.to_s), File.open(file).readlines.join
assert_match Regexp.new(Date.today.to_s), file_contents(file)
end

View File

@ -40,5 +40,36 @@ def location(folder, direction)
[before || '.', after || '.']
end
def file_contents(path)
File.open(path) do |file|
file.readlines.join # avoid differences with \n and \r\n line endings
end
end
def seconds_agnostic_datetime(datetime = Time.now)
pieces = datetime.to_s.split(" ")
if pieces.size == 6 # Ruby 1.8.7
date = pieces[0..2].join(" ")
time = seconds_agnostic_time(pieces[3])
zone = pieces[4..5].join(" ")
else # Ruby 1.9.1 or greater
date, time, zone = pieces
time = seconds_agnostic_time(time)
end
[
Regexp.escape(date),
"#{time}:\\d{2}",
Regexp.escape(zone)
].join("\\ ")
end
def seconds_agnostic_time(time)
if time.is_a? Time
time = time.strftime("%H:%M:%S")
end
hour, minutes, _ = time.split(":")
"#{hour}:#{minutes}"
end
# work around "invalid option: --format" cucumber bug (see #296)
Test::Unit.run = true if RUBY_VERSION < '1.9'

View File

@ -4,9 +4,9 @@ Gem::Specification.new do |s|
s.rubygems_version = '1.3.5'
s.name = 'jekyll'
s.version = '1.2.1'
s.version = '1.3.1'
s.license = 'MIT'
s.date = '2013-09-14'
s.date = '2013-11-26'
s.rubyforge_project = 'jekyll'
s.summary = "A simple, blog aware, static site generator."
@ -25,13 +25,14 @@ Gem::Specification.new do |s|
s.add_runtime_dependency('liquid', "~> 2.5.2")
s.add_runtime_dependency('classifier', "~> 1.3")
s.add_runtime_dependency('directory_watcher', "~> 1.4.1")
s.add_runtime_dependency('listen', "~> 1.3")
s.add_runtime_dependency('maruku', "~> 0.6.0")
s.add_runtime_dependency('pygments.rb', "~> 0.5.0")
s.add_runtime_dependency('commander', "~> 4.1.3")
s.add_runtime_dependency('safe_yaml', "~> 0.9.7")
s.add_runtime_dependency('colorator', "~> 0.1")
s.add_runtime_dependency('redcarpet', "~> 2.3.0")
s.add_runtime_dependency('toml', '~> 0.0.4')
s.add_development_dependency('rake', "~> 10.1")
s.add_development_dependency('rdoc', "~> 3.11")
@ -46,7 +47,9 @@ Gem::Specification.new do |s|
s.add_development_dependency('simplecov', "~> 0.7")
s.add_development_dependency('simplecov-gem-adapter', "~> 1.0.1")
s.add_development_dependency('coveralls', "~> 0.7.0")
s.add_development_dependency('mime-types', "~> 1.5")
s.add_development_dependency('activesupport', '~> 3.2.13')
s.add_development_dependency('jekyll_test_plugin')
# = MANIFEST =
s.files = %w[
@ -93,6 +96,7 @@ Gem::Specification.new do |s|
lib/jekyll/core_ext.rb
lib/jekyll/deprecator.rb
lib/jekyll/draft.rb
lib/jekyll/entry_filter.rb
lib/jekyll/errors.rb
lib/jekyll/excerpt.rb
lib/jekyll/filters.rb
@ -152,12 +156,16 @@ Gem::Specification.new do |s|
site/_posts/2013-07-25-jekyll-1-1-2-released.markdown
site/_posts/2013-09-06-jekyll-1-2-0-released.markdown
site/_posts/2013-09-14-jekyll-1-2-1-released.markdown
site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown
site/_posts/2013-11-04-jekyll-1-3-0-released.markdown
site/_posts/2013-11-26-jekyll-1-3-1-released.markdown
site/css/gridism.css
site/css/normalize.css
site/css/pygments.css
site/css/style.css
site/docs/configuration.md
site/docs/contributing.md
site/docs/datafiles.md
site/docs/deployment-methods.md
site/docs/drafts.md
site/docs/extras.md
@ -204,10 +212,13 @@ Gem::Specification.new do |s|
test/helper.rb
test/source/+/foo.md
test/source/.htaccess
test/source/_data/languages.yml
test/source/_data/members.yaml
test/source/_data/products.yml
test/source/_includes/params.html
test/source/_includes/sig.markdown
test/source/_layouts/default.html
test/source/_layouts/post/simple.html
test/source/_layouts/simple.html
test/source/_plugins/dummy.rb
test/source/_posts/2008-02-02-not-published.textile
@ -253,7 +264,9 @@ Gem::Specification.new do |s|
test/source/deal.with.dots.html
test/source/foo/_posts/bar/2008-12-12-topical-post.textile
test/source/index.html
test/source/products.yml
test/source/sitemap.xml
test/source/symlink-test/_data
test/source/symlink-test/symlinked-dir
test/source/symlink-test/symlinked-file
test/source/win/_posts/2009-05-24-yaml-linebreak.markdown
@ -263,6 +276,7 @@ Gem::Specification.new do |s|
test/test_configuration.rb
test/test_convertible.rb
test/test_core_ext.rb
test/test_entry_filter.rb
test/test_excerpt.rb
test/test_filters.rb
test/test_generated_site.rb

View File

@ -26,6 +26,7 @@ require 'pathname'
require 'liquid'
require 'maruku'
require 'colorator'
require 'toml'
# internal requires
require 'jekyll/core_ext'
@ -46,6 +47,7 @@ require 'jekyll/static_file'
require 'jekyll/errors'
require 'jekyll/related_posts'
require 'jekyll/cleaner'
require 'jekyll/entry_filter'
# extensions
require 'jekyll/plugin'
@ -62,7 +64,7 @@ require_all 'jekyll/tags'
SafeYAML::OPTIONS[:suppress_warnings] = true
module Jekyll
VERSION = '1.2.1'
VERSION = '1.3.1'
# Public: Generate a Jekyll configuration Hash by merging the default
# options with anything in _config.yml, and adding the given options on top.

View File

@ -31,27 +31,33 @@ module Jekyll
#
# Returns nothing.
def self.watch(site, options)
require 'directory_watcher'
require 'listen'
source = options['source']
destination = options['destination']
begin
dest = Pathname.new(destination).relative_path_from(Pathname.new(source)).to_s
ignored = Regexp.new(Regexp.escape(dest))
rescue ArgumentError
# Destination is outside the source, no need to ignore it.
ignored = nil
end
Jekyll.logger.info "Auto-regeneration:", "enabled"
dw = DirectoryWatcher.new(source, :glob => self.globs(source, destination), :pre_load => true)
dw.interval = 1
dw.add_observer do |*args|
listener = Listen::Listener.new(source, :ignore => ignored) do |modified, added, removed|
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
print Jekyll.logger.formatted_topic("Regenerating:") + "#{args.size} files at #{t} "
n = modified.length + added.length + removed.length
print Jekyll.logger.formatted_topic("Regenerating:") + "#{n} files at #{t} "
self.process_site(site)
puts "...done."
end
dw.start
listener.start
unless options['serving']
trap("INT") do
listener.stop
puts " Halting auto-regeneration."
exit 0
end

View File

@ -12,6 +12,7 @@ module Jekyll
'layouts' => '_layouts',
'data_source' => '_data',
'keep_files' => ['.git','.svn'],
'gems' => [],
'timezone' => nil, # use the local timezone
@ -26,7 +27,7 @@ module Jekyll
'pygments' => true,
'relative_permalinks' => true, # backwards-compatibility with < 1.0
# will be set to false once 1.1 hits
# will be set to false once 2.0 hits
'markdown' => 'maruku',
'permalink' => 'date',
@ -100,6 +101,17 @@ module Jekyll
override['source'] || self['source'] || DEFAULTS['source']
end
def safe_load_file(filename)
case File.extname(filename)
when '.toml'
TOML.load_file(filename)
when /\.y(a)?ml/
YAML.safe_load_file(filename)
else
raise ArgumentError, "No parser for '#{filename}' is available. Use a .toml or .y(a)ml file instead."
end
end
# Public: Generate list of configuration files from the override
#
# override - the command-line options hash
@ -122,8 +134,8 @@ module Jekyll
#
# Returns this configuration, overridden by the values in the file
def read_config_file(file)
next_config = YAML.safe_load_file(file)
raise ArgumentError.new("Configuration file: (INVALID) #{file}".yellow) if !next_config.is_a?(Hash)
next_config = safe_load_file(file)
raise ArgumentError.new("Configuration file: (INVALID) #{file}".yellow) unless next_config.is_a?(Hash)
Jekyll.logger.info "Configuration file:", file
next_config
rescue SystemCallError
@ -132,7 +144,7 @@ module Jekyll
{}
else
Jekyll.logger.error "Fatal:", "The configuration file '#{file}' could not be found."
raise LoadError
raise LoadError, "The Configuration file '#{file}' could not be found."
end
end

View File

@ -16,7 +16,7 @@ module Jekyll
if @config['kramdown']['use_coderay']
%w[wrap line_numbers line_numbers_start tab_width bold_every css default_lang].each do |opt|
key = "coderay_#{opt}"
@config['kramdown'][key.to_sym] = @config['kramdown']['coderay'][key] unless @config['kramdown'].has_key?(key)
@config['kramdown'][key] = @config['kramdown']['coderay'][key] unless @config['kramdown'].has_key?(key)
end
end

View File

@ -88,7 +88,7 @@ module Jekyll
def render_liquid(content, payload, info, path = nil)
Liquid::Template.parse(content).render!(payload, info)
rescue Tags::IncludeTagError => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}"
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{e.path}, included in #{path || self.path}"
raise e
rescue Exception => e
Jekyll.logger.error "Liquid Exception:", "#{e.message} in #{path || self.path}"

View File

@ -0,0 +1,35 @@
class EntryFilter
attr_reader :site
def initialize(site)
@site = site
end
def filter(entries)
entries.reject do |e|
unless included?(e)
special?(e) || backup?(e) || excluded?(e) || symlink?(e)
end
end
end
def included?(entry)
site.include.glob_include?(entry)
end
def special?(entry)
['.', '_', '#'].include?(entry[0..0])
end
def backup?(entry)
entry[-1..-1] == '~'
end
def excluded?(entry)
site.exclude.glob_include?(entry)
end
def symlink?(entry)
File.symlink?(entry) && site.safe
end
end

View File

@ -1,4 +1,5 @@
require 'uri'
require 'json'
module Jekyll
module Filters
@ -148,6 +149,15 @@ module Jekyll
end
end
# Convert the input into json string
#
# input - The Array or Hash to be converted
#
# Returns the converted json string
def jsonify(input)
input.to_json
end
private
def time(input)
case input

View File

@ -4,6 +4,9 @@ module Jekyll
# This generator is safe from arbitrary code execution.
safe true
# This generator should be passive with regard to its execution
priority :lowest
# Generate paginated pages if necessary.
#
# site - The Site.
@ -14,7 +17,7 @@ module Jekyll
if template = template_page(site)
paginate(site, template)
else
Jekyll.logger.warn "Pagination:", "Pagination is enabled, but I couldn't find" +
Jekyll.logger.warn "Pagination:", "Pagination is enabled, but I couldn't find " +
"an index.html page to use as the pagination template. Skipping pagination."
end
end

View File

@ -3,7 +3,7 @@ module Jekyll
attr_accessor :config, :layouts, :posts, :pages, :static_files,
:categories, :exclude, :include, :source, :dest, :lsi, :pygments,
:permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts,
:show_drafts, :keep_files, :baseurl, :data, :file_read_opts
:show_drafts, :keep_files, :baseurl, :data, :file_read_opts, :gems
attr_accessor :converters, :generators
@ -13,7 +13,7 @@ module Jekyll
def initialize(config)
self.config = config.clone
%w[safe lsi pygments baseurl exclude include future show_drafts limit_posts keep_files].each do |opt|
%w[safe lsi pygments baseurl exclude include future show_drafts limit_posts keep_files gems].each do |opt|
self.send("#{opt}=", config[opt])
end
@ -73,10 +73,13 @@ module Jekyll
# directory.
unless self.safe
self.plugins.each do |plugins|
Dir[File.join(plugins, "**/*.rb")].each do |f|
Dir[File.join(plugins, "**/*.rb")].sort.each do |f|
require f
end
end
self.gems.each do |gem|
require gem
end
end
self.converters = instantiate_subclasses(Jekyll::Converter)
@ -231,14 +234,11 @@ module Jekyll
#
# Returns nothing.
def render
payload = site_payload
self.posts.each do |post|
post.render(self.layouts, payload)
end
relative_permalinks_deprecation_method
self.pages.each do |page|
relative_permalinks_deprecation_method if page.uses_relative_permalinks
page.render(self.layouts, payload)
payload = site_payload
[self.posts, self.pages].flatten.each do |page_or_post|
page_or_post.render(self.layouts, payload)
end
self.categories.values.map { |ps| ps.sort! { |a, b| b <=> a } }
@ -325,14 +325,7 @@ module Jekyll
#
# Returns the Array of filtered entries.
def filter_entries(entries)
entries.reject do |e|
unless self.include.glob_include?(e)
['.', '_', '#'].include?(e[0..0]) ||
e[-1..-1] == '~' ||
self.exclude.glob_include?(e) ||
(File.symlink?(e) && self.safe)
end
end
EntryFilter.new(self).filter(entries)
end
# Get the implementation class for the given Converter.
@ -389,15 +382,14 @@ module Jekyll
end
def relative_permalinks_deprecation_method
if config['relative_permalinks'] && !@deprecated_relative_permalinks
if config['relative_permalinks'] && has_relative_page?
$stderr.puts # Places newline after "Generating..."
Jekyll.logger.warn "Deprecation:", "Starting in 1.1, permalinks for pages" +
Jekyll.logger.warn "Deprecation:", "Starting in 2.0, permalinks for pages" +
" in subfolders must be relative to the" +
" site source directory, not the parent" +
" directory. Check http://jekyllrb.com/docs/upgrading/"+
" for more info."
$stderr.print Jekyll.logger.formatted_topic("") + "..." # for "done."
@deprecated_relative_permalinks = true
end
end
@ -415,6 +407,10 @@ module Jekyll
private
def has_relative_page?
self.pages.any? { |page| page.uses_relative_permalinks }
end
def has_yaml_header?(file)
"---" == File.open(file) { |fd| fd.read(3) }
end

View File

@ -43,8 +43,8 @@ module Jekyll
params
end
def validate_file_name
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
def validate_file_name(file)
if file !~ /^[a-zA-Z0-9_\/\.-]+$/ || file =~ /\.\// || file =~ /\/\./
raise ArgumentError.new <<-eos
Invalid syntax for include tag. File contains invalid characters or sequences:
@ -82,7 +82,7 @@ eos
def retrieve_variable(context)
if /\{\{([\w\-\.]+)\}\}/ =~ @file
raise ArgumentError.new("No variable #{$1} was found in include tag") if context[$1].nil?
@file = context[$1]
context[$1]
end
end
@ -90,13 +90,14 @@ eos
dir = File.join(context.registers[:site].source, INCLUDES_DIR)
validate_dir(dir, context.registers[:site].safe)
retrieve_variable(context)
validate_file_name
file = retrieve_variable(context) || @file
validate_file_name(file)
file = File.join(dir, @file)
validate_file(file, context.registers[:site].safe)
path = File.join(dir, file)
validate_file(path, context.registers[:site].safe)
partial = Liquid::Template.parse(source(file, context))
begin
partial = Liquid::Template.parse(source(path, context))
context.stack do
context['include'] = parse_params(context) if @params
@ -105,6 +106,7 @@ eos
rescue => e
raise IncludeTagError.new e.message, File.join(INCLUDES_DIR, @file)
end
end
def validate_dir(dir, safe)
if File.symlink?(dir) && safe

View File

@ -12,6 +12,6 @@
<link rel="stylesheet" href="{{ site.url }}/css/gridism.css" />
<link rel="stylesheet" href="{{ site.url }}/css/style.css" />
<link rel="stylesheet" href="{{ site.url }}/css/pygments.css" />
<link rel="icon" type="image/x-icon" href="{{ site.url }}/favicon.png" />
<link rel="icon" type="image/png" href="{{ site.url }}/favicon.png" />
<script src="{{ site.url }}/js/modernizr-2.5.3.min.js"></script>
</head>

View File

@ -0,0 +1,19 @@
---
layout: news_item
title: 'Jekyll 1.3.0.rc1 Released'
date: 2013-10-28 20:14:39 -0500
author: mattr-
version: 1.3.0.rc1
categories: [release]
---
Jekyll 1.3.0 is going to be a big release! In order to make sure we
didn't screw anything up too badly, we're making a release candidate
available for any early adopters who want to give the latest and
greatest code a spin without having to clone a repository from git.
Please take this prerelease for a spin and [let us
know](https://github.com/mojombo/jekyll/issues/new) if you run into any
issues!

View File

@ -0,0 +1,43 @@
---
layout: news_item
title: 'Jekyll 1.3.0 Released'
date: 2013-11-04 21:46:02 -0600
author: mattr-
version: 1.3.0
categories: [release]
---
It's been about six weeks since v1.2.0 and the Jekyll team is happy to
announce the arrival of v1.3.0. This is a **huge** release full of all
sorts of new features, bug fixes, and other things that you're sure to
love.
Here are a few things we think you'll want to know about this release:
* You can add [arbitrary data][] to the site by adding YAML files under a
site's `_data` directory. This will allow you to avoid
repetition in your templates and to set site specific options without
changing `_config.yml`.
* You can now run `jekyll serve --detach` to boot up a WEBrick server in the
background. **Note:** you'll need to run `kill [server_pid]` to shut
the server down. When ran, you'll get a process id that you can use in
place of `[server_pid]`
* You can now **disable automatically-generated excerpts** if you set
`excerpt_separator` to `""`.
* If you're moving pages and posts, you can now check for **URL
conflicts** by running `jekyll doctor`.
* If you're a fan of the drafts feature, you'll be happy to know we've
added `-D`, a shortened version of `--drafts`.
* Permalinks with special characters should now generate without errors.
* Expose the current Jekyll version as the `jekyll.version` Liquid
variable.
For a full run-down, visit our [change log](/docs/history/)!
[arbitrary data]: /docs/datafiles/

View File

@ -0,0 +1,21 @@
---
layout: news_item
title: 'Jekyll 1.3.1 Released'
date: 2013-11-26 19:52:20 -0600
author: mattr-
version: 1.3.1
categories: [release]
---
Just in time for the US holiday Thanksgiving, we're releasing version
1.3.1 of Jekyll to address some of the issues seen since the
release of 1.3.0.
In addition to a couple of other smaller bug fixes, the biggest thing
we've fixed is an issue with the `--watch` option with Ruby 1.8.7. For a
full run-down, visit our [change log](/docs/history/)!
Thanks to all the people who have contributed to this release! They are
(in alphabetical order): Abhi Yerra, Anatol Broder, Andreas Möller, Greg
Karékinian, Sam Rayner, Santeri Paavolainen, Shigeya Suzuki, Yihang Ho,
albertogg, andrewhavens, maul.esel, and thomasdao

View File

@ -330,6 +330,7 @@ layouts: ./_layouts
include: ['.htaccess']
exclude: []
keep_files: ['.git','.svn']
gems: []
timezone: nil
encoding: nil

View File

@ -57,7 +57,7 @@ You can now render the list of members in a template:
{{ member.name }}
</a>
</li>
{% end %}
{% endfor %}
</ul>
{% endraw %}
{% endhighlight %}

View File

@ -37,7 +37,7 @@ this](http://web.archive.org/web/20091223025644/http://www.taknado.com/en/2009/0
To have a remote server handle the deploy for you every time you push changes using Git, you can create a user account which has all the public keys that are authorized to deploy in its `authorized_keys` file. With that in place, setting up the post-receive hook is done as follows:
{% highlight bash %}
laptop$ ssh deployer@myserver.com
laptop$ ssh deployer@example.com
server$ mkdir myrepo.git
server$ cd myrepo.git
server$ git --bare init
@ -63,7 +63,7 @@ Finally, run the following command on any users laptop that needs to be able to
deploy using this hook:
{% highlight bash %}
laptops$ git remote add deploy deployer@myserver.com:~/myrepo.git
laptops$ git remote add deploy deployer@example.com:~/myrepo.git
{% endhighlight %}
Deploying is now as easy as telling nginx or Apache to look at
@ -76,7 +76,7 @@ laptops$ git push deploy master
### Rake
Another way to deploy your Jekyll site is to use [Rake](https://github.com/jimweirich/rake), [HighLine](https://github.com/JEG2/highline), and
[Net::SSH](http://net-ssh.rubyforge.org/). A more complex example of deploying Jekyll with Rake that deals with multiple branches can be found in [Git Ready](https://github.com/gitready/gitready/blob/en/Rakefile).
[Net::SSH](http://net-ssh.rubyforge.org/). A more complex example of deploying Jekyll with Rake that deals with multiple branches can be found in [Git Ready](https://github.com/gitready/gitready/blob/cdfbc4ec5321ff8d18c3ce936e9c749dbbc4f190/Rakefile).
### rsync

View File

@ -1,6 +1,8 @@
---
layout: docs
title: Working with drafts
prev_section: posts
next_section: pages
permalink: /docs/drafts/
---
@ -15,6 +17,5 @@ first draft:
{% endhighlight %}
To preview your site with drafts, simply run `jekyll serve` or `jekyll build` with
the `--drafts` switch. Each will be assigned the value of `Time.now`
for its date, and thus you will see them generated as the latest posts.
the `--drafts` switch. Each will be assigned the value modification time of the draft file
for its date, and thus you will see currently edited drafts as the latest posts.

View File

@ -5,6 +5,113 @@ permalink: /docs/history/
prev_section: contributing
---
## 1.3.1 / 2013-11/26
### Minor Enhancements
- Add a `--prefix` option to passthrough for the importers ([#1669]({{ site.repository }}/issues/1669))
- Push the paginator plugin lower in the plugin priority order so
other plugins run before it ([#1759]({{ site.repository }}/issues/1759))
### Bug Fixes
- Fix the include tag when ran in a loop ([#1726]({{ site.repository }}/issues/1726))
- Fix errors when using `--watch` on 1.8.7 ([#1730]({{ site.repository }}/issues/1730))
- Specify where the include is called from if an included file is
missing ([#1746]({{ site.repository }}/issues/1746))
### Development Fixes
- Extract `Site#filter_entries` into its own object ([#1697]({{ site.repository }}/issues/1697))
- Enable Travis' bundle caching ([#1734]({{ site.repository }}/issues/1734))
- Remove trailing whitespace in some files ([#1736]({{ site.repository }}/issues/1736))
- Fix a duplicate test name ([#1754]({{ site.repository }}/issues/1754))
### Site Enhancements
- Update link to example Rakefile to point to specific commit ([#1741]({{ site.repository }}/issues/1741))
- Fix drafts docs to indicate that draft time is based on file modification
time, not `Time.now` ([#1695]({{ site.repository }}/issues/1695))
- Add `jekyll-monthly-archive-plugin` and `jekyll-category-archive-plugin` to
list of third-party plugins ([#1693]({{ site.repository }}/issues/1693))
- Add `jekyll-asset-path-plugin` to list of third-party plugins ([#1670]({{ site.repository }}/issues/1670))
- Add `emoji-for-jekyll` to list of third-part plugins ([#1708]({{ site.repository }}/issues/1708))
- Fix previous section link on plugins page to point to pagination page ([#1707]({{ site.repository }}/issues/1707))
- Add `org-mode` converter plugin to third-party plugins ([#1711]({{ site.repository }}/issues/1711))
- Point "Blog migrations" page to http://import.jekyllrb.com ([#1732]({{ site.repository }}/issues/1732))
- Add docs for `post_url` when posts are in subdirectories ([#1718]({{ site.repository }}/issues/1718))
- Update the docs to point to `example.com` ([#1448]({{ site.repository }}/issues/1448))
## 1.3.0 / 2013-11-04
### Major Enhancements
- Add support for adding data as YAML files under a site's `_data`
directory ([#1003]({{ site.repository }}/issues/1003))
- Allow variables to be used with `include` tags ([#1495]({{ site.repository }}/issues/1495))
- Allow using gems for plugin management ([#1557]({{ site.repository }}/issues/1557))
### Minor Enhancements
- Decrease the specificity in the site template CSS ([#1574]({{ site.repository }}/issues/1574))
- Add `encoding` configuration option ([#1449]({{ site.repository }}/issues/1449))
- Provide better error handling for Jekyll's custom Liquid tags
([#1514]({{ site.repository }}/issues/1514))
- If an included file causes a Liquid error, add the path to the
include file that caused the error to the error message ([#1596]({{ site.repository }}/issues/1596))
- If a layout causes a Liquid error, change the error message so that
we know it comes from the layout ([#1601]({{ site.repository }}/issues/1601))
- Update Kramdown dependency to `~> 1.2` ([#1610]({{ site.repository }}/issues/1610))
- Update `safe_yaml` dependency to `~> 0.9.7` ([#1602]({{ site.repository }}/issues/1602))
- Allow layouts to be in subfolders like includes ([#1622]({{ site.repository }}/issues/1622))
- Switch to listen for site watching while serving ([#1589]({{ site.repository }}/issues/1589))
- Add a `json` liquid filter to be used in sites ([#1651]({{ site.repository }}/issues/1651))
- Point people to the migration docs when the `jekyll-import` gem is
missing ([#1662]({{ site.repository }}/issues/1662))
### Bug Fixes
- Fix up matching against source and destination when the two
locations are similar ([#1556]({{ site.repository }}/issues/1556))
- Fix the missing `pathname` require in certain cases ([#1255]({{ site.repository }}/issues/1255))
- Use `+` instead of `Array#concat` when building `Post` attribute list ([#1571]({{ site.repository }}/issues/1571))
- Print server address when launching a server ([#1586]({{ site.repository }}/issues/1586))
- Downgrade to Maruku `~> 0.6.0` in order to avoid changes in rendering ([#1598]({{ site.repository }}/issues/1598))
- Fix error with failing include tag when variable was file name ([#1613]({{ site.repository }}/issues/1613))
- Downcase lexers before passing them to pygments ([#1615]({{ site.repository }}/issues/1615))
- Capitalize the short verbose switch because it conflicts with the
built-in Commander switch ([#1660]({{ site.repository }}/issues/1660))
- Fix compatibility with 1.8.x ([#1665]({{ site.repository }}/issues/1665))
- Fix an error with the new file watching code due to library version
incompatibilities ([#1687]({{ site.repository }}/issues/1687))
### Development Fixes
- Add coverage reporting with Coveralls ([#1539]({{ site.repository }}/issues/1539))
- Refactor the Liquid `include` tag ([#1490]({{ site.repository }}/issues/1490))
- Update launchy dependency to `~> 2.3` ([#1608]({{ site.repository }}/issues/1608))
- Update rr dependency to `~> 1.1` ([#1604]({{ site.repository }}/issues/1604))
- Update cucumber dependency to `~> 1.3` ([#1607]({{ site.repository }}/issues/1607))
- Update coveralls dependency to `~> 0.7.0` ([#1606]({{ site.repository }}/issues/1606))
- Update rake dependency to `~> 10.1` ([#1603]({{ site.repository }}/issues/1603))
- Clean up `site.rb` comments to be more concise/uniform ([#1616]({{ site.repository }}/issues/1616))
- Use the master branch for the build badge in the readme ([#1636]({{ site.repository }}/issues/1636))
- Refactor Site#render ([#1638]({{ site.repository }}/issues/1638))
- Remove duplication in command line options ([#1637]({{ site.repository }}/issues/1637))
- Add tests for all the coderay options ([#1543]({{ site.repository }}/issues/1543))
- Improve some of the cucumber test code ([#1493]({{ site.repository }}/issues/1493))
- Improve comparisons of timestamps by ignoring the seconds ([#1582]({{ site.repository }}/issues/1582))
### Site Enhancements
- Fix params for `JekyllImport::WordPress.process` arguments ([#1554]({{ site.repository }}/issues/1554))
- Add `jekyll-suggested-tweet` to list of third-party plugins ([#1555]({{ site.repository }}/issues/1555))
- Link to Liquid's docs for tags and filters ([#1553]({{ site.repository }}/issues/1553))
- Add note about installing Xcode on the Mac in the Installation docs ([#1561]({{ site.repository }}/issues/1561))
- Simplify/generalize pagination docs ([#1577]({{ site.repository }}/issues/1577))
- Add documentation for the new data sources feature ([#1503]({{ site.repository }}/issues/1503))
- Add more information on how to create generators ([#1590]({{ site.repository }}/issues/1590), [#1592]({{ site.repository }}/issues/1592))
- Improve the instructions for mimicking GitHub Flavored Markdown
([#1614]({{ site.repository }}/issues/1614))
- Add `jekyll-import` warning note of missing dependencies ([#1626]({{ site.repository }}/issues/1626))
- Fix grammar in the Usage section ([#1635]({{ site.repository }}/issues/1635))
- Add documentation for the use of gems as plugins ([#1656]({{ site.repository }}/issues/1656))
- Document the existence of a few additional plugins ([#1405]({{ site.repository }}/issues/1405))
- Document that the `date_to_string` always returns a two digit day ([#1663]({{ site.repository }}/issues/1663))
- Fix navigation in the "Working with Drafts" page ([#1667]({{ site.repository }}/issues/1667))
- Fix an error with the data documentation ([#1691]({{ site.repository }}/issues/1691))
## 1.2.1 / 2013-09-14
### Minor Enhancements

View File

@ -7,251 +7,5 @@ permalink: /docs/migrations/
---
If youre switching to Jekyll from another blogging system, Jekylls importers
can help you with the move. Most methods listed on this page require read access
to the database from your old system to generate posts for Jekyll. Each method
generates `.markdown` posts in the `_posts` directory based on the entries in
the foreign system.
## Preparing for migrations
Because the importers have many of their own dependencies, they are made
available via a separate gem called
[`jekyll-import`](https://github.com/jekyll/jekyll-import). To use them, all
you need to do is install the gem, and they will become available as part of
Jekyll's standard command line interface.
{% highlight bash %}
$ gem install jekyll-import --pre
{% endhighlight %}
<div class="note warning">
<h5>Jekyll-import requires you to manually install some dependencies.</h5>
<p markdown="1">If you are importing your blog from Drupal 6,7, Joomla,
Mephisto, Movable Type, Textpattern, or Typo (with mysql db), you need to install
`mysql` and `sequel` gems. If you are importing from a WordPress database, you
need to install `mysql2` and `sequel` gems, and if you are importing from Enki
or Typo (with postgresql db) you need to install `pg` and `sequel` gems.</p>
</div>
You should now be all set to run the importers below. If you ever get stuck, you
can see help for each importer:
{% highlight bash %}
$ jekyll help import # => See list of importers
$ jekyll help import IMPORTER # => See importer specific help
{% endhighlight %}
Where IMPORTER is the name of the specific importer.
<div class="note info">
<h5>Note: Always double-check migrated content</h5>
<p>
Importers may not distinguish between published or private posts, so
you should always check that the content Jekyll generates for you appears as
you intended.
</p>
</div>
<!-- TODO all these need to be fixed -->
## WordPress
### WordPress export files
If hpricot is not already installed, you will need to run `gem install hpricot`.
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:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/wordpressdotcom";
JekyllImport::WordpressDotCom.process({ :source => "wordpress.xml" })'
{% endhighlight %}
<div class="note">
<h5>ProTip™: WordPress.com Export Tool</h5>
<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>
### Using WordPress MySQL server connection
If you want to import using a direct connection to the WordPress MySQL server,
here's how:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/wordpress";
JekyllImport::WordPress.process({:dbname => "database", :user => "user", :pass => "pass"})'
{% endhighlight %}
If you are using Webfaction and have to set up an [SSH
tunnel](http://docs.webfaction.com/user-guide/databases.html?highlight=mysql#starting-an-ssh-tunnel-with-ssh),
be sure to make the hostname (`127.0.0.1`) explicit, otherwise MySQL may block
your access based on `localhost` and `127.0.0.1` not being equivalent in its
authentication system:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/wordpress";
JekyllImport::WordPress.process({:host => "127.0.0.1", :dbname => "database", :user => "user", :pass => "pass"})'
{% endhighlight %}
### Further WordPress migration alternatives
While the above methods work, they do not import much of the metadata that is
usually stored in WordPress posts and pages. If you need to export things like
pages, tags, custom fields, image attachments and so on, the following resources
might be useful to you:
- [Exitwp](https://github.com/thomasf/exitwp) is a configurable tool written in
Python for migrating one or more WordPress blogs into Jekyll (Markdown) format
while keeping as much metadata as possible. Exitwp also downloads attachments
and pages.
- [A great
article](http://vitobotta.com/how-to-migrate-from-wordpress-to-jekyll/) with a
step-by-step guide for migrating a WordPress blog to Jekyll while keeping most
of the structure and metadata.
- [wpXml2Jekyll](https://github.com/theaob/wpXml2Jekyll) is an executable
windows application for creating Markdown posts from your WordPress XML file.
## Drupal
If youre migrating from [Drupal](http://drupal.org), there are two migrators
for you, depending upon your Drupal version:
- [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 %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/drupal6";
JekyllImport::Drupal6.process("dbname", "user", "pass")'
# ... or ...
$ ruby -rubygems -e 'require "jekyll/jekyll-import/drupal7";
JekyllImport::Drupal7.process("dbname", "user", "pass")'
{% endhighlight %}
If you are connecting to a different host or need to specify a table prefix for
your database, you may optionally add those two parameters to the end of either
Drupal migrator execution:
{% highlight bash %}
$ 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
To import posts from Movable Type:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/mt";
JekyllImport::MT.process("database", "user", "pass")'
{% endhighlight %}
## Typo
To import posts from Typo:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/typo";
JekyllImport::Typo.process("database", "user", "pass")'
{% endhighlight %}
This code has only been tested with Typo version 4+.
## TextPattern
To import posts from TextPattern:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/textpattern";
JekyllImport::TextPattern.process("database_name", "username", "password", "hostname")'
{% endhighlight %}
You will need to run the above from the parent directory of your `_import`
folder. For example, if `_import` is located in `/path/source/_import`, you will
need to run this code from `/path/source`. The hostname defaults to `localhost`,
all other variables are required. You may need to adjust the code used to filter
entries. Left alone, it will attempt to pull all entries that are live or
sticky.
## Mephisto
To import posts from Mephisto:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/mephisto";
JekyllImport::Mephisto.process("database", "user", "password")'
{% endhighlight %}
If your data is in Postgres, you should do this instead:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/mephisto";
JekyllImport::Mephisto.postgres({:database => "database", :username=>"username", :password =>"password"})'
{% endhighlight %}
## Blogger (Blogspot)
To import posts from Blogger, see [this post about migrating from Blogger to
Jekyll](http://blog.coolaj86.com/articles/migrate-from-blogger-to-jekyll.html). If
that doesnt work for you, you might want to try some of the following
alternatives:
- [@kennym](https://github.com/kennym) created a [little migration
script](https://gist.github.com/1115810), because the solutions in the
previous article didn't work out for him.
- [@ngauthier](https://github.com/ngauthier) created [another
importer](https://gist.github.com/1506614) that imports comments, and does so
via bloggers archive instead of the RSS feed.
- [@juniorz](https://github.com/juniorz) created [yet another
importer](https://gist.github.com/1564581) that works for
[Octopress](http://octopress.org). It is like [@ngauthiers
version](https://gist.github.com/1506614) but separates drafts from posts, as
well as importing tags and permalinks.
## Posterous
To import posts from your primary Posterous blog:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/posterous";
JekyllImport::Posterous.process("my_email", "my_pass")'
{% endhighlight %}
For any other Posterous blog on your account, you will need to specify the
`blog_id` for the blog:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/posterous";
JekyllImport::Posterous.process("my_email", "my_pass", "blog_id")'
{% endhighlight %}
There is also an [alternative Posterous
migrator](https://github.com/pepijndevos/jekyll/blob/patch-1/lib/jekyll/migrators/posterous.rb)
that maintains permalinks and attempts to import images too.
## Tumblr
To import posts from Tumblr:
{% highlight bash %}
$ ruby -rubygems -e 'require "jekyll/jekyll-import/tumblr";
JekyllImport::Tumblr.process(url, format, grab_images, add_highlights, rewrite_urls)'
# url - String: your blog's URL
# format - String: the output file extension. Use "md" to have your content
# converted from HTML to Markdown. Defaults to "html".
# grab_images - Boolean: whether to download images as well. Defaults to false.
# add_highlights - Boolean: whether to wrap code blocks (indented 4 spaces) in a Liquid
"highlight" tag. Defaults to false.
# rewrite_urls - Boolean: whether to write pages that redirect from the old Tumblr paths
to the new Jekyll paths. Defaults to false.
{% endhighlight %}
## Other Systems
If you have a system for which there is currently no migrator, consider writing
one and sending us [a pull request](https://github.com/jekyll/jekyll-import).
can help you with the move. To learn more about importing your site to Jekyll,
visit our [`jekyll-import` docs site](http://import.jekyllrb.com).

View File

@ -1,7 +1,7 @@
---
layout: docs
title: Creating pages
prev_section: posts
prev_section: drafts
next_section: variables
permalink: /docs/pages/
---
@ -53,9 +53,9 @@ and associated URLs might look like:
|-- _layouts/
|-- _posts/
|-- _site/
|-- about.html # => http://yoursite.com/about.html
|-- index.html # => http://yoursite.com/
└── contact.html # => http://yoursite.com/contact.html
|-- about.html # => http://example.com/about.html
|-- index.html # => http://example.com/
└── contact.html # => http://example.com/contact.html
{% endhighlight %}
### Named folders containing index HTML files
@ -76,10 +76,10 @@ look like:
├── _posts/
├── _site/
├── about/
| └── index.html # => http://yoursite.com/about/
| └── index.html # => http://example.com/about/
├── contact/
| └── index.html # => http://yoursite.com/contact/
└── index.html # => http://yoursite.com/
| └── index.html # => http://example.com/contact/
└── index.html # => http://example.com/
{% endhighlight %}
This approach may not suit everyone, but for people who like clean URLs its

View File

@ -1,7 +1,7 @@
---
layout: docs
title: Plugins
prev_section: assets
prev_section: pagination
next_section: extras
permalink: /docs/plugins/
---
@ -25,9 +25,27 @@ having to modify the Jekyll source itself.
## Installing a plugin
In your site source root, make a `_plugins` directory. Place your plugins here.
Any file ending in `*.rb` inside this directory will be loaded before Jekyll
generates your site.
You have 2 options for installing plugins:
1. In your site source root, make a `_plugins` directory. Place your plugins here.
Any file ending in `*.rb` inside this directory will be loaded before Jekyll
generates your site.
2. In your `_config.yml` file, add a new array with the key `gems` and the values
of the gem names of the plugins you'd like to use. An example:
gems: [jekyll-test-plugin, jekyll-jsonify, jekyll-assets]
# This will require each of these gems automatically.
<div class="note info">
<h5>
<code>_plugins</code> and <code>gems</code>
can be used simultaneously
</h5>
<p>
You may use both of the aforementioned plugin options simultaneously in the
same site if you so choose. Use of one does not restrict the use of the other
</p>
</div>
In general, plugins you make will fall into one of three categories:
@ -401,6 +419,9 @@ You can find a few useful plugins at the following locations:
- [Pageless Redirect Generator by Nick Quinlan](https://github.com/nquinlan/jekyll-pageless-redirects): Generates redirects based on files in the Jekyll root, with support for htaccess style redirects.
- [Projectlist by Frederic Hemberger](https://github.com/fhemberger/jekyll-projectlist): Renders files in a directory as a single page instead of separate posts.
- [RssGenerator by Assaf Gelber](https://github.com/agelber/jekyll-rss): Automatically creates an RSS 2.0 feed from your posts.
- [Monthly archive generator by Shigeya Suzuki](https://github.com/shigeya/jekyll-monthly-archive-plugin): Generator and template which renders monthly archive like MovableType style, based on the work by Ilkka Laukkanen and others above.
- [Category archive generator by Shigeya Suzuki](https://github.com/shigeya/jekyll-category-archive-plugin): Generator and template which renders category archive like MovableType style, based on Monthly archive generator.
- [Emoji for Jekyll](https://github.com/yihangho/emoji-for-jekyll): Seamlessly enable emoji for all posts and pages.
#### Converters
@ -419,6 +440,7 @@ You can find a few useful plugins at the following locations:
- [Jekyll-pandoc-multiple-formats](https://github.com/fauno/jekyll-pandoc-multiple-formats) by [edsl](https://github.com/edsl): Use pandoc to generate your site in multiple formats. Supports pandocs markdown extensions.
- [ReStructuredText Converter](https://github.com/xdissent/jekyll-rst): Converts ReST documents to HTML with Pygments syntax highlighting.
- [Transform Layouts](https://gist.github.com/1472645): Allows HAML layouts (you need a HAML Converter plugin for this to work).
- [Org-mode Converter](https://gist.github.com/abhiyerra/7377603): Org-mode converter for Jekyll.
#### Filters
@ -437,6 +459,7 @@ You can find a few useful plugins at the following locations:
#### Tags
- [Asset Path Tag](https://github.com/samrayner/jekyll-asset-path-plugin) by [Sam Rayner](http://www.samrayner.com/): Allows organisation of assets into subdirectories by outputting a path for a given file relative to the current post or page.
- [Delicious Plugin by Christian Hellsten](https://github.com/christianhellsten/jekyll-plugins): Fetches and renders bookmarks from delicious.com.
- [Ultraviolet Plugin by Steve Alex](https://gist.github.com/480380): Jekyll tag for the [Ultraviolet](http://ultraviolet.rubyforge.org/) code highligher.
- [Tag Cloud Plugin by Ilkka Laukkanen](https://gist.github.com/710577): Generate a tag cloud that links to tag pages.
@ -469,6 +492,9 @@ You can find a few useful plugins at the following locations:
- [Ditaa Tag](https://github.com/matze/jekyll-ditaa) by [matze](https://github.com/matze): Renders ASCII diagram art into PNG images and inserts a figure tag.
- [Good Include](https://github.com/penibelst/jekyll-good-include) by [Anatol Broder](http://penibelst.de/): Strips newlines and whitespaces from the end of include files before processing.
- [Jekyll Suggested Tweet](https://github.com/davidensinger/jekyll-suggested-tweet) by [David Ensinger](https://github.com/davidensinger/): A Liquid tag for Jekyll that allows for the embedding of suggested tweets via Twitters Web Intents API.
- [Jekyll Date Chart](https://github.com/GSI/jekyll_date_chart) by [GSI](https://github.com/GSI): Block that renders date line charts based on textile-formatted tables.
- [Jekyll Image Encode](https://github.com/GSI/jekyll_image_encode) by [GSI](https://github.com/GSI): Tag that renders base64 codes of images fetched from the web.
- [Jekyll Quick Man](https://github.com/GSI/jekyll_quick_man) by [GSI](https://github.com/GSI): Tag that renders pretty links to man page sources on the internet.
#### Collections

View File

@ -2,7 +2,7 @@
layout: docs
title: Writing posts
prev_section: frontmatter
next_section: pages
next_section: drafts
permalink: /docs/posts/
---

View File

@ -33,7 +33,7 @@ common tasks easier.
<code class='filter'>{% raw %}{{ site.time | date_to_xmlschema }}{% endraw %}</code>
</p>
<p>
<code class='output'>2008-11-17T13:07:54-08:00</code>
<code class='output'>2008-11-07T13:07:54-08:00</code>
</p>
</td>
</tr>
@ -47,7 +47,7 @@ common tasks easier.
<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>
<code class='output'>Mon, 07 Nov 2008 13:07:54 -0800</code>
</p>
</td>
</tr>
@ -61,7 +61,7 @@ common tasks easier.
<code class='filter'>{% raw %}{{ site.time | date_to_string }}{% endraw %}</code>
</p>
<p>
<code class='output'>17 Nov 2008</code>
<code class='output'>07 Nov 2008</code>
</p>
</td>
</tr>
@ -75,7 +75,7 @@ common tasks easier.
<code class='filter'>{% raw %}{{ site.time | date_to_long_string }}{% endraw %}</code>
</p>
<p>
<code class='output'>17 November 2008</code>
<code class='output'>07 November 2008</code>
</p>
</td>
</tr>
@ -173,6 +173,17 @@ common tasks easier.
</p>
</td>
</tr>
<tr>
<td>
<p class='name'><strong>Data To JSON</strong></p>
<p>Convert Hash or Array to JSON.</p>
</td>
<td class='align-center'>
<p>
<code class='filter'>{% raw %}{{ site.data.projects | jsonify }}{% endraw %}</code>
</p>
</td>
</tr>
</tbody>
</table>
</div>
@ -279,6 +290,15 @@ will generate the correct permalink URL for the post you specify.
{% endraw %}
{% endhighlight %}
If you organize your posts in subdirectories, you need to include subdirectory
path to the post:
{% highlight text %}
{% raw %}
{% post_url /subdir/2010-07-21-name-of-post %}
{% endraw %}
{% endhighlight %}
There is no need to include the file extension when using the `post_url` tag.
You can also use this tag to create a link to a post in Markdown as follows:

View File

@ -42,7 +42,7 @@ rebuild each time a file changes, just add the `--watch` flag at the end.
### Absolute Permalinks
In Jekyll v1.0, we introduced absolute permalinks for pages in subdirectories.
Until v1.1, it is **opt-in**. Starting with v1.1, however, absolute permalinks
Until v2.0, it is **opt-in**. Starting with v2.0, however, absolute permalinks
will become **opt-out**, meaning Jekyll will default to using absolute permalinks
instead of relative permalinks.
@ -50,9 +50,9 @@ instead of relative permalinks.
* To continue using relative permalinks, set `relative_permalinks: true` in your configuration file.
<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 v2.0 and on</h5>
<p markdown="1">
Starting with Jekyll v1.1.0, `relative_permalinks` will default to `false`,
Starting with Jekyll v2.0, `relative_permalinks` will default to `false`,
meaning all pages will be built using the absolute permalink behaviour.
The switch will still exist until v2.0.
</p>

View File

@ -40,7 +40,7 @@ $ jekyll serve --watch
# => Same as `jekyll serve`, but watch for changes and regenerate automatically.
{% endhighlight %}
This is just a few of the available [configuration options](../configuration/).
These are just a few of the available [configuration options](../configuration/).
Many configuration options can either be specified as flags on the command line,
or alternatively (and more commonly) they can be specified in a `_config.yml`
file at the root of the source directory. Jekyll will automatically use the

View File

@ -0,0 +1,2 @@
baseurl = "/you-beautiful-blog-you"
title = "My magnificent site, wut"

View File

@ -30,7 +30,7 @@ class TestConfiguration < Test::Unit::TestCase
@config = Configuration[{"source" => source_dir}]
@no_override = {}
@one_config_file = {"config" => "config.yml"}
@multiple_files = {"config" => %w[config/site.yml config/deploy.yml configuration.yml]}
@multiple_files = {"config" => %w[config/site.yml config/deploy.toml configuration.yml]}
end
should "always return an array" do
@ -45,7 +45,7 @@ class TestConfiguration < Test::Unit::TestCase
assert_equal %w[config.yml], @config.config_files(@one_config_file)
end
should "return an array of the config files if given many config files" do
assert_equal %w[config/site.yml config/deploy.yml configuration.yml], @config.config_files(@multiple_files)
assert_equal %w[config/site.yml config/deploy.toml configuration.yml], @config.config_files(@multiple_files)
end
end
context "#backwards_compatibilize" do
@ -131,6 +131,7 @@ class TestConfiguration < Test::Unit::TestCase
@paths = {
:default => File.join(Dir.pwd, '_config.yml'),
:other => File.join(Dir.pwd, '_config.live.yml'),
:toml => source_dir('_config.dev.toml'),
:empty => ""
}
end
@ -153,12 +154,20 @@ class TestConfiguration < Test::Unit::TestCase
assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] })
end
should "successfully load a TOML file" do
Jekyll.logger.log_level = Jekyll::Stevenson::WARN
assert_equal Jekyll::Configuration::DEFAULTS.merge({ "baseurl" => "/you-beautiful-blog-you", "title" => "My magnificent site, wut" }), Jekyll.configuration({ "config" => [@paths[:toml]] })
Jekyll.logger.log_level = Jekyll::Stevenson::INFO
end
should "load multiple config files" do
mock(YAML).safe_load_file(@paths[:default]) { Hash.new }
mock(YAML).safe_load_file(@paths[:other]) { Hash.new }
mock(TOML).load_file(@paths[:toml]) { Hash.new }
mock($stdout).puts("Configuration file: #{@paths[:default]}")
mock($stdout).puts("Configuration file: #{@paths[:other]}")
assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => [@paths[:default], @paths[:other]] })
mock($stdout).puts("Configuration file: #{@paths[:toml]}")
assert_equal Jekyll::Configuration::DEFAULTS, Jekyll.configuration({ "config" => [@paths[:default], @paths[:other], @paths[:toml]] })
end
should "load multiple config files and last config should win" do

74
test/test_entry_filter.rb Normal file
View File

@ -0,0 +1,74 @@
require 'helper'
class TestEntryFilter < Test::Unit::TestCase
context "Filtering entries" 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 "filter entries" do
ent1 = %w[foo.markdown bar.markdown baz.markdown #baz.markdown#
.baz.markdow foo.markdown~ .htaccess _posts _pages]
entries = EntryFilter.new(@site).filter(ent1)
assert_equal %w[foo.markdown bar.markdown baz.markdown .htaccess], entries
end
should "filter entries with exclude" do
excludes = %w[README TODO]
files = %w[index.html site.css .htaccess]
@site.exclude = excludes + ["exclude*"]
assert_equal files, @site.filter_entries(excludes + files + ["excludeA"])
end
should "not filter entries within include" do
includes = %w[_index.html .htaccess include*]
files = %w[index.html _index.html .htaccess includeA]
@site.include = includes
assert_equal files, @site.filter_entries(files)
end
should "filter symlink entries when safe mode enabled" do
stub(Jekyll).configuration do
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true})
end
site = Site.new(Jekyll.configuration)
stub(File).symlink?('symlink.js') {true}
files = %w[symlink.js]
assert_equal [], site.filter_entries(files)
end
should "not filter symlink entries when safe mode disabled" do
stub(File).symlink?('symlink.js') {true}
files = %w[symlink.js]
assert_equal files, @site.filter_entries(files)
end
should "not include symlinks in safe mode" do
stub(Jekyll).configuration do
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true})
end
site = Site.new(Jekyll.configuration)
site.read_directories("symlink-test")
assert_equal [], site.pages
assert_equal [], site.static_files
end
should "include symlinks in unsafe mode" do
stub(Jekyll).configuration do
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => false})
end
site = Site.new(Jekyll.configuration)
site.read_directories("symlink-test")
assert_not_equal [], site.pages
assert_not_equal [], site.static_files
end
end
end

View File

@ -98,5 +98,16 @@ class TestFilters < Test::Unit::TestCase
should "escape space as %20" do
assert_equal "my%20things", @filter.uri_escape("my things")
end
context "jsonify filter" do
should "convert hash to json" do
assert_equal "{\"age\":18}", @filter.jsonify({:age => 18})
end
should "convert array to json" do
assert_equal "[1,2]", @filter.jsonify([1, 2])
assert_equal "[{\"name\":\"Jack\"},{\"name\":\"Smith\"}]", @filter.jsonify([{:name => 'Jack'}, {:name => 'Smith'}])
end
end
end
end

View File

@ -12,24 +12,51 @@ class TestKramdown < Test::Unit::TestCase
'footnote_nr' => 1,
'entity_output' => 'as_char',
'toc_levels' => '1..6',
'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo'
'smart_quotes' => 'lsquo,rsquo,ldquo,rdquo',
'use_coderay' => true,
'coderay_bold_every'=> 12,
'coderay' => {
'coderay_css' => :style,
'coderay_bold_every' => 8
}
}
}
@config = Jekyll.configuration(@config)
@markdown = Converters::Markdown.new(@config)
end
# http://kramdown.rubyforge.org/converter/html.html#options
should "pass kramdown options" do
markdown = Converters::Markdown.new(@config)
assert_equal "<h1>Some Header</h1>", markdown.convert('# Some Header #').strip
assert_equal "<h1>Some Header</h1>", @markdown.convert('# Some Header #').strip
end
should "convert quotes to smart quotes" do
markdown = Converters::Markdown.new(@config)
assert_match /<p>(&#8220;|“)Pit(&#8217;|)hy(&#8221;|”)<\/p>/, markdown.convert(%{"Pit'hy"}).strip
assert_match /<p>(&#8220;|“)Pit(&#8217;|)hy(&#8221;|”)<\/p>/, @markdown.convert(%{"Pit'hy"}).strip
override = { 'kramdown' => { 'smart_quotes' => 'lsaquo,rsaquo,laquo,raquo' } }
markdown = Converters::Markdown.new(@config.deep_merge(override))
assert_match /<p>(&#171;|«)Pit(&#8250;|)hy(&#187;|»)<\/p>/, markdown.convert(%{"Pit'hy"}).strip
end
context "moving up nested coderay options" do
setup do
@markdown.convert('some markup')
@converter_config = @markdown.instance_variable_get(:@config)['kramdown']
end
should "work correctly" do
assert_equal :style, @converter_config['coderay_css']
end
should "also work for defaults" do
default = Jekyll::Configuration::DEFAULTS['kramdown']['coderay']['coderay_tab_width']
assert_equal default, @converter_config['coderay_tab_width']
end
should "not overwrite" do
assert_equal 12, @converter_config['coderay_bold_every']
end
end
end
end

View File

@ -179,69 +179,6 @@ class TestSite < Test::Unit::TestCase
assert_equal 4, @site.categories['foo'].size
end
should "filter entries" do
ent1 = %w[foo.markdown bar.markdown baz.markdown #baz.markdown#
.baz.markdow foo.markdown~]
ent2 = %w[.htaccess _posts _pages bla.bla]
assert_equal %w[foo.markdown bar.markdown baz.markdown], @site.filter_entries(ent1)
assert_equal %w[.htaccess bla.bla], @site.filter_entries(ent2)
end
should "filter entries with exclude" do
excludes = %w[README TODO]
files = %w[index.html site.css .htaccess]
@site.exclude = excludes + ["exclude*"]
assert_equal files, @site.filter_entries(excludes + files + ["excludeA"])
end
should "not filter entries within include" do
includes = %w[_index.html .htaccess include*]
files = %w[index.html _index.html .htaccess includeA]
@site.include = includes
assert_equal files, @site.filter_entries(files)
end
should "filter symlink entries when safe mode enabled" do
stub(Jekyll).configuration do
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true})
end
site = Site.new(Jekyll.configuration)
stub(File).symlink?('symlink.js') {true}
files = %w[symlink.js]
assert_equal [], site.filter_entries(files)
end
should "not filter symlink entries when safe mode disabled" do
stub(File).symlink?('symlink.js') {true}
files = %w[symlink.js]
assert_equal files, @site.filter_entries(files)
end
should "not include symlinks in safe mode" do
stub(Jekyll).configuration do
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => true})
end
site = Site.new(Jekyll.configuration)
site.read_directories("symlink-test")
assert_equal [], site.pages
assert_equal [], site.static_files
end
should "include symlinks in unsafe mode" do
stub(Jekyll).configuration do
Jekyll::Configuration::DEFAULTS.merge({'source' => source_dir, 'destination' => dest_dir, 'safe' => false})
end
site = Site.new(Jekyll.configuration)
site.read_directories("symlink-test")
assert_not_equal [], site.pages
assert_not_equal [], site.static_files
end
context 'error handling' do
should "raise if destination is included in source" do
stub(Jekyll).configuration do

View File

@ -226,7 +226,7 @@ CONTENT
assert_no_match /markdown\-html\-error/, @result
end
should "have the url to the \"nested\" post from 2008-11-21" do
should "have the url to the \"complex\" post from 2008-11-21" do
assert_match %r{1\s/2008/11/21/complex/}, @result
assert_match %r{2\s/2008/11/21/complex/}, @result
end