diff --git a/.travis.yml b/.travis.yml index 4c50a297..b1aacd13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: ruby +cache: bundler before_install: - gem install bundler rvm: diff --git a/Gemfile b/Gemfile index d9266971..851fabc2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,2 @@ source 'https://rubygems.org' -gemspec \ No newline at end of file +gemspec diff --git a/History.markdown b/History.markdown index 5592a1d7..24d1cd5d 100644 --- a/History.markdown +++ b/History.markdown @@ -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 diff --git a/README.markdown b/README.markdown index 94080ed1..3d75f281 100644 --- a/README.markdown +++ b/README.markdown @@ -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) diff --git a/Rakefile b/Rakefile index b65b2dd2..d76ec053 100644 --- a/Rakefile +++ b/Rakefile @@ -218,7 +218,7 @@ namespace :site do abort "You seem to have misplaced your History.markdown file. I can haz?" end end - + namespace :releases do desc "Create new release post" task :new, :version do |t, args| diff --git a/bin/jekyll b/bin/jekyll index ee497c25..8f91698c 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -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) diff --git a/features/include_tag.feature b/features/include_tag.feature index 3abff4c7..587784dc 100644 --- a/features/include_tag.feature +++ b/features/include_tag.feature @@ -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" diff --git a/features/site_configuration.feature b/features/site_configuration.feature index 89324cb1..4f807eae 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -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:

content for entry1.

" in "_site/2007/12/31/entry1.html" And I should see "Post Layout:

content for entry2.

" 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" diff --git a/features/site_data.feature b/features/site_data.feature index 9ab94056..faa266b7 100644 --- a/features/site_data.feature +++ b/features/site_data.feature @@ -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 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 }}" diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 4e11aad9..7a74486b 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -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 diff --git a/features/support/env.rb b/features/support/env.rb index 5c7db508..0d207b41 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -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' diff --git a/jekyll.gemspec b/jekyll.gemspec index 35368433..c3dafc33 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -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 diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 639d8e47..31024f4b 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -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. diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index fe49b54b..bfc69aa3 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -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 diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 993ef9e0..589e7274 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -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 diff --git a/lib/jekyll/converters/markdown/kramdown_parser.rb b/lib/jekyll/converters/markdown/kramdown_parser.rb index be9e80b4..caeb5b65 100644 --- a/lib/jekyll/converters/markdown/kramdown_parser.rb +++ b/lib/jekyll/converters/markdown/kramdown_parser.rb @@ -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 diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index cedd1e62..45d8e261 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -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}" diff --git a/lib/jekyll/entry_filter.rb b/lib/jekyll/entry_filter.rb new file mode 100644 index 00000000..56f3cfc2 --- /dev/null +++ b/lib/jekyll/entry_filter.rb @@ -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 diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index b0ab8947..95ada0bd 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -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 diff --git a/lib/jekyll/generators/pagination.rb b/lib/jekyll/generators/pagination.rb index 79688ba7..72dc5292 100644 --- a/lib/jekyll/generators/pagination.rb +++ b/lib/jekyll/generators/pagination.rb @@ -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 diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 090efa7a..a625f9a9 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -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 diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb index d26ea7b4..a261e6f5 100644 --- a/lib/jekyll/tags/include.rb +++ b/lib/jekyll/tags/include.rb @@ -13,7 +13,7 @@ module Jekyll SYNTAX_EXAMPLE = "{% include file.ext param='value' param2='value' %}" - VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/ + VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/ INCLUDES_DIR = '_includes' @@ -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,20 +90,22 @@ 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 - partial.render!(context) + context.stack do + context['include'] = parse_params(context) if @params + partial.render!(context) + end + rescue => e + raise IncludeTagError.new e.message, File.join(INCLUDES_DIR, @file) end - rescue => e - raise IncludeTagError.new e.message, File.join(INCLUDES_DIR, @file) end def validate_dir(dir, safe) diff --git a/site/_includes/top.html b/site/_includes/top.html index 46ca8639..e17496ce 100644 --- a/site/_includes/top.html +++ b/site/_includes/top.html @@ -12,6 +12,6 @@ - + diff --git a/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown b/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown new file mode 100644 index 00000000..f4f4852d --- /dev/null +++ b/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown @@ -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! + + diff --git a/site/_posts/2013-11-04-jekyll-1-3-0-released.markdown b/site/_posts/2013-11-04-jekyll-1-3-0-released.markdown new file mode 100644 index 00000000..1e325117 --- /dev/null +++ b/site/_posts/2013-11-04-jekyll-1-3-0-released.markdown @@ -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/ diff --git a/site/_posts/2013-11-26-jekyll-1-3-1-released.markdown b/site/_posts/2013-11-26-jekyll-1-3-1-released.markdown new file mode 100644 index 00000000..4b4c37d5 --- /dev/null +++ b/site/_posts/2013-11-26-jekyll-1-3-1-released.markdown @@ -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 diff --git a/site/docs/configuration.md b/site/docs/configuration.md index 94236ed1..4163937e 100644 --- a/site/docs/configuration.md +++ b/site/docs/configuration.md @@ -330,6 +330,7 @@ layouts: ./_layouts include: ['.htaccess'] exclude: [] keep_files: ['.git','.svn'] +gems: [] timezone: nil encoding: nil diff --git a/site/docs/datafiles.md b/site/docs/datafiles.md index c4e9e7e9..93b50aa3 100644 --- a/site/docs/datafiles.md +++ b/site/docs/datafiles.md @@ -57,7 +57,7 @@ You can now render the list of members in a template: {{ member.name }} -{% end %} +{% endfor %} {% endraw %} {% endhighlight %} diff --git a/site/docs/deployment-methods.md b/site/docs/deployment-methods.md index 41c5472e..6922a9db 100644 --- a/site/docs/deployment-methods.md +++ b/site/docs/deployment-methods.md @@ -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 diff --git a/site/docs/drafts.md b/site/docs/drafts.md index e6455674..959964d0 100644 --- a/site/docs/drafts.md +++ b/site/docs/drafts.md @@ -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. diff --git a/site/docs/history.md b/site/docs/history.md index 1b2e7ffc..2c681aec 100644 --- a/site/docs/history.md +++ b/site/docs/history.md @@ -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 diff --git a/site/docs/migrations.md b/site/docs/migrations.md index 12290e29..27ecf71d 100644 --- a/site/docs/migrations.md +++ b/site/docs/migrations.md @@ -7,251 +7,5 @@ permalink: /docs/migrations/ --- If you’re switching to Jekyll from another blogging system, Jekyll’s 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 %} - -
-
Jekyll-import requires you to manually install some dependencies.
-

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.

-
- -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. - -
-
Note: Always double-check migrated content
-

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

-
- - - -## 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 %} - -
-
ProTip™: WordPress.com Export Tool
-

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`.

-
- -### 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 you’re 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 doesn’t 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 blogger’s 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 [@ngauthier’s - 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). diff --git a/site/docs/pages.md b/site/docs/pages.md index 50388522..e7b837fa 100644 --- a/site/docs/pages.md +++ b/site/docs/pages.md @@ -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 it’s diff --git a/site/docs/plugins.md b/site/docs/plugins.md index a61d903e..eb6392f4 100644 --- a/site/docs/plugins.md +++ b/site/docs/plugins.md @@ -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. + +
+
+ _plugins and gems + can be used simultaneously +
+

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

+
In general, plugins you make will fall into one of three categories: @@ -67,7 +85,7 @@ module Reading class Generator < Jekyll::Generator def generate(site) ongoing, done = Book.all.partition(&:ongoing?) - + reading = site.pages.detect {|page| page.name == 'reading.html'} reading.data['ongoing'] = ongoing reading.data['done'] = done @@ -394,13 +412,16 @@ You can find a few useful plugins at the following locations: - [ArchiveGenerator by Ilkka Laukkanen](https://gist.github.com/707909): Uses [this archive page](https://gist.github.com/707020) to generate archives. - [LESS.js Generator by Andy Fowler](https://gist.github.com/642739): Renders LESS.js files during generation. -- [Version Reporter by Blake Smith](https://gist.github.com/449491): Creates a version.html file containing the Jekyll version. +- [Version Reporter by Blake Smith](https://gist.github.com/449491): Creates a version.html file containing the Jekyll version. - [Sitemap.xml Generator by Michael Levin](https://github.com/kinnetica/jekyll-plugins): Generates a sitemap.xml file by traversing all of the available posts and pages. - [Full-text search by Pascal Widdershoven](https://github.com/PascalW/jekyll_indextank): Adds full-text search to your Jekyll site with a plugin and a bit of JavaScript. - [AliasGenerator by Thomas Mango](https://github.com/tsmango/jekyll_alias_generator): Generates redirect pages for posts when an alias is specified in the YAML Front Matter. - [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 pandoc’s 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 Twitter’s 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 diff --git a/site/docs/posts.md b/site/docs/posts.md index 3c57c217..88036bdb 100644 --- a/site/docs/posts.md +++ b/site/docs/posts.md @@ -2,7 +2,7 @@ layout: docs title: Writing posts prev_section: frontmatter -next_section: pages +next_section: drafts permalink: /docs/posts/ --- diff --git a/site/docs/templates.md b/site/docs/templates.md index 8ecff675..7cf2a865 100644 --- a/site/docs/templates.md +++ b/site/docs/templates.md @@ -33,7 +33,7 @@ common tasks easier. {% raw %}{{ site.time | date_to_xmlschema }}{% endraw %}

- 2008-11-17T13:07:54-08:00 + 2008-11-07T13:07:54-08:00

@@ -47,7 +47,7 @@ common tasks easier. {% raw %}{{ site.time | date_to_rfc822 }}{% endraw %}

- Mon, 17 Nov 2008 13:07:54 -0800 + Mon, 07 Nov 2008 13:07:54 -0800

@@ -61,7 +61,7 @@ common tasks easier. {% raw %}{{ site.time | date_to_string }}{% endraw %}

- 17 Nov 2008 + 07 Nov 2008

@@ -75,7 +75,7 @@ common tasks easier. {% raw %}{{ site.time | date_to_long_string }}{% endraw %}

- 17 November 2008 + 07 November 2008

@@ -173,6 +173,17 @@ common tasks easier.

+ + +

Data To JSON

+

Convert Hash or Array to JSON.

+ + +

+ {% raw %}{{ site.data.projects | jsonify }}{% endraw %} +

+ + @@ -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: diff --git a/site/docs/upgrading.md b/site/docs/upgrading.md index c15218fb..3cf5a1ef 100644 --- a/site/docs/upgrading.md +++ b/site/docs/upgrading.md @@ -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.