From 4090500c5a9220e49eb0e0c77fcd843d5feaef08 Mon Sep 17 00:00:00 2001 From: Fotos Georgiadis Date: Mon, 9 Apr 2012 02:47:20 +0300 Subject: [PATCH 001/120] Added path in url. Page#dir was returning the wrong dir ('/') for pages in directories. --- lib/jekyll/page.rb | 9 +++-- test/source/contacts/bar.html | 5 +++ test/source/contacts/index.html | 5 +++ test/test_page.rb | 65 ++++++++++++++++++++++++++++++++- 4 files changed, 78 insertions(+), 6 deletions(-) create mode 100644 test/source/contacts/bar.html create mode 100644 test/source/contacts/index.html diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index 82b82048..faf340b8 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -46,9 +46,9 @@ module Jekyll # Returns the template String. def template if self.site.permalink_style == :pretty && !index? && html? - "/:basename/" + "/:path/:basename/" else - "/:basename:output_ext" + "/:path/:basename:output_ext" end end @@ -62,6 +62,7 @@ module Jekyll permalink else { + "path" => @dir, "basename" => self.basename, "output_ext" => self.output_ext, }.inject(template) { |result, token| @@ -105,7 +106,7 @@ module Jekyll # Returns the Hash representation of this Page. def to_liquid self.data.deep_merge({ - "url" => File.join(@dir, self.url), + "url" => self.url, "content" => self.content }) end @@ -117,7 +118,7 @@ module Jekyll def destination(dest) # The url needs to be unescaped in order to preserve the correct # filename. - path = File.join(dest, @dir, CGI.unescape(self.url)) + path = File.join(dest, CGI.unescape(self.url)) path = File.join(path, "index.html") if self.url =~ /\/$/ path end diff --git a/test/source/contacts/bar.html b/test/source/contacts/bar.html new file mode 100644 index 00000000..1615afe2 --- /dev/null +++ b/test/source/contacts/bar.html @@ -0,0 +1,5 @@ +--- +title: Contact Information +--- + +Contact Information diff --git a/test/source/contacts/index.html b/test/source/contacts/index.html new file mode 100644 index 00000000..1615afe2 --- /dev/null +++ b/test/source/contacts/index.html @@ -0,0 +1,5 @@ +--- +title: Contact Information +--- + +Contact Information diff --git a/test/test_page.rb b/test/test_page.rb index 61278997..6d4bef2a 100644 --- a/test/test_page.rb +++ b/test/test_page.rb @@ -1,8 +1,10 @@ require 'helper' class TestPage < Test::Unit::TestCase - def setup_page(file) - @page = Page.new(@site, source_dir, '', file) + def setup_page(*args) + dir, file = args + dir, file = ['', dir] if file.nil? + @page = Page.new(@site, source_dir, dir, file) end def do_render(page) @@ -23,6 +25,18 @@ class TestPage < Test::Unit::TestCase assert_equal "/contacts.html", @page.url end + context "in a directory hierarchy" do + should "create url based on filename" do + @page = setup_page('/contacts', 'bar.html') + assert_equal "/contacts/bar.html", @page.url + end + + should "create index url based on filename" do + @page = setup_page('/contacts', 'index.html') + assert_equal "/contacts/index.html", @page.url + end + end + should "deal properly with extensions" do @page = setup_page('deal.with.dots.html') assert_equal ".html", @page.ext @@ -47,6 +61,23 @@ class TestPage < Test::Unit::TestCase @page = setup_page('index.html') assert_equal '/', @page.dir end + + context "in a directory hierarchy" do + should "create url based on filename" do + @page = setup_page('/contacts', 'index.html') + assert_equal "/contacts/index.html", @page.url + end + + should "return dir correctly" do + @page = setup_page('/contacts', 'bar.html') + assert_equal '/contacts/bar/', @page.dir + end + + should "return dir correctly for index page" do + @page = setup_page('/contacts', 'index.html') + assert_equal '/contacts', @page.dir + end + end end context "with any other url style" do @@ -111,6 +142,36 @@ class TestPage < Test::Unit::TestCase assert File.directory?(dest_dir) assert File.exists?(File.join(dest_dir, '.htaccess')) end + + context "in a directory hierarchy" do + should "write properly the index" do + page = setup_page('/contacts', 'index.html') + do_render(page) + page.write(dest_dir) + + assert File.directory?(dest_dir) + assert File.exists?(File.join(dest_dir, 'contacts', 'index.html')) + end + + should "write properly" do + page = setup_page('/contacts', 'bar.html') + do_render(page) + page.write(dest_dir) + + assert File.directory?(dest_dir) + assert File.exists?(File.join(dest_dir, 'contacts', 'bar.html')) + end + + should "write properly without html extension" do + page = setup_page('/contacts', 'bar.html') + page.site.permalink_style = :pretty + do_render(page) + page.write(dest_dir) + + assert File.directory?(dest_dir) + assert File.exists?(File.join(dest_dir, 'contacts', 'bar', 'index.html')) + end + end end end From bab29f64f741de58681539b279eb0f72f7911983 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Fri, 12 Oct 2012 22:43:20 -0500 Subject: [PATCH 002/120] Look for plugins under the source directory When generating the site, Jekyll will now look for plugins under the source directory by default. The plugin location can still be changed in _config.yml --- lib/jekyll.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 65e16cdb..9494a2b7 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -58,7 +58,7 @@ module Jekyll 'source' => Dir.pwd, 'destination' => File.join(Dir.pwd, '_site'), - 'plugins' => File.join(Dir.pwd, '_plugins'), + 'plugins' => '_plugins', 'layouts' => '_layouts', 'future' => true, From 50b4a8c0ab53adf238b89174be543bb35f920cd6 Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Wed, 9 Jan 2013 10:29:40 +0000 Subject: [PATCH 003/120] Bump kramdown, rake, shoulda, cucumber, redcarpet --- jekyll.gemspec | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index dbbe4386..9c3911eb 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -27,20 +27,20 @@ Gem::Specification.new do |s| s.add_runtime_dependency('classifier', "~> 1.3") s.add_runtime_dependency('directory_watcher', "~> 1.1") s.add_runtime_dependency('maruku', "~> 0.5") - s.add_runtime_dependency('kramdown', "~> 0.13.4") + s.add_runtime_dependency('kramdown', "~> 0.14.1") s.add_runtime_dependency('pygments.rb', "~> 0.3.2") - s.add_development_dependency('rake', "~> 0.9") + s.add_development_dependency('rake', "~> 10.0.3") s.add_development_dependency('rdoc', "~> 3.11") s.add_development_dependency('redgreen', "~> 1.2") - s.add_development_dependency('shoulda', "~> 2.11") + s.add_development_dependency('shoulda', "~> 3.3.2") s.add_development_dependency('rr', "~> 1.0") - s.add_development_dependency('cucumber', "1.1") + s.add_development_dependency('cucumber', "~> 1.2.1") s.add_development_dependency('RedCloth', "~> 4.2") s.add_development_dependency('rdiscount', "~> 1.6") - s.add_development_dependency('redcarpet', "~> 2.1.1") + s.add_development_dependency('redcarpet', "~> 2.2.2") s.add_development_dependency('launchy', "~> 2.1.2") - + # = MANIFEST = s.files = %w[ Gemfile From 5d48c5390db39c67f52d49fc53c842343f3ead44 Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Thu, 10 Jan 2013 20:47:55 +0000 Subject: [PATCH 004/120] Add test/unit --- test/helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/test/helper.rb b/test/helper.rb index 491a41c7..0bd181bf 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,4 +1,5 @@ require 'rubygems' +require 'test/unit' gem 'RedCloth', '>= 4.2.1' require 'jekyll' From 92eb926bf8847598b97a494183bc00a291fecb0b Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 10 Jan 2013 21:24:28 -0600 Subject: [PATCH 005/120] Look for plugins under the source directory by default --- lib/jekyll/site.rb | 10 +++++++++- test/test_site.rb | 7 ++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 7dbf1336..32a21503 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -18,7 +18,7 @@ module Jekyll self.safe = config['safe'] self.source = File.expand_path(config['source']) self.dest = File.expand_path(config['destination']) - self.plugins = Array(config['plugins']).map { |d| File.expand_path(d) } + self.plugins = setup_plugins self.lsi = config['lsi'] self.pygments = config['pygments'] self.permalink_style = config['permalink'].to_sym @@ -99,6 +99,14 @@ module Jekyll end end + def setup_plugins + if (config['plugins'] == Jekyll::DEFAULTS['plugins']) + [File.join(self.source, config['plugins'])] + else + Array(config['plugins']).map { |d| File.expand_path(d) } + end + end + # Read Site data from disk and load it into internal data structures. # # Returns nothing. diff --git a/test/test_site.rb b/test/test_site.rb index 03f1886e..98a433b6 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -7,9 +7,9 @@ class TestSite < Test::Unit::TestCase assert_equal [File.join(Dir.pwd, '_plugins')], site.plugins end - should "have an array for plugins if passed as a string" do - site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => '/tmp/plugins'})) - assert_equal ['/tmp/plugins'], site.plugins + should "look for plugins under the site directory by default" do + site = Site.new(Jekyll::DEFAULTS.merge({'source' => source_dir})) + assert_equal [File.join(source_dir, '_plugins')], site.plugins end should "have an array for plugins if passed as an array" do @@ -26,6 +26,7 @@ class TestSite < Test::Unit::TestCase site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => nil})) assert_equal [], site.plugins end + end context "creating sites" do setup do From 151275d09e48afd4854edbd85d88e9b014b8b473 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Thu, 10 Jan 2013 21:53:21 -0600 Subject: [PATCH 006/120] Add TomDoc --- lib/jekyll/site.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 32a21503..01032722 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -99,6 +99,10 @@ module Jekyll end end + # Internal: Setup the plugin search path + # + # + # Returns an Array of plugin search paths def setup_plugins if (config['plugins'] == Jekyll::DEFAULTS['plugins']) [File.join(self.source, config['plugins'])] From 9b8b5b2bda405dee7184cc9a6dbdb6085298c625 Mon Sep 17 00:00:00 2001 From: Piotr Usewicz Date: Fri, 11 Jan 2013 11:02:07 +0000 Subject: [PATCH 007/120] Dont test kramdown It should have it's own tests for that --- test/test_kramdown.rb | 9 --------- 1 file changed, 9 deletions(-) diff --git a/test/test_kramdown.rb b/test/test_kramdown.rb index 043752c3..1d2f6dab 100644 --- a/test/test_kramdown.rb +++ b/test/test_kramdown.rb @@ -20,14 +20,5 @@ class TestKramdown < Test::Unit::TestCase markdown = MarkdownConverter.new(@config) assert_equal "

Some Header

", markdown.convert('# Some Header #').strip end - - should "convert quotes to smart quotes" do - markdown = MarkdownConverter.new(@config) - assert_equal "

“Pit’hy”

", markdown.convert(%{"Pit'hy"}).strip - - override = { 'kramdown' => { 'smart_quotes' => 'lsaquo,rsaquo,laquo,raquo' } } - markdown = MarkdownConverter.new(@config.deep_merge(override)) - assert_equal "

«Pit›hy»

", markdown.convert(%{"Pit'hy"}).strip - end end end From 0ad623fb85377c8554b9d3eea5d472d164d6e2ba Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 20 Jan 2013 02:20:00 +0200 Subject: [PATCH 008/120] first pass at --drafts flag --- bin/jekyll | 1 + lib/jekyll/post.rb | 6 +++--- lib/jekyll/site.rb | 34 ++++++++++++++++++++-------------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index 309ffc91..c05d5dce 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -37,6 +37,7 @@ command :serve do |c| c.option '-w', '--watch', 'Watch for changes and rebuild' c.option '--lsi', 'Use LSI for improved related posts' + c.option '--drafts', 'Render posts in the _drafts folder' c.option '-p', '--port [PORT]', 'Port to listen on' c.option '-h', '--host [HOST]', 'Host to bind to' diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 835f9a42..f94169b0 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -30,12 +30,12 @@ module Jekyll # site - The Site. # base - The String path to the dir containing the post file. # name - The String filename of the post file. - # categories - An Array of Strings for the categories for this post. + # subdir - The String path to the subdirectory. # # Returns the new Post. - def initialize(site, source, dir, name) + def initialize(site, source, dir, name, subdir = '_posts') @site = site - @base = File.join(source, dir, '_posts') + @base = File.join(source, dir, subdir) @name = name self.categories = dir.split('/').reject { |x| x.empty? } diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 462da488..636045be 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -5,7 +5,7 @@ module Jekyll class Site attr_accessor :config, :layouts, :posts, :pages, :static_files, :categories, :exclude, :include, :source, :dest, :lsi, :pygments, - :permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts, + :permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts, :show_drafts, :keep_files attr_accessor :converters, :generators @@ -26,6 +26,7 @@ module Jekyll self.exclude = config['exclude'] || [] self.include = config['include'] || [] self.future = config['future'] + self.show_drafts = config['drafts'] || nil self.limit_posts = config['limit_posts'] || nil self.keep_files = config['keep_files'] || [] @@ -136,7 +137,19 @@ module Jekyll base = File.join(self.source, dir) entries = Dir.chdir(base) { filter_entries(Dir.entries('.')) } - self.read_posts(dir) + self.read_posts(dir,'_posts') + + if self.show_drafts + self.read_posts(dir,'_drafts') + end + + self.posts.sort! + + # limit the posts if :limit_posts option is set + if limit_posts + limit = self.posts.length < limit_posts ? self.posts.length : limit_posts + self.posts = self.posts[-limit, limit] + end entries.each do |f| f_abs = File.join(base, f) @@ -160,18 +173,19 @@ module Jekyll # Read all the files in //_posts and create a new Post # object with each one. # - # dir - The String relative path of the directory to read. + # dir - The String relative path of the directory to read. + # subdir - The String relative path of the subdirectory to read. # # Returns nothing. - def read_posts(dir) - base = File.join(self.source, dir, '_posts') + def read_posts(dir, subdir) + base = File.join(self.source, dir, subdir) return unless File.exists?(base) entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } # first pass processes, but does not yet render post content entries.each do |f| if Post.valid?(f) - post = Post.new(self, self.source, dir, f) + post = Post.new(self, self.source, dir, f, subdir) if post.published && (self.future || post.date <= self.time) self.posts << post @@ -180,14 +194,6 @@ module Jekyll end end end - - self.posts.sort! - - # limit the posts if :limit_posts option is set - if limit_posts - limit = self.posts.length < limit_posts ? self.posts.length : limit_posts - self.posts = self.posts[-limit, limit] - end end # Run each of the Generators. From 2df63e5b9df8c6e28f805d6052c86bf9214a3731 Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 20 Jan 2013 03:14:11 +0200 Subject: [PATCH 009/120] fix tests --- test/test_site.rb | 2 +- test/test_tags.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_site.rb b/test/test_site.rb index c698a887..e0f90c44 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -124,7 +124,7 @@ class TestSite < Test::Unit::TestCase end should "read posts" do - @site.read_posts('') + @site.read_posts('', '_posts') posts = Dir[source_dir('_posts', '*')] assert_equal posts.size - 1, @site.posts.size end diff --git a/test/test_tags.rb b/test/test_tags.rb index 816fd809..286b1817 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -11,7 +11,7 @@ class TestTags < Test::Unit::TestCase site = Site.new(Jekyll.configuration) if override['read_posts'] - site.read_posts('') + site.read_posts('', '_posts') end info = { :filters => [Jekyll::Filters], :registers => { :site => site } } From c48de6b320b3a6d48407b82d9005b9c854d152de Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 20 Jan 2013 04:38:23 +0200 Subject: [PATCH 010/120] add drafts.feature --- bin/jekyll | 1 + features/drafts.feature | 25 +++++++++++++++++++++++ features/step_definitions/jekyll_steps.rb | 10 +++++++-- features/support/env.rb | 3 ++- 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 features/drafts.feature diff --git a/bin/jekyll b/bin/jekyll index c05d5dce..e25a16a4 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -23,6 +23,7 @@ command :build do |c| c.option '-w', '--watch', 'Watch for changes and rebuild' c.option '--lsi', 'Use LSI for improved related posts' + c.option '--drafts', 'Render posts in the _drafts folder' c.action do |args, options| options.defaults :serving => false diff --git a/features/drafts.feature b/features/drafts.feature new file mode 100644 index 00000000..d7a6eb31 --- /dev/null +++ b/features/drafts.feature @@ -0,0 +1,25 @@ +Feature: Draft Posts + As a hacker who likes to blog + I want to be able to preview drafts locally + In order to see if they look alright before publishing + + Scenario: Preview a draft + Given I have a configuration file with "permalink" set to "none" + And I have a _drafts directory + And I have the following draft: + | title | date | layout | content | + | Recipe | 3/27/2009 | default | Not baked yet. | + When I run jekyll with drafts + Then the _site directory should exist + And I should see "Not baked yet." in "_site/recipe.html" + + Scenario: Don't preview a draft + Given I have a configuration file with "permalink" set to "none" + And I have an "index.html" page that contains "Totally index" + And I have a _drafts directory + And I have the following draft: + | title | date | layout | content | + | Recipe | 3/27/2009 | default | Not baked yet. | + When I run jekyll + Then the _site directory should exist + And the "_site/recipe.html" file should not exist diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 20128964..4c1b0cc1 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -50,7 +50,9 @@ Given /^I have an? (.*) directory$/ do |dir| FileUtils.mkdir_p(dir) end -Given /^I have the following posts?(?: (.*) "(.*)")?:$/ do |direction, folder, table| +Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |type, direction, folder, table| + subdir = "_#{type}s" + table.hashes.each do |post| date = Date.strptime(post['date'], '%m/%d/%Y').strftime('%Y-%m-%d') title = post['title'].downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-') @@ -61,7 +63,7 @@ Given /^I have the following posts?(?: (.*) "(.*)")?:$/ do |direction, folder, t after = folder || '.' end - path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{post['type'] || 'textile'}") + path = File.join(before || '.', subdir, after || '.', "#{date}-#{title}.#{post['type'] || 'textile'}") matter_hash = {} %w(title layout tag tags category categories published author).each do |key| @@ -117,6 +119,10 @@ When /^I run jekyll$/ do run_jekyll end +When /^I run jekyll with drafts$/ do + run_jekyll(:drafts => true) +end + When /^I debug jekyll$/ do run_jekyll(:debug => true) end diff --git a/features/support/env.rb b/features/support/env.rb index 1ed330a1..7e550c6c 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -10,8 +10,9 @@ TEST_DIR = File.join('/', 'tmp', 'jekyll') JEKYLL_PATH = File.join(ENV['PWD'], 'bin', 'jekyll') def run_jekyll(opts = {}) - command = JEKYLL_PATH + command = JEKYLL_PATH.clone command << " build" + command << " --drafts" if opts[:drafts] command << " >> /dev/null 2>&1" if opts[:debug].nil? system command end From a7f0d04bda80475eeedc389cd35a33fb9cca3944 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Tue, 29 Jan 2013 12:16:33 +0100 Subject: [PATCH 011/120] Improve error message for malformed highlight tags --- lib/jekyll/tags/highlight.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index b36a8a01..c84ea111 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -30,7 +30,13 @@ module Jekyll end end else - raise SyntaxError.new("Syntax Error in 'highlight' - Valid syntax: highlight [linenos]") + raise SyntaxError.new <<-eos +Syntax Error in tag 'highlight' while parsing the following markup: + + #{markup} + +Valid syntax: highlight [linenos] +eos end end From 7023a5e622e934bfa05a4b7ec2341603c261dfdd Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 30 Jan 2013 21:56:54 +0100 Subject: [PATCH 012/120] Added the --future switch back to the CLI --- bin/jekyll | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/jekyll b/bin/jekyll index 0034f75e..3c9636b5 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -21,6 +21,7 @@ command :build do |c| c.syntax = 'jekyll build [options]' c.description = 'Build your site with the option of auto-renegeration' + c.option '--future', 'Publishes posts with a future date' c.option '-w', '--watch', 'Watch for changes and rebuild' c.option '--lsi', 'Use LSI for improved related posts' @@ -35,6 +36,7 @@ command :serve do |c| c.syntax = 'jekyll serve [options]' c.description = 'Serve your site locally with the option of auto-regeneration' + c.option '--future', 'Publishes posts with a future date' c.option '-w', '--watch', 'Watch for changes and rebuild' c.option '--lsi', 'Use LSI for improved related posts' From 6e8202f9a61318882e83dda8c26f31bc90e0bab4 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 30 Jan 2013 22:04:56 +0100 Subject: [PATCH 013/120] Added in --limit-posts --- bin/jekyll | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/jekyll b/bin/jekyll index 3c9636b5..66809959 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -22,6 +22,7 @@ command :build do |c| c.description = 'Build your site with the option of auto-renegeration' c.option '--future', 'Publishes posts with a future date' + c.option '--limit_posts MAX_POSTS', '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' @@ -37,6 +38,7 @@ command :serve do |c| c.description = 'Serve your site locally with the option of auto-regeneration' c.option '--future', 'Publishes posts with a future date' + c.option '--limit_posts MAX_POSTS', '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' From 62bba37c1faf2147fa205245f0f2be049ddf12b3 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 30 Jan 2013 22:19:24 +0100 Subject: [PATCH 014/120] Update history to reflect merge of #768 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 3d1f567e..3814db8e 100644 --- a/History.txt +++ b/History.txt @@ -2,6 +2,7 @@ * Major Enhancements * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Minor Enhancements + * Refactored jekyll subcommands into Jekyll::Commands submodule, which now contains them (#768) * Rescue from import errors in Wordpress.com migrator (#671) * Massively accelerate LSI performance (#664) * Truncate post slugs when importing from Tumblr (#496) From 1cfd0c8b1594832c51331f92a61d3144902f9cc9 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 30 Jan 2013 23:21:23 +0100 Subject: [PATCH 015/120] Updated history to reflect merging of #744. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 3814db8e..4103efed 100644 --- a/History.txt +++ b/History.txt @@ -2,6 +2,7 @@ * Major Enhancements * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Minor Enhancements + * Updated gem versions for Kramdown, Rake, Shoulda, Cucumber, and RedCarpet. (#744) * Refactored jekyll subcommands into Jekyll::Commands submodule, which now contains them (#768) * Rescue from import errors in Wordpress.com migrator (#671) * Massively accelerate LSI performance (#664) From 2e73671cf4dbaa6171faafd540d50510454d0032 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 30 Jan 2013 23:25:49 +0100 Subject: [PATCH 016/120] Updated Kramdown tests to reflect numeral HTML entities. --- test/test_kramdown.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_kramdown.rb b/test/test_kramdown.rb index 8aa72faf..981cdaf3 100644 --- a/test/test_kramdown.rb +++ b/test/test_kramdown.rb @@ -23,11 +23,11 @@ class TestKramdown < Test::Unit::TestCase should "convert quotes to smart quotes" do markdown = Converters::Markdown.new(@config) - assert_equal "

“Pit’hy”

", markdown.convert(%{"Pit'hy"}).strip + assert_equal "

“Pit’hy”

", markdown.convert(%{"Pit'hy"}).strip override = { 'kramdown' => { 'smart_quotes' => 'lsaquo,rsaquo,laquo,raquo' } } markdown = Converters::Markdown.new(@config.deep_merge(override)) - assert_equal "

«Pit›hy»

", markdown.convert(%{"Pit'hy"}).strip + assert_equal "

«Pit›hy»

", markdown.convert(%{"Pit'hy"}).strip end end end From 221c2f4c0ec38052bbf3a6c96e8fcb48f2286ff9 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 30 Jan 2013 23:30:04 +0100 Subject: [PATCH 017/120] Aliased jekyll server to jekyll serve --- bin/jekyll | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/jekyll b/bin/jekyll index 0034f75e..cd44da86 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -53,6 +53,7 @@ command :serve do |c| Jekyll::Commands::Serve.process(options) end end +alias_command :server, :serve command :import do |c| c.syntax = 'jekyll import [options]' From b70c59667ce84dfcc7d9d51f2f534f4e95a0e584 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 30 Jan 2013 23:43:26 +0100 Subject: [PATCH 018/120] Requiring jekyll-import gem. Printing error and exiting if it does not exist. --- bin/jekyll | 6 + lib/jekyll/migrators/csv.rb | 26 --- lib/jekyll/migrators/drupal.rb | 103 --------- lib/jekyll/migrators/enki.rb | 49 ---- lib/jekyll/migrators/joomla.rb | 53 ----- lib/jekyll/migrators/marley.rb | 52 ----- lib/jekyll/migrators/mephisto.rb | 84 ------- lib/jekyll/migrators/mt.rb | 86 ------- lib/jekyll/migrators/posterous.rb | 67 ------ lib/jekyll/migrators/rss.rb | 47 ---- lib/jekyll/migrators/textpattern.rb | 58 ----- lib/jekyll/migrators/tumblr.rb | 195 ---------------- lib/jekyll/migrators/typo.rb | 51 ---- lib/jekyll/migrators/wordpress.rb | 295 ------------------------ lib/jekyll/migrators/wordpressdotcom.rb | 82 ------- 15 files changed, 6 insertions(+), 1248 deletions(-) delete mode 100644 lib/jekyll/migrators/csv.rb delete mode 100644 lib/jekyll/migrators/drupal.rb delete mode 100644 lib/jekyll/migrators/enki.rb delete mode 100644 lib/jekyll/migrators/joomla.rb delete mode 100644 lib/jekyll/migrators/marley.rb delete mode 100644 lib/jekyll/migrators/mephisto.rb delete mode 100644 lib/jekyll/migrators/mt.rb delete mode 100644 lib/jekyll/migrators/posterous.rb delete mode 100644 lib/jekyll/migrators/rss.rb delete mode 100644 lib/jekyll/migrators/textpattern.rb delete mode 100644 lib/jekyll/migrators/tumblr.rb delete mode 100644 lib/jekyll/migrators/typo.rb delete mode 100644 lib/jekyll/migrators/wordpress.rb delete mode 100644 lib/jekyll/migrators/wordpressdotcom.rb diff --git a/bin/jekyll b/bin/jekyll index 0034f75e..8c43e36b 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -65,6 +65,12 @@ command :import do |c| c.option '--host', 'Host address to use when migrating' c.action do |args, options| + begin + require 'jekyll-import' + rescue + puts "You must install the 'jekyll-import' gem before continuing." + exit(-1) + end Jekyll::Commands::Migrate.process(args.first, options) end end diff --git a/lib/jekyll/migrators/csv.rb b/lib/jekyll/migrators/csv.rb deleted file mode 100644 index ce5203b7..00000000 --- a/lib/jekyll/migrators/csv.rb +++ /dev/null @@ -1,26 +0,0 @@ -module Jekyll - module CSV - # Reads a csv with title, permalink, body, published_at, and filter. - # It creates a post file for each row in the csv - def self.process(file = "posts.csv") - FileUtils.mkdir_p "_posts" - posts = 0 - FasterCSV.foreach(file) do |row| - next if row[0] == "title" - posts += 1 - name = row[3].split(" ")[0]+"-"+row[1]+(row[4] =~ /markdown/ ? ".markdown" : ".textile") - File.open("_posts/#{name}", "w") do |f| - f.puts <<-HEADER ---- -layout: post -title: #{row[0]} ---- - - HEADER - f.puts row[2] - end - end - "Created #{posts} posts!" - end - end -end diff --git a/lib/jekyll/migrators/drupal.rb b/lib/jekyll/migrators/drupal.rb deleted file mode 100644 index 6acd5de0..00000000 --- a/lib/jekyll/migrators/drupal.rb +++ /dev/null @@ -1,103 +0,0 @@ -require 'rubygems' -require 'sequel' -require 'fileutils' -require 'safe_yaml' - -# NOTE: This converter requires Sequel and the MySQL gems. -# The MySQL gem can be difficult to install on OS X. Once you have MySQL -# installed, running the following commands should work: -# $ sudo gem install sequel -# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config - -module Jekyll - module Drupal - # Reads a MySQL database via Sequel and creates a post file for each post - # in wp_posts that has post_status = 'publish'. This restriction is made - # because 'draft' posts are not guaranteed to have valid dates. - QUERY = "SELECT n.nid, \ - n.title, \ - nr.body, \ - n.created, \ - n.status \ - FROM node AS n, \ - node_revisions AS nr \ - WHERE (n.type = 'blog' OR n.type = 'story') \ - AND n.vid = nr.vid" - - def self.process(dbname, user, pass, host = 'localhost', prefix = '') - db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8') - - if prefix != '' - QUERY[" node "] = " " + prefix + "node " - QUERY[" node_revisions "] = " " + prefix + "node_revisions " - end - - FileUtils.mkdir_p "_posts" - FileUtils.mkdir_p "_drafts" - - # Create the refresh layout - # Change the refresh url if you customized your permalink config - File.open("_layouts/refresh.html", "w") do |f| - f.puts < - - - - - - -EOF - end - - db[QUERY].each do |post| - # Get required fields and construct Jekyll compatible name - node_id = post[:nid] - title = post[:title] - content = post[:body] - created = post[:created] - time = Time.at(created) - is_published = post[:status] == 1 - dir = is_published ? "_posts" : "_drafts" - slug = title.strip.downcase.gsub(/(&|&)/, ' and ').gsub(/[\s\.\/\\]/, '-').gsub(/[^\w-]/, '').gsub(/[-_]{2,}/, '-').gsub(/^[-_]/, '').gsub(/[-_]$/, '') - name = time.strftime("%Y-%m-%d-") + slug + '.md' - - # Get the relevant fields as a hash, delete empty fields and convert - # to YAML for the header - data = { - 'layout' => 'post', - 'title' => title.to_s, - 'created' => created, - }.delete_if { |k,v| v.nil? || v == ''}.to_yaml - - # Write out the data and content to file - File.open("#{dir}/#{name}", "w") do |f| - f.puts data - f.puts "---" - f.puts content - end - - # Make a file to redirect from the old Drupal URL - if is_published - aliases = db["SELECT dst FROM #{prefix}url_alias WHERE src = ?", "node/#{node_id}"].all - - aliases.push(:dst => "node/#{node_id}") - - aliases.each do |url_alias| - FileUtils.mkdir_p url_alias[:dst] - File.open("#{url_alias[:dst]}/index.md", "w") do |f| - f.puts "---" - f.puts "layout: refresh" - f.puts "refresh_to_post_id: /#{time.strftime("%Y/%m/%d/") + slug}" - f.puts "---" - end - end - end - end - - # TODO: Make dirs & files for nodes of type 'page' - # Make refresh pages for these as well - - # TODO: Make refresh dirs & files according to entries in url_alias table - end - end -end diff --git a/lib/jekyll/migrators/enki.rb b/lib/jekyll/migrators/enki.rb deleted file mode 100644 index 61cb2562..00000000 --- a/lib/jekyll/migrators/enki.rb +++ /dev/null @@ -1,49 +0,0 @@ -# Adapted by Rodrigo Pinto -# Based on typo.rb by Toby DiPasquale - -require 'fileutils' -require 'rubygems' -require 'sequel' - -module Jekyll - module Enki - SQL = <<-EOS - SELECT p.id, - p.title, - p.slug, - p.body, - p.published_at as date, - p.cached_tag_list as tags - FROM posts p - EOS - - # Just working with postgres, but can be easily adapted - # to work with both mysql and postgres. - def self.process(dbname, user, pass, host = 'localhost') - FileUtils.mkdir_p('_posts') - db = Sequel.postgres(:database => dbname, - :user => user, - :password => pass, - :host => host, - :encoding => 'utf8') - - db[SQL].each do |post| - name = [ sprintf("%.04d", post[:date].year), - sprintf("%.02d", post[:date].month), - sprintf("%.02d", post[:date].day), - post[:slug].strip ].join('-') - name += '.textile' - - File.open("_posts/#{name}", 'w') do |f| - f.puts({ 'layout' => 'post', - 'title' => post[:title].to_s, - 'enki_id' => post[:id], - 'categories' => post[:tags] - }.delete_if { |k, v| v.nil? || v == '' }.to_yaml) - f.puts '---' - f.puts post[:body].delete("\r") - end - end - end - end -end diff --git a/lib/jekyll/migrators/joomla.rb b/lib/jekyll/migrators/joomla.rb deleted file mode 100644 index c7e72476..00000000 --- a/lib/jekyll/migrators/joomla.rb +++ /dev/null @@ -1,53 +0,0 @@ -require 'rubygems' -require 'sequel' -require 'fileutils' -require 'safe_yaml' - -# NOTE: This migrator is made for Joomla 1.5 databases. -# NOTE: This converter requires Sequel and the MySQL gems. -# The MySQL gem can be difficult to install on OS X. Once you have MySQL -# installed, running the following commands should work: -# $ sudo gem install sequel -# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config - -module Jekyll - module Joomla - def self.process(dbname, user, pass, host = 'localhost', table_prefix = 'jos_', section = '1') - db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8') - - FileUtils.mkdir_p("_posts") - - # Reads a MySQL database via Sequel and creates a post file for each - # post in wp_posts that has post_status = 'publish'. This restriction is - # made because 'draft' posts are not guaranteed to have valid dates. - query = "SELECT `title`, `alias`, CONCAT(`introtext`,`fulltext`) as content, `created`, `id` FROM #{table_prefix}content WHERE state = '0' OR state = '1' AND sectionid = '#{section}'" - - db[query].each do |post| - # Get required fields and construct Jekyll compatible name. - title = post[:title] - slug = post[:alias] - date = post[:created] - content = post[:content] - name = "%02d-%02d-%02d-%s.markdown" % [date.year, date.month, date.day, - slug] - - # Get the relevant fields as a hash, delete empty fields and convert - # to YAML for the header. - data = { - 'layout' => 'post', - 'title' => title.to_s, - 'joomla_id' => post[:id], - 'joomla_url' => post[:alias], - 'date' => date - }.delete_if { |k,v| v.nil? || v == '' }.to_yaml - - # Write out the data and content to file - File.open("_posts/#{name}", "w") do |f| - f.puts data - f.puts "---" - f.puts content - end - end - end - end -end diff --git a/lib/jekyll/migrators/marley.rb b/lib/jekyll/migrators/marley.rb deleted file mode 100644 index 3aa74f49..00000000 --- a/lib/jekyll/migrators/marley.rb +++ /dev/null @@ -1,52 +0,0 @@ -require 'safe_yaml' -require 'fileutils' - -module Jekyll - module Marley - def self.regexp - { :id => /^\d{0,4}-{0,1}(.*)$/, - :title => /^#\s*(.*)\s+$/, - :title_with_date => /^#\s*(.*)\s+\(([0-9\/]+)\)$/, - :published_on => /.*\s+\(([0-9\/]+)\)$/, - :perex => /^([^\#\n]+\n)$/, - :meta => /^\{\{\n(.*)\}\}\n$/mi # Multiline Regexp - } - end - - def self.process(marley_data_dir) - raise ArgumentError, "marley dir #{marley_data_dir} not found" unless File.directory?(marley_data_dir) - - FileUtils.mkdir_p "_posts" - - posts = 0 - Dir["#{marley_data_dir}/**/*.txt"].each do |f| - next unless File.exists?(f) - - #copied over from marley's app/lib/post.rb - file_content = File.read(f) - meta_content = file_content.slice!( self.regexp[:meta] ) - body = file_content.sub( self.regexp[:title], '').sub( self.regexp[:perex], '').strip - - title = file_content.scan( self.regexp[:title] ).first.to_s.strip - prerex = file_content.scan( self.regexp[:perex] ).first.to_s.strip - published_on = DateTime.parse( post[:published_on] ) rescue File.mtime( File.dirname(f) ) - meta = ( meta_content ) ? YAML::load( meta_content.scan( self.regexp[:meta]).to_s ) : {} - meta['title'] = title - meta['layout'] = 'post' - - formatted_date = published_on.strftime('%Y-%m-%d') - post_name = File.dirname(f).split(%r{/}).last.gsub(/\A\d+-/, '') - - name = "#{formatted_date}-#{post_name}" - File.open("_posts/#{name}.markdown", "w") do |f| - f.puts meta.to_yaml - f.puts "---\n" - f.puts "\n#{prerex}\n\n" if prerex - f.puts body - end - posts += 1 - end - "Created #{posts} posts!" - end - end -end diff --git a/lib/jekyll/migrators/mephisto.rb b/lib/jekyll/migrators/mephisto.rb deleted file mode 100644 index 7622c722..00000000 --- a/lib/jekyll/migrators/mephisto.rb +++ /dev/null @@ -1,84 +0,0 @@ -# Quickly hacked together my Michael Ivey -# Based on mt.rb by Nick Gerakines, open source and publically -# available under the MIT license. Use this module at your own risk. - -require 'rubygems' -require 'sequel' -require 'fastercsv' -require 'fileutils' -require File.join(File.dirname(__FILE__),"csv.rb") - -# NOTE: This converter requires Sequel and the MySQL gems. -# The MySQL gem can be difficult to install on OS X. Once you have MySQL -# installed, running the following commands should work: -# $ sudo gem install sequel -# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config - -module Jekyll - module Mephisto - #Accepts a hash with database config variables, exports mephisto posts into a csv - #export PGPASSWORD if you must - def self.postgres(c) - sql = <<-SQL - BEGIN; - CREATE TEMP TABLE jekyll AS - SELECT title, permalink, body, published_at, filter FROM contents - WHERE user_id = 1 AND type = 'Article' ORDER BY published_at; - COPY jekyll TO STDOUT WITH CSV HEADER; - ROLLBACK; - SQL - command = %Q(psql -h #{c[:host] || "localhost"} -c "#{sql.strip}" #{c[:database]} #{c[:username]} -o #{c[:filename] || "posts.csv"}) - puts command - `#{command}` - CSV.process - end - - # This query will pull blog posts from all entries across all blogs. If - # you've got unpublished, deleted or otherwise hidden posts please sift - # through the created posts to make sure nothing is accidently published. - QUERY = "SELECT id, \ - permalink, \ - body, \ - published_at, \ - title \ - FROM contents \ - WHERE user_id = 1 AND \ - type = 'Article' AND \ - published_at IS NOT NULL \ - ORDER BY published_at" - - def self.process(dbname, user, pass, host = 'localhost') - db = Sequel.mysql(dbname, :user => user, - :password => pass, - :host => host, - :encoding => 'utf8') - - FileUtils.mkdir_p "_posts" - - db[QUERY].each do |post| - title = post[:title] - slug = post[:permalink] - date = post[:published_at] - content = post[:body] - - # Ideally, this script would determine the post format (markdown, - # html, etc) and create files with proper extensions. At this point - # it just assumes that markdown will be acceptable. - name = [date.year, date.month, date.day, slug].join('-') + ".markdown" - - data = { - 'layout' => 'post', - 'title' => title.to_s, - 'mt_id' => post[:entry_id], - }.delete_if { |k,v| v.nil? || v == ''}.to_yaml - - File.open("_posts/#{name}", "w") do |f| - f.puts data - f.puts "---" - f.puts content - end - end - - end - end -end diff --git a/lib/jekyll/migrators/mt.rb b/lib/jekyll/migrators/mt.rb deleted file mode 100644 index 09d89a79..00000000 --- a/lib/jekyll/migrators/mt.rb +++ /dev/null @@ -1,86 +0,0 @@ -# Created by Nick Gerakines, open source and publically available under the -# MIT license. Use this module at your own risk. -# I'm an Erlang/Perl/C++ guy so please forgive my dirty ruby. - -require 'rubygems' -require 'sequel' -require 'fileutils' -require 'safe_yaml' - -# NOTE: This converter requires Sequel and the MySQL gems. -# The MySQL gem can be difficult to install on OS X. Once you have MySQL -# installed, running the following commands should work: -# $ sudo gem install sequel -# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config - -module Jekyll - module MT - # This query will pull blog posts from all entries across all blogs. If - # you've got unpublished, deleted or otherwise hidden posts please sift - # through the created posts to make sure nothing is accidently published. - QUERY = "SELECT entry_id, \ - entry_basename, \ - entry_text, \ - entry_text_more, \ - entry_authored_on, \ - entry_title, \ - entry_convert_breaks \ - FROM mt_entry" - - def self.process(dbname, user, pass, host = 'localhost') - db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8') - - FileUtils.mkdir_p "_posts" - - db[QUERY].each do |post| - title = post[:entry_title] - slug = post[:entry_basename].gsub(/_/, '-') - date = post[:entry_authored_on] - content = post[:entry_text] - more_content = post[:entry_text_more] - entry_convert_breaks = post[:entry_convert_breaks] - - # Be sure to include the body and extended body. - if more_content != nil - content = content + " \n" + more_content - end - - # Ideally, this script would determine the post format (markdown, - # html, etc) and create files with proper extensions. At this point - # it just assumes that markdown will be acceptable. - name = [date.year, date.month, date.day, slug].join('-') + '.' + - self.suffix(entry_convert_breaks) - - data = { - 'layout' => 'post', - 'title' => title.to_s, - 'mt_id' => post[:entry_id], - 'date' => date - }.delete_if { |k,v| v.nil? || v == '' }.to_yaml - - File.open("_posts/#{name}", "w") do |f| - f.puts data - f.puts "---" - f.puts content - end - end - end - - def self.suffix(entry_type) - if entry_type.nil? || entry_type.include?("markdown") - # The markdown plugin I have saves this as - # "markdown_with_smarty_pants", so I just look for "markdown". - "markdown" - elsif entry_type.include?("textile") - # This is saved as "textile_2" on my installation of MT 5.1. - "textile" - elsif entry_type == "0" || entry_type.include?("richtext") - # Richtext looks to me like it's saved as HTML, so I include it here. - "html" - else - # Other values might need custom work. - entry_type - end - end - end -end diff --git a/lib/jekyll/migrators/posterous.rb b/lib/jekyll/migrators/posterous.rb deleted file mode 100644 index 0a2280f2..00000000 --- a/lib/jekyll/migrators/posterous.rb +++ /dev/null @@ -1,67 +0,0 @@ -require 'rubygems' -require 'jekyll' -require 'fileutils' -require 'net/http' -require 'uri' -require "json" - -# ruby -r './lib/jekyll/migrators/posterous.rb' -e 'Jekyll::Posterous.process(email, pass, api_key, blog)' - -module Jekyll - module Posterous - def self.fetch(uri_str, limit = 10) - # You should choose better exception. - raise ArgumentError, 'Stuck in a redirect loop. Please double check your email and password' if limit == 0 - - response = nil - Net::HTTP.start('posterous.com') do |http| - req = Net::HTTP::Get.new(uri_str) - req.basic_auth @email, @pass - response = http.request(req) - end - - case response - when Net::HTTPSuccess then response - when Net::HTTPRedirection then fetch(response['location'], limit - 1) - else response.error! - end - end - - def self.process(email, pass, api_token, blog = 'primary') - @email, @pass, @api_token = email, pass, api_token - FileUtils.mkdir_p "_posts" - - posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}").body) - page = 1 - - while posts.any? - posts.each do |post| - title = post["title"] - slug = title.gsub(/[^[:alnum:]]+/, '-').downcase - date = Date.parse(post["display_date"]) - content = post["body_html"] - published = !post["is_private"] - name = "%02d-%02d-%02d-%s.html" % [date.year, date.month, date.day, slug] - - # Get the relevant fields as a hash, delete empty fields and convert - # to YAML for the header - data = { - 'layout' => 'post', - 'title' => title.to_s, - 'published' => published - }.delete_if { |k,v| v.nil? || v == ''}.to_yaml - - # Write out the data and content to file - File.open("_posts/#{name}", "w") do |f| - f.puts data - f.puts "---" - f.puts content - end - end - - page += 1 - posts = JSON.parse(self.fetch("/api/v2/users/me/sites/#{blog}/posts?api_token=#{@api_token}&page=#{page}").body) - end - end - end -end diff --git a/lib/jekyll/migrators/rss.rb b/lib/jekyll/migrators/rss.rb deleted file mode 100644 index fec3d07c..00000000 --- a/lib/jekyll/migrators/rss.rb +++ /dev/null @@ -1,47 +0,0 @@ -# Created by Kendall Buchanan (https://github.com/kendagriff) on 2011-12-22. -# Use at your own risk. The end. -# -# Usage: -# (URL) -# ruby -r '_import/rss.rb' -e "Jekyll::MigrateRSS.process('http://yourdomain.com/your-favorite-feed.xml')" -# -# (Local file) -# ruby -r '_import/rss.rb' -e "Jekyll::MigrateRSS.process('./somefile/on/your/computer.xml')" - -require 'rubygems' -require 'rss/1.0' -require 'rss/2.0' -require 'open-uri' -require 'fileutils' -require 'safe_yaml' - -module Jekyll - module MigrateRSS - - # The `source` argument may be a URL or a local file. - def self.process(source) - content = "" - open(source) { |s| content = s.read } - rss = RSS::Parser.parse(content, false) - - raise "There doesn't appear to be any RSS items at the source (#{source}) provided." unless rss - - rss.items.each do |item| - formatted_date = item.date.strftime('%Y-%m-%d') - post_name = item.title.split(%r{ |!|/|:|&|-|$|,}).map { |i| i.downcase if i != '' }.compact.join('-') - name = "#{formatted_date}-#{post_name}" - - header = { - 'layout' => 'post', - 'title' => item.title - } - - File.open("_posts/#{name}.html", "w") do |f| - f.puts header.to_yaml - f.puts "---\n" - f.puts item.description - end - end - end - end -end \ No newline at end of file diff --git a/lib/jekyll/migrators/textpattern.rb b/lib/jekyll/migrators/textpattern.rb deleted file mode 100644 index 9eca2530..00000000 --- a/lib/jekyll/migrators/textpattern.rb +++ /dev/null @@ -1,58 +0,0 @@ -require 'rubygems' -require 'sequel' -require 'fileutils' -require 'safe_yaml' - -# NOTE: This converter requires Sequel and the MySQL gems. -# The MySQL gem can be difficult to install on OS X. Once you have MySQL -# installed, running the following commands should work: -# $ sudo gem install sequel -# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config - -module Jekyll - module TextPattern - # Reads a MySQL database via Sequel and creates a post file for each post. - # The only posts selected are those with a status of 4 or 5, which means - # "live" and "sticky" respectively. - # Other statuses are 1 => draft, 2 => hidden and 3 => pending. - QUERY = "SELECT Title, \ - url_title, \ - Posted, \ - Body, \ - Keywords \ - FROM textpattern \ - WHERE Status = '4' OR \ - Status = '5'" - - def self.process(dbname, user, pass, host = 'localhost') - db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8') - - FileUtils.mkdir_p "_posts" - - db[QUERY].each do |post| - # Get required fields and construct Jekyll compatible name. - title = post[:Title] - slug = post[:url_title] - date = post[:Posted] - content = post[:Body] - - name = [date.strftime("%Y-%m-%d"), slug].join('-') + ".textile" - - # Get the relevant fields as a hash, delete empty fields and convert - # to YAML for the header. - data = { - 'layout' => 'post', - 'title' => title.to_s, - 'tags' => post[:Keywords].split(',') - }.delete_if { |k,v| v.nil? || v == ''}.to_yaml - - # Write out the data and content to file. - File.open("_posts/#{name}", "w") do |f| - f.puts data - f.puts "---" - f.puts content - end - end - end - end -end diff --git a/lib/jekyll/migrators/tumblr.rb b/lib/jekyll/migrators/tumblr.rb deleted file mode 100644 index 4a1e19d7..00000000 --- a/lib/jekyll/migrators/tumblr.rb +++ /dev/null @@ -1,195 +0,0 @@ -require 'rubygems' -require 'open-uri' -require 'fileutils' -require 'nokogiri' -require 'date' -require 'json' -require 'uri' -require 'jekyll' - -module Jekyll - module Tumblr - def self.process(url, format = "html", grab_images = false, - add_highlights = false, rewrite_urls = true) - @grab_images = grab_images - FileUtils.mkdir_p "_posts/tumblr" - url += "/api/read/json/" - per_page = 50 - posts = [] - # Two passes are required so that we can rewrite URLs. - # First pass builds up an array of each post as a hash. - begin - current_page = (current_page || -1) + 1 - feed = open(url + "?num=#{per_page}&start=#{current_page * per_page}") - json = feed.readlines.join("\n")[21...-2] # Strip Tumblr's JSONP chars. - blog = JSON.parse(json) - puts "Page: #{current_page + 1} - Posts: #{blog["posts"].size}" - posts += blog["posts"].map { |post| post_to_hash(post, format) } - end until blog["posts"].size < per_page - # Rewrite URLs and create redirects. - posts = rewrite_urls_and_redirects posts if rewrite_urls - # Second pass for writing post files. - posts.each do |post| - if format == "md" - post[:content] = html_to_markdown post[:content] - post[:content] = add_syntax_highlights post[:content] if add_highlights - end - File.open("_posts/tumblr/#{post[:name]}", "w") do |f| - f.puts post[:header].to_yaml + "---\n" + post[:content] - end - end - end - - private - - # Converts each type of Tumblr post to a hash with all required - # data for Jekyll. - def self.post_to_hash(post, format) - case post['type'] - when "regular" - title = post["regular-title"] - content = post["regular-body"] - when "link" - title = post["link-text"] || post["link-url"] - content = "#{title}" - unless post["link-description"].nil? - content << "
" + post["link-description"] - end - when "photo" - title = post["photo-caption"] - max_size = post.keys.map{ |k| k.gsub("photo-url-", "").to_i }.max - url = post["photo-url"] || post["photo-url-#{max_size}"] - ext = "." + post[post.keys.select { |k| - k =~ /^photo-url-/ && post[k].split("/").last =~ /\./ - }.first].split(".").last - content = "" - unless post["photo-link-url"].nil? - content = "#{content}" - end - when "audio" - if !post["id3-title"].nil? - title = post["id3-title"] - content = post.at["audio-player"] + "
" + post["audio-caption"] - else - title = post["audio-caption"] - content = post.at["audio-player"] - end - when "quote" - title = post["quote-text"] - content = "
#{post["quote-text"]}
" - unless post["quote-source"].nil? - content << "—" + post["quote-source"] - end - when "conversation" - title = post["conversation-title"] - content = "
" - post["conversation"]["line"].each do |line| - content << "
#{line['label']}
#{line}
" - end - content << "
" - when "video" - title = post["video-title"] - content = post["video-player"] - unless post["video-caption"].nil? - content << "
" + post["video-caption"] - end - end - date = Date.parse(post['date']).to_s - title = Nokogiri::HTML(title).text - slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '') - slug = slug.slice(0..200) if slug.length > 200 - { - :name => "#{date}-#{slug}.#{format}", - :header => { - "layout" => "post", - "title" => title, - "tags" => post["tags"], - }, - :content => content, - :url => post["url"], - :slug => post["url-with-slug"], - } - end - - # Create a Hash of old urls => new urls, for rewriting and - # redirects, and replace urls in each post. Instantiate Jekyll - # site/posts to get the correct permalink format. - def self.rewrite_urls_and_redirects(posts) - site = Jekyll::Site.new(Jekyll.configuration({})) - urls = Hash[posts.map { |post| - # Create an initial empty file for the post so that - # we can instantiate a post object. - File.open("_posts/tumblr/#{post[:name]}", "w") - tumblr_url = URI.parse(post[:slug]).path - jekyll_url = Jekyll::Post.new(site, Dir.pwd, "", "tumblr/" + post[:name]).url - redirect_dir = tumblr_url.sub(/\//, "") + "/" - FileUtils.mkdir_p redirect_dir - File.open(redirect_dir + "index.html", "w") do |f| - f.puts "" - end - [tumblr_url, jekyll_url] - }] - posts.map { |post| - urls.each do |tumblr_url, jekyll_url| - post[:content].gsub!(/#{tumblr_url}/i, jekyll_url) - end - post - } - end - - # Uses Python's html2text to convert a post's content to - # markdown. Preserve HTML tables as per the markdown docs. - def self.html_to_markdown(content) - preserve = ["table", "tr", "th", "td"] - preserve.each do |tag| - content.gsub!(/<#{tag}/i, "$$" + tag) - content.gsub!(/<\/#{tag}/i, "||" + tag) - end - content = %x[echo '#{content.gsub("'", "''")}' | html2text] - preserve.each do |tag| - content.gsub!("$$" + tag, "<" + tag) - content.gsub!("||" + tag, " -require 'fileutils' -require 'rubygems' -require 'sequel' -require 'safe_yaml' - -module Jekyll - module Typo - # This SQL *should* work for both MySQL and PostgreSQL, but I haven't - # tested PostgreSQL yet (as of 2008-12-16). - SQL = <<-EOS - SELECT c.id id, - c.title title, - c.permalink slug, - c.body body, - c.published_at date, - c.state state, - COALESCE(tf.name, 'html') filter - FROM contents c - LEFT OUTER JOIN text_filters tf - ON c.text_filter_id = tf.id - EOS - - def self.process dbname, user, pass, host='localhost' - FileUtils.mkdir_p '_posts' - db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host, :encoding => 'utf8') - db[SQL].each do |post| - next unless post[:state] =~ /published/ - - name = [ sprintf("%.04d", post[:date].year), - sprintf("%.02d", post[:date].month), - sprintf("%.02d", post[:date].day), - post[:slug].strip ].join('-') - - # Can have more than one text filter in this field, but we just want - # the first one for this. - name += '.' + post[:filter].split(' ')[0] - - File.open("_posts/#{name}", 'w') do |f| - f.puts({ 'layout' => 'post', - 'title' => post[:title].to_s, - 'typo_id' => post[:id] - }.delete_if { |k, v| v.nil? || v == '' }.to_yaml) - f.puts '---' - f.puts post[:body].delete("\r") - end - end - end - - end -end diff --git a/lib/jekyll/migrators/wordpress.rb b/lib/jekyll/migrators/wordpress.rb deleted file mode 100644 index 8d0ecf71..00000000 --- a/lib/jekyll/migrators/wordpress.rb +++ /dev/null @@ -1,295 +0,0 @@ -require 'rubygems' -require 'sequel' -require 'fileutils' -require 'safe_yaml' - -# NOTE: This converter requires Sequel and the MySQL gems. -# The MySQL gem can be difficult to install on OS X. Once you have MySQL -# installed, running the following commands should work: -# $ sudo gem install sequel -# $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config - -module Jekyll - module WordPress - - # Main migrator function. Call this to perform the migration. - # - # dbname:: The name of the database - # user:: The database user name - # pass:: The database user's password - # host:: The address of the MySQL database host. Default: 'localhost' - # options:: A hash table of configuration options. - # - # Supported options are: - # - # :table_prefix:: Prefix of database tables used by WordPress. - # Default: 'wp_' - # :clean_entities:: If true, convert non-ASCII characters to HTML - # entities in the posts, comments, titles, and - # names. Requires the 'htmlentities' gem to - # work. Default: true. - # :comments:: If true, migrate post comments too. Comments - # are saved in the post's YAML front matter. - # Default: true. - # :categories:: If true, save the post's categories in its - # YAML front matter. - # :tags:: If true, save the post's tags in its - # YAML front matter. - # :more_excerpt:: If true, when a post has no excerpt but - # does have a tag, use the - # preceding post content as the excerpt. - # Default: true. - # :more_anchor:: If true, convert a tag into - # two HTML anchors with ids "more" and - # "more-NNN" (where NNN is the post number). - # Default: true. - # :status:: Array of allowed post statuses. Only - # posts with matching status will be migrated. - # Known statuses are :publish, :draft, :private, - # and :revision. If this is nil or an empty - # array, all posts are migrated regardless of - # status. Default: [:publish]. - # - def self.process(dbname, user, pass, host='localhost', options={}) - options = { - :table_prefix => 'wp_', - :clean_entities => true, - :comments => true, - :categories => true, - :tags => true, - :more_excerpt => true, - :more_anchor => true, - :status => [:publish] # :draft, :private, :revision - }.merge(options) - - if options[:clean_entities] - begin - require 'htmlentities' - rescue LoadError - STDERR.puts "Could not require 'htmlentities', so the " + - ":clean_entities option is now disabled." - options[:clean_entities] = false - end - end - - FileUtils.mkdir_p("_posts") - - db = Sequel.mysql(dbname, :user => user, :password => pass, - :host => host, :encoding => 'utf8') - - px = options[:table_prefix] - - posts_query = " - SELECT - posts.ID AS `id`, - posts.guid AS `guid`, - posts.post_type AS `type`, - posts.post_status AS `status`, - posts.post_title AS `title`, - posts.post_name AS `slug`, - posts.post_date AS `date`, - posts.post_content AS `content`, - posts.post_excerpt AS `excerpt`, - posts.comment_count AS `comment_count`, - users.display_name AS `author`, - users.user_login AS `author_login`, - users.user_email AS `author_email`, - users.user_url AS `author_url` - FROM #{px}posts AS `posts` - LEFT JOIN #{px}users AS `users` - ON posts.post_author = users.ID" - - if options[:status] and not options[:status].empty? - status = options[:status][0] - posts_query << " - WHERE posts.post_status = '#{status.to_s}'" - options[:status][1..-1].each do |status| - posts_query << " OR - posts.post_status = '#{status.to_s}'" - end - end - - db[posts_query].each do |post| - process_post(post, db, options) - end - end - - - def self.process_post(post, db, options) - px = options[:table_prefix] - - title = post[:title] - if options[:clean_entities] - title = clean_entities(title) - end - - slug = post[:slug] - if !slug or slug.empty? - slug = sluggify(title) - end - - date = post[:date] || Time.now - name = "%02d-%02d-%02d-%s.markdown" % [date.year, date.month, - date.day, slug] - content = post[:content].to_s - if options[:clean_entities] - content = clean_entities(content) - end - - excerpt = post[:excerpt].to_s - - more_index = content.index(//) - more_anchor = nil - if more_index - if options[:more_excerpt] and - (post[:excerpt].nil? or post[:excerpt].empty?) - excerpt = content[0...more_index] - end - if options[:more_anchor] - more_link = "more" - content.sub!(//, - "" + - "") - end - end - - categories = [] - tags = [] - - if options[:categories] or options[:tags] - - cquery = - "SELECT - terms.name AS `name`, - ttax.taxonomy AS `type` - FROM - #{px}terms AS `terms`, - #{px}term_relationships AS `trels`, - #{px}term_taxonomy AS `ttax` - WHERE - trels.object_id = '#{post[:id]}' AND - trels.term_taxonomy_id = ttax.term_taxonomy_id AND - terms.term_id = ttax.term_id" - - db[cquery].each do |term| - if options[:categories] and term[:type] == "category" - if options[:clean_entities] - categories << clean_entities(term[:name]) - else - categories << term[:name] - end - elsif options[:tags] and term[:type] == "post_tag" - if options[:clean_entities] - tags << clean_entities(term[:name]) - else - tags << term[:name] - end - end - end - end - - comments = [] - - if options[:comments] and post[:comment_count].to_i > 0 - cquery = - "SELECT - comment_ID AS `id`, - comment_author AS `author`, - comment_author_email AS `author_email`, - comment_author_url AS `author_url`, - comment_date AS `date`, - comment_date_gmt AS `date_gmt`, - comment_content AS `content` - FROM #{px}comments - WHERE - comment_post_ID = '#{post[:id]}' AND - comment_approved != 'spam'" - - - db[cquery].each do |comment| - - comcontent = comment[:content].to_s - if comcontent.respond_to?(:force_encoding) - comcontent.force_encoding("UTF-8") - end - if options[:clean_entities] - comcontent = clean_entities(comcontent) - end - comauthor = comment[:author].to_s - if options[:clean_entities] - comauthor = clean_entities(comauthor) - end - - comments << { - 'id' => comment[:id].to_i, - 'author' => comauthor, - 'author_email' => comment[:author_email].to_s, - 'author_url' => comment[:author_url].to_s, - 'date' => comment[:date].to_s, - 'date_gmt' => comment[:date_gmt].to_s, - 'content' => comcontent, - } - end - - comments.sort!{ |a,b| a['id'] <=> b['id'] } - end - - # Get the relevant fields as a hash, delete empty fields and - # convert to YAML for the header. - data = { - 'layout' => post[:type].to_s, - 'status' => post[:status].to_s, - 'published' => (post[:status].to_s == "publish"), - 'title' => title.to_s, - 'author' => post[:author].to_s, - 'author_login' => post[:author_login].to_s, - 'author_email' => post[:author_email].to_s, - 'author_url' => post[:author_url].to_s, - 'excerpt' => excerpt, - 'more_anchor' => more_anchor, - 'wordpress_id' => post[:id], - 'wordpress_url' => post[:guid].to_s, - 'date' => date, - 'categories' => options[:categories] ? categories : nil, - 'tags' => options[:tags] ? tags : nil, - 'comments' => options[:comments] ? comments : nil, - }.delete_if { |k,v| v.nil? || v == '' }.to_yaml - - # Write out the data and content to file - File.open("_posts/#{name}", "w") do |f| - f.puts data - f.puts "---" - f.puts content - end - end - - - def self.clean_entities( text ) - if text.respond_to?(:force_encoding) - text.force_encoding("UTF-8") - end - text = HTMLEntities.new.encode(text, :named) - # We don't want to convert these, it would break all - # HTML tags in the post and comments. - text.gsub!("&", "&") - text.gsub!("<", "<") - text.gsub!(">", ">") - text.gsub!(""", '"') - text.gsub!("'", "'") - text.gsub!("/", "/") - text - end - - - def self.sluggify( title ) - begin - require 'unidecode' - title = title.to_ascii - rescue LoadError - STDERR.puts "Could not require 'unidecode'. If your post titles have non-ASCII characters, you could get nicer permalinks by installing unidecode." - end - title.downcase.gsub(/[^0-9A-Za-z]+/, " ").strip.gsub(" ", "-") - end - - end -end diff --git a/lib/jekyll/migrators/wordpressdotcom.rb b/lib/jekyll/migrators/wordpressdotcom.rb deleted file mode 100644 index bf423384..00000000 --- a/lib/jekyll/migrators/wordpressdotcom.rb +++ /dev/null @@ -1,82 +0,0 @@ -# coding: utf-8 - -require 'rubygems' -require 'hpricot' -require 'fileutils' -require 'safe_yaml' -require 'time' - -module Jekyll - # This importer takes a wordpress.xml file, which can be exported from your - # wordpress.com blog (/wp-admin/export.php). - module WordpressDotCom - def self.process(filename = "wordpress.xml") - import_count = Hash.new(0) - doc = Hpricot::XML(File.read(filename)) - - (doc/:channel/:item).each do |item| - title = item.at(:title).inner_text.strip - permalink_title = item.at('wp:post_name').inner_text - # Fallback to "prettified" title if post_name is empty (can happen) - if permalink_title == "" - permalink_title = sluggify(title) - end - - date = Time.parse(item.at('wp:post_date').inner_text) - status = item.at('wp:status').inner_text - - if status == "publish" - published = true - else - published = false - end - - type = item.at('wp:post_type').inner_text - tags = (item/:category).map{|c| c.inner_text}.reject{|c| c == 'Uncategorized'}.uniq - - metas = Hash.new - item.search("wp:postmeta").each do |meta| - key = meta.at('wp:meta_key').inner_text - value = meta.at('wp:meta_value').inner_text - metas[key] = value; - end - - name = "#{date.strftime('%Y-%m-%d')}-#{permalink_title}.html" - header = { - 'layout' => type, - 'title' => title, - 'tags' => tags, - 'status' => status, - 'type' => type, - 'published' => published, - 'meta' => metas - } - - begin - FileUtils.mkdir_p "_#{type}s" - File.open("_#{type}s/#{name}", "w") do |f| - f.puts header.to_yaml - f.puts '---' - f.puts item.at('content:encoded').inner_text - end - rescue => e - puts "Couldn't import post!" - puts "Title: #{title}" - puts "Name/Slug: #{name}\n" - puts "Error: #{e.message}" - next - end - - import_count[type] += 1 - end - - import_count.each do |key, value| - puts "Imported #{value} #{key}s" - end - end - - def self.sluggify(title) - title.downcase.split.join('-').gsub('/','-') - end - end -end From 28a074ff7aaf37f2f7d907575084d3298dbc1b0f Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 31 Jan 2013 00:18:22 +0100 Subject: [PATCH 019/120] Remove Jekyll::Commands::Migrate --- lib/jekyll/commands/migrate.rb | 47 ---------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 lib/jekyll/commands/migrate.rb diff --git a/lib/jekyll/commands/migrate.rb b/lib/jekyll/commands/migrate.rb deleted file mode 100644 index 21c49037..00000000 --- a/lib/jekyll/commands/migrate.rb +++ /dev/null @@ -1,47 +0,0 @@ -module Jekyll - module Commands - class Migrate < Command - MIGRATORS = { - :csv => 'CSV', - :drupal => 'Drupal', - :enki => 'Enki', - :mephisto => 'Mephisto', - :mt => 'MT', - :posterous => 'Posterous', - :textpattern => 'TextPattern', - :tumblr => 'Tumblr', - :typo => 'Typo', - :wordpressdotcom => 'WordpressDotCom', - :wordpress => 'WordPress' - } - - def self.process(migrator, options) - abort 'missing argument. Please specify a migrator' if migrator.nil? - migrator = migrator.downcase - - cmd_options = [] - [ :file, :dbname, :user, :pass, :host, :site ].each do |p| - cmd_options << "\"#{options[p]}\"" unless options[p].nil? - end - - - if MIGRATORS.keys.include?(migrator) - app_root = File.expand_path( - File.join(File.dirname(__FILE__), '..', '..', '..') - ) - - require "#{app_root}/lib/jekyll/migrators/#{migrator}" - - if Jekyll.const_defiend?(MIGRATORS[migrator.to_sym]) - puts 'Importing...' - migrator_class = Jekyll.const_get(MIGRATORS[migrator.to_sym]) - migrator_class.process(*cmd_options) - exit 0 - end - end - - abort 'invalid migrator. Please specify a valid migrator' - end - end - end -end From 82f29bb627ab6e7839b53367c014b6e6ad70bd9c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 31 Jan 2013 00:18:54 +0100 Subject: [PATCH 020/120] The jekyll-import gem provides Jekyll::Commands::Import, not Jekyll::Commands::Migrate. --- bin/jekyll | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/jekyll b/bin/jekyll index 8c43e36b..6be36369 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -71,6 +71,6 @@ command :import do |c| puts "You must install the 'jekyll-import' gem before continuing." exit(-1) end - Jekyll::Commands::Migrate.process(args.first, options) + Jekyll::Commands::Import.process(args.first, options) end end From e8384e6a974d237043a895983ac82c4729c2e201 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 31 Jan 2013 01:19:34 +0100 Subject: [PATCH 021/120] Eliminating migrator dependencies. --- jekyll.gemspec | 4 ---- 1 file changed, 4 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index ed0d9201..7236e2c2 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -44,10 +44,6 @@ Gem::Specification.new do |s| s.add_development_dependency('launchy', "~> 2.1.2") s.add_development_dependency('simplecov', "~> 0.7") s.add_development_dependency('simplecov-gem-adapter', "~> 1.0.1") - # migrator dependencies: - s.add_development_dependency('sequel', "~> 3.42") - s.add_development_dependency('htmlentities', "~> 4.3") - s.add_development_dependency('hpricot', "~> 0.8") # = MANIFEST = s.files = %w[ From 9bb0bfc0b2ddbef498c7dfb78fec0c64bc182f43 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 31 Jan 2013 01:19:56 +0100 Subject: [PATCH 022/120] Eliminating migrator tests (in this repo). --- test/test_wordpress_migrator.rb | 10 ---------- test/test_wordpressdotcom_migrator.rb | 9 --------- 2 files changed, 19 deletions(-) delete mode 100644 test/test_wordpress_migrator.rb delete mode 100644 test/test_wordpressdotcom_migrator.rb diff --git a/test/test_wordpress_migrator.rb b/test/test_wordpress_migrator.rb deleted file mode 100644 index 945fbc8b..00000000 --- a/test/test_wordpress_migrator.rb +++ /dev/null @@ -1,10 +0,0 @@ -require 'helper' -require 'jekyll/migrators/wordpress' -require 'htmlentities' - -class TestWordpressMigrator < Test::Unit::TestCase - should "clean slashes from slugs" do - test_title = "blogs part 1/2" - assert_equal("blogs-part-1-2", Jekyll::WordPress.sluggify(test_title)) - end -end diff --git a/test/test_wordpressdotcom_migrator.rb b/test/test_wordpressdotcom_migrator.rb deleted file mode 100644 index fb38737b..00000000 --- a/test/test_wordpressdotcom_migrator.rb +++ /dev/null @@ -1,9 +0,0 @@ -require 'helper' -require 'jekyll/migrators/wordpressdotcom' - -class TestWordpressDotComMigrator < Test::Unit::TestCase - should "clean slashes from slugs" do - test_title = "blogs part 1/2" - assert_equal("blogs-part-1-2", Jekyll::WordpressDotCom.sluggify(test_title)) - end -end From daa9e11994482d0cde3901732dd0758f8e33400d Mon Sep 17 00:00:00 2001 From: scribu Date: Thu, 31 Jan 2013 05:35:19 +0200 Subject: [PATCH 023/120] fix whitespace in drafts.feature --- features/drafts.feature | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/features/drafts.feature b/features/drafts.feature index d7a6eb31..27832fc4 100644 --- a/features/drafts.feature +++ b/features/drafts.feature @@ -11,7 +11,7 @@ Feature: Draft Posts | Recipe | 3/27/2009 | default | Not baked yet. | When I run jekyll with drafts Then the _site directory should exist - And I should see "Not baked yet." in "_site/recipe.html" + And I should see "Not baked yet." in "_site/recipe.html" Scenario: Don't preview a draft Given I have a configuration file with "permalink" set to "none" @@ -22,4 +22,4 @@ Feature: Draft Posts | Recipe | 3/27/2009 | default | Not baked yet. | When I run jekyll Then the _site directory should exist - And the "_site/recipe.html" file should not exist + And the "_site/recipe.html" file should not exist From f5137850e46dd971bcc542f486fd79aa589967a1 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 3 Feb 2013 01:24:38 +0100 Subject: [PATCH 024/120] Using abort instead of puts & exit when jekyll-import gem isn't available. --- bin/jekyll | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index 6be36369..4bc8fc0f 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -68,8 +68,7 @@ command :import do |c| begin require 'jekyll-import' rescue - puts "You must install the 'jekyll-import' gem before continuing." - exit(-1) + abort "You must install the 'jekyll-import' gem before continuing." end Jekyll::Commands::Import.process(args.first, options) end From 7a44965c8881fe404b87e41ff29ce9ba1c6e76c8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 3 Feb 2013 01:54:52 +0100 Subject: [PATCH 025/120] Updated history to reflect merge of #793. Closes #787. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 4103efed..35efbfb5 100644 --- a/History.txt +++ b/History.txt @@ -1,6 +1,7 @@ == HEAD * Major Enhancements * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) + * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements * Updated gem versions for Kramdown, Rake, Shoulda, Cucumber, and RedCarpet. (#744) * Refactored jekyll subcommands into Jekyll::Commands submodule, which now contains them (#768) From e4042e56b758f75d22f859d02f1e7f0623831b57 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 3 Feb 2013 18:56:42 +0100 Subject: [PATCH 026/120] Update history to reflect merge of #792. Closes #789. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 35efbfb5..03ee23ec 100644 --- a/History.txt +++ b/History.txt @@ -3,6 +3,7 @@ * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements + * Aliased `jekyll server` to `jekyll serve`. (#792) * Updated gem versions for Kramdown, Rake, Shoulda, Cucumber, and RedCarpet. (#744) * Refactored jekyll subcommands into Jekyll::Commands submodule, which now contains them (#768) * Rescue from import errors in Wordpress.com migrator (#671) From dd7c5870d936ee37e4a1635058cf08efb84ea2d8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 3 Feb 2013 20:29:58 +0100 Subject: [PATCH 027/120] Cleaner output when generating site. --- lib/jekyll.rb | 14 +++++++++----- lib/jekyll/commands/build.rb | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 2c1ab0e6..948dc72f 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -131,12 +131,16 @@ module Jekyll config_file = File.join(source, '_config.yml') begin config = YAML.load_file(config_file) - raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash) - $stdout.puts "Configuration from #{config_file}" + raise "Invalid configuration file: #{config_file}" if !config.is_a?(Hash) + $stdout.puts "Configuration file: #{config_file}" rescue => err - $stderr.puts "WARNING: Could not read configuration. " + - "Using defaults (and options)." - $stderr.puts "\t" + err.to_s + unless File.exists?(config_file) + $stdout.puts "Configuration file: none" + else + $stderr.puts "WARNING: Could not read configuration. " + + "Using defaults (and options)." + $stderr.puts "\t" + err.to_s + end config = {} end diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index 0bb3c4f1..04942b77 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -23,7 +23,9 @@ module Jekyll def self.build(site, options) source = options['source'] destination = options['destination'] - puts "Building site: #{source} -> #{destination}" + puts " Source: #{source}" + puts " Destination: #{destination}" + print " Generating... " begin site.process rescue Jekyll::FatalException => e @@ -33,7 +35,7 @@ module Jekyll puts e.message exit(1) end - puts "Successfully generated site: #{source} -> #{destination}" + puts "done." end # Private: Watch for file changes and rebuild the site. From 90fa3f29213b2eea3f7a94734a6cbd71027ac904 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 3 Feb 2013 20:36:34 +0100 Subject: [PATCH 028/120] Improved output for auto-regeneration. --- lib/jekyll/commands/build.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index 04942b77..f85b65e7 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -50,7 +50,9 @@ module Jekyll source = options['source'] destination = options['destination'] - puts "Auto-Regenerating enabled: #{source} -> #{destination}" + puts " Source: #{source}" + puts " Destination: #{destination}" + puts " Auto-regeneration: enabled" dw = DirectoryWatcher.new(source) dw.interval = 1 @@ -58,15 +60,16 @@ module Jekyll dw.add_observer do |*args| t = Time.now.strftime("%Y-%m-%d %H:%M:%S") - puts "[#{t}] regeneration: #{args.size} files changed" + print " Regenerating: #{args.size} files at #{t} " site.process + puts "...done." end dw.start unless options['serving'] trap("INT") do - puts "Stopping auto-regeneration..." + puts " Halting auto-regeneration." exit 0 end From f6d38def5a15eace447cdd2689a8ad29d8a3fd63 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 3 Feb 2013 21:30:52 +0100 Subject: [PATCH 029/120] Reworking errors with configuration file. --- lib/jekyll.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 948dc72f..0eb59924 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -131,16 +131,17 @@ module Jekyll config_file = File.join(source, '_config.yml') begin config = YAML.load_file(config_file) - raise "Invalid configuration file: #{config_file}" if !config.is_a?(Hash) - $stdout.puts "Configuration file: #{config_file}" + raise "Configuration file: (INVALID) #{config_file}" if !config.is_a?(Hash) + $stdout.puts "Configuration file: #{config_file}" + rescue SystemCallError + # Errno:ENOENT = file not found + $stderr.puts "Configuration file: none" + config = {} rescue => err - unless File.exists?(config_file) - $stdout.puts "Configuration file: none" - else - $stderr.puts "WARNING: Could not read configuration. " + - "Using defaults (and options)." - $stderr.puts "\t" + err.to_s - end + $stderr.puts " " + + "WARNING: Error reading configuration. " + + "Using defaults (and options)." + $stderr.puts "#{err}" config = {} end From a3d95957dd428d0dfc729c418dd9ef276cc90fb8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 3 Feb 2013 21:31:05 +0100 Subject: [PATCH 030/120] Updating tests for new config output. --- test/test_configuration.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 76e8a812..e896da1a 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -7,22 +7,21 @@ class TestConfiguration < Test::Unit::TestCase end should "fire warning with no _config.yml" do - mock(YAML).load_file(@path) { raise "No such file or directory - #{@path}" } - mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).") - mock($stderr).puts("\tNo such file or directory - #{@path}") + mock(YAML).load_file(@path) { raise SystemCallError, "No such file or directory - #{@path}" } + mock($stderr).puts("Configuration file: none") assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) end should "load configuration as hash" do mock(YAML).load_file(@path) { Hash.new } - mock($stdout).puts("Configuration from #{@path}") + mock($stdout).puts("Configuration file: #{@path}") assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) end should "fire warning with bad config" do mock(YAML).load_file(@path) { Array.new } - mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).") - mock($stderr).puts("\tInvalid configuration - #{@path}") + mock($stderr).puts(" WARNING: Error reading configuration. Using defaults (and options).") + mock($stderr).puts("Configuration file: (INVALID) #{@path}") assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) end end From 7512e6bb66d72ff4d3ae13f31e236850bb580180 Mon Sep 17 00:00:00 2001 From: Alexander Ekdahl Date: Mon, 4 Feb 2013 17:16:01 +0100 Subject: [PATCH 031/120] Allow symlinked folders in unsafe mode --- lib/jekyll/site.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 2deae484..22e08fd1 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -253,7 +253,7 @@ module Jekyll end # Private: creates a regular expression from the keep_files array - # + # # Examples # ['.git','.svn'] creates the following regex: /\/(\.git|\/.svn)/ # @@ -338,7 +338,7 @@ module Jekyll ['.', '_', '#'].include?(e[0..0]) || e[-1..-1] == '~' || self.exclude.glob_include?(e) || - File.symlink?(e) + (File.symlink?(e) & self.safe) end end end From 4cd7c22ee704fde1fe7f798674f1a68f07c743c3 Mon Sep 17 00:00:00 2001 From: Alexander Ekdahl Date: Mon, 4 Feb 2013 22:17:03 +0100 Subject: [PATCH 032/120] Now uses the more semantically correct AND operator --- lib/jekyll/site.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 22e08fd1..5c1bd74e 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -338,7 +338,7 @@ module Jekyll ['.', '_', '#'].include?(e[0..0]) || e[-1..-1] == '~' || self.exclude.glob_include?(e) || - (File.symlink?(e) & self.safe) + (File.symlink?(e) && self.safe) end end end From 8e48848b7ac882885507171b518456dd76251c69 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 7 Feb 2013 00:42:37 +0100 Subject: [PATCH 033/120] Removed migrate tasks from Rakefile. --- Rakefile | 31 +++++-------------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/Rakefile b/Rakefile index 9504dc1d..9e6389ad 100644 --- a/Rakefile +++ b/Rakefile @@ -63,32 +63,6 @@ Rake::RDocTask.new do |rdoc| rdoc.rdoc_files.include('lib/**/*.rb') end -desc "Open an irb session preloaded with this library" -task :console do - sh "irb -rubygems -r ./lib/#{name}.rb" -end - -############################################################################# -# -# Custom tasks (add your own tasks here) -# -############################################################################# - -namespace :migrate do - desc "Migrate from mephisto in the current directory" - task :mephisto do - sh %q(ruby -r './lib/jekyll/migrators/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["DB"]}")') - end - desc "Migrate from Movable Type in the current directory" - task :mt do - sh %q(ruby -r './lib/jekyll/migrators/mt' -e 'Jekyll::MT.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")') - end - desc "Migrate from Typo in the current directory" - task :typo do - sh %q(ruby -r './lib/jekyll/migrators/typo' -e 'Jekyll::Typo.process("#{ENV["DB"]}", "#{ENV["USER"]}", "#{ENV["PASS"]}")') - end -end - begin require 'cucumber/rake/task' Cucumber::Rake::Task.new(:features) do |t| @@ -101,6 +75,11 @@ rescue LoadError end end +desc "Open an irb session preloaded with this library" +task :console do + sh "irb -rubygems -r ./lib/#{name}.rb" +end + ############################################################################# # # Site tasks - http://jekyllrb.com From fae771d1a049fe826ebc60bbb6c212f51fc33d15 Mon Sep 17 00:00:00 2001 From: Aleksander Podlaski Date: Thu, 7 Feb 2013 07:21:55 +0100 Subject: [PATCH 034/120] Remove migrator files from jekyll.gemspec Some files no longer exists but was not removed from jekyll.gemspec: - lib/jekyll/commands/migrate.rb - lib/jekyll/migrators/*.rb --- jekyll.gemspec | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 7236e2c2..dcb2c909 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -70,7 +70,6 @@ Gem::Specification.new do |s| lib/jekyll.rb lib/jekyll/command.rb lib/jekyll/commands/build.rb - lib/jekyll/commands/migrate.rb lib/jekyll/commands/serve.rb lib/jekyll/converter.rb lib/jekyll/converters/identity.rb @@ -83,20 +82,6 @@ Gem::Specification.new do |s| lib/jekyll/generator.rb lib/jekyll/generators/pagination.rb lib/jekyll/layout.rb - lib/jekyll/migrators/csv.rb - lib/jekyll/migrators/drupal.rb - lib/jekyll/migrators/enki.rb - lib/jekyll/migrators/joomla.rb - lib/jekyll/migrators/marley.rb - lib/jekyll/migrators/mephisto.rb - lib/jekyll/migrators/mt.rb - lib/jekyll/migrators/posterous.rb - lib/jekyll/migrators/rss.rb - lib/jekyll/migrators/textpattern.rb - lib/jekyll/migrators/tumblr.rb - lib/jekyll/migrators/typo.rb - lib/jekyll/migrators/wordpress.rb - lib/jekyll/migrators/wordpressdotcom.rb lib/jekyll/page.rb lib/jekyll/plugin.rb lib/jekyll/post.rb From b4c5d707a51db339915d238f6318a7ee1c595187 Mon Sep 17 00:00:00 2001 From: Kevin Suttle Date: Thu, 7 Feb 2013 15:19:33 -0500 Subject: [PATCH 035/120] Bump .ruby-version to 1.9.3-p374 --- .ruby-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ruby-version b/.ruby-version index 74f5f164..311baaf3 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -1.9.3-p362 +1.9.3-p374 From 1ac46b17c43dbeead83b62bc6820dd8ebf96717a Mon Sep 17 00:00:00 2001 From: scribu Date: Sat, 9 Feb 2013 18:01:19 +0200 Subject: [PATCH 036/120] Don't require date in draft filenames. --- features/step_definitions/jekyll_steps.rb | 14 +++++--- lib/jekyll.rb | 1 + lib/jekyll/draft.rb | 22 +++++++++++++ lib/jekyll/post.rb | 5 ++- lib/jekyll/site.rb | 40 +++++++++++++++++++---- 5 files changed, 68 insertions(+), 14 deletions(-) create mode 100644 lib/jekyll/draft.rb diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 4c1b0cc1..1b0eb519 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -50,11 +50,8 @@ Given /^I have an? (.*) directory$/ do |dir| FileUtils.mkdir_p(dir) end -Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |type, direction, folder, table| - subdir = "_#{type}s" - +Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |status, direction, folder, table| table.hashes.each do |post| - date = Date.strptime(post['date'], '%m/%d/%Y').strftime('%Y-%m-%d') title = post['title'].downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-') if direction && direction == "in" @@ -63,7 +60,14 @@ Given /^I have the following (draft|post)s?(?: (.*) "(.*)")?:$/ do |type, direct after = folder || '.' end - path = File.join(before || '.', subdir, after || '.', "#{date}-#{title}.#{post['type'] || 'textile'}") + ext = post['type'] || 'textile' + + if "draft" == status + path = File.join(before || '.', '_drafts', after || '.', "#{title}.#{ext}") + else + date = Date.strptime(post['date'], '%m/%d/%Y').strftime('%Y-%m-%d') + path = File.join(before || '.', '_posts', after || '.', "#{date}-#{title}.#{ext}") + end matter_hash = {} %w(title layout tag tags category categories published author).each do |key| diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 477247dd..0fa50895 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -33,6 +33,7 @@ require 'jekyll/convertible' require 'jekyll/layout' require 'jekyll/page' require 'jekyll/post' +require 'jekyll/draft' require 'jekyll/filters' require 'jekyll/static_file' require 'jekyll/errors' diff --git a/lib/jekyll/draft.rb b/lib/jekyll/draft.rb new file mode 100644 index 00000000..43a47e4c --- /dev/null +++ b/lib/jekyll/draft.rb @@ -0,0 +1,22 @@ +module Jekyll + + class Draft < Post + + # Valid post name regex (no date) + MATCHER = /^(.*)(\.[^.]+)$/ + + # Extract information from the post filename. + # + # name - The String filename of the post file. + # + # Returns nothing. + def process(name) + slug, ext = *name.match(MATCHER) + self.date = File.mtime(File.join(@base, name)) + self.slug = slug + self.ext = ext + end + + end + +end diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index f94169b0..1386c6ef 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -30,12 +30,11 @@ module Jekyll # site - The Site. # base - The String path to the dir containing the post file. # name - The String filename of the post file. - # subdir - The String path to the subdirectory. # # Returns the new Post. - def initialize(site, source, dir, name, subdir = '_posts') + def initialize(site, source, dir, name) @site = site - @base = File.join(source, dir, subdir) + @base = File.join(source, dir) @name = name self.categories = dir.split('/').reject { |x| x.empty? } diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 636045be..55964bee 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -137,10 +137,10 @@ module Jekyll base = File.join(self.source, dir) entries = Dir.chdir(base) { filter_entries(Dir.entries('.')) } - self.read_posts(dir,'_posts') + self.read_posts(dir) if self.show_drafts - self.read_posts(dir,'_drafts') + self.read_drafts(dir) end self.posts.sort! @@ -174,18 +174,46 @@ module Jekyll # object with each one. # # dir - The String relative path of the directory to read. - # subdir - The String relative path of the subdirectory to read. # # Returns nothing. - def read_posts(dir, subdir) - base = File.join(self.source, dir, subdir) + def read_posts(dir) + dir = File.join(dir, '_posts') + + base = File.join(self.source, dir) return unless File.exists?(base) entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } # first pass processes, but does not yet render post content entries.each do |f| if Post.valid?(f) - post = Post.new(self, self.source, dir, f, subdir) + post = Post.new(self, self.source, dir, f) + + if post.published && (self.future || post.date <= self.time) + self.posts << post + post.categories.each { |c| self.categories[c] << post } + post.tags.each { |c| self.tags[c] << post } + end + end + end + end + + # Read all the files in //_drafts and create a new Post + # object with each one. + # + # dir - The String relative path of the directory to read. + # + # Returns nothing. + def read_drafts(dir) + dir = File.join(dir, '_drafts') + + base = File.join(self.source, dir) + return unless File.exists?(base) + entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } + + # first pass processes, but does not yet render post content + entries.each do |f| + if Post.valid?(f) + post = Draft.new(self, self.source, dir, f) if post.published && (self.future || post.date <= self.time) self.posts << post From 642349f797c41b2cd87f8774d7c598339c832a54 Mon Sep 17 00:00:00 2001 From: scribu Date: Sat, 9 Feb 2013 22:41:47 +0200 Subject: [PATCH 037/120] implement and use Draft.valid? --- lib/jekyll/draft.rb | 8 ++++++++ lib/jekyll/site.rb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/draft.rb b/lib/jekyll/draft.rb index 43a47e4c..a381d8e4 100644 --- a/lib/jekyll/draft.rb +++ b/lib/jekyll/draft.rb @@ -5,6 +5,14 @@ module Jekyll # Valid post name regex (no date) MATCHER = /^(.*)(\.[^.]+)$/ + # Draft name validator. Draft filenames must be like: + # my-awesome-post.textile + # + # Returns true if valid, false if not. + def self.valid?(name) + name =~ MATCHER + end + # Extract information from the post filename. # # name - The String filename of the post file. diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 55964bee..16e9ad40 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -212,7 +212,7 @@ module Jekyll # first pass processes, but does not yet render post content entries.each do |f| - if Post.valid?(f) + if Draft.valid?(f) post = Draft.new(self, self.source, dir, f) if post.published && (self.future || post.date <= self.time) From 78831d94cde90d4ed7422f436744f2c339458c1f Mon Sep 17 00:00:00 2001 From: scribu Date: Sat, 9 Feb 2013 22:49:49 +0200 Subject: [PATCH 038/120] don't mess with dir parameter --- lib/jekyll/draft.rb | 5 +++++ lib/jekyll/post.rb | 7 ++++++- lib/jekyll/site.rb | 8 ++------ test/test_site.rb | 2 +- test/test_tags.rb | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/jekyll/draft.rb b/lib/jekyll/draft.rb index a381d8e4..c28b7c2f 100644 --- a/lib/jekyll/draft.rb +++ b/lib/jekyll/draft.rb @@ -13,6 +13,11 @@ module Jekyll name =~ MATCHER end + # Get the full path to the directory containing the draft files + def get_base(source, dir) + return File.join(source, dir, '_drafts') + end + # Extract information from the post filename. # # name - The String filename of the post file. diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 1386c6ef..2a5bdafa 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -34,7 +34,7 @@ module Jekyll # Returns the new Post. def initialize(site, source, dir, name) @site = site - @base = File.join(source, dir) + @base = self.get_base(source, dir) @name = name self.categories = dir.split('/').reject { |x| x.empty? } @@ -65,6 +65,11 @@ module Jekyll end end + # Get the full path to the directory containing the post files + def get_base(source, dir) + return File.join(source, dir, '_posts') + end + # Read the YAML frontmatter. # # base - The String path to the dir containing the file. diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 16e9ad40..5d1bfd70 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -177,9 +177,7 @@ module Jekyll # # Returns nothing. def read_posts(dir) - dir = File.join(dir, '_posts') - - base = File.join(self.source, dir) + base = File.join(self.source, dir, '_posts') return unless File.exists?(base) entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } @@ -204,9 +202,7 @@ module Jekyll # # Returns nothing. def read_drafts(dir) - dir = File.join(dir, '_drafts') - - base = File.join(self.source, dir) + base = File.join(self.source, dir, '_drafts') return unless File.exists?(base) entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } diff --git a/test/test_site.rb b/test/test_site.rb index e0f90c44..c698a887 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -124,7 +124,7 @@ class TestSite < Test::Unit::TestCase end should "read posts" do - @site.read_posts('', '_posts') + @site.read_posts('') posts = Dir[source_dir('_posts', '*')] assert_equal posts.size - 1, @site.posts.size end diff --git a/test/test_tags.rb b/test/test_tags.rb index 286b1817..816fd809 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -11,7 +11,7 @@ class TestTags < Test::Unit::TestCase site = Site.new(Jekyll.configuration) if override['read_posts'] - site.read_posts('', '_posts') + site.read_posts('') end info = { :filters => [Jekyll::Filters], :registers => { :site => site } } From 2588d681c96679b3eafa2647759db73f13792bbd Mon Sep 17 00:00:00 2001 From: scribu Date: Sat, 9 Feb 2013 23:38:13 +0200 Subject: [PATCH 039/120] fix draft filename processing --- lib/jekyll/draft.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/draft.rb b/lib/jekyll/draft.rb index c28b7c2f..629efd64 100644 --- a/lib/jekyll/draft.rb +++ b/lib/jekyll/draft.rb @@ -24,7 +24,7 @@ module Jekyll # # Returns nothing. def process(name) - slug, ext = *name.match(MATCHER) + m, slug, ext = *name.match(MATCHER) self.date = File.mtime(File.join(@base, name)) self.slug = slug self.ext = ext From 3e164d6daf5b035cec672d06a3b12f09a00f151d Mon Sep 17 00:00:00 2001 From: scribu Date: Sat, 9 Feb 2013 23:47:17 +0200 Subject: [PATCH 040/120] don't check if draft is published or if its date is in the future --- lib/jekyll/site.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 5d1bfd70..ae9c9d30 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -206,16 +206,14 @@ module Jekyll return unless File.exists?(base) entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } - # first pass processes, but does not yet render post content + # first pass processes, but does not yet render draft content entries.each do |f| if Draft.valid?(f) - post = Draft.new(self, self.source, dir, f) + draft = Draft.new(self, self.source, dir, f) - if post.published && (self.future || post.date <= self.time) - self.posts << post - post.categories.each { |c| self.categories[c] << post } - post.tags.each { |c| self.tags[c] << post } - end + self.posts << draft + draft.categories.each { |c| self.categories[c] << draft } + draft.tags.each { |c| self.tags[c] << draft } end end end From 538c2086a58047d41cbb4e3eb3661bcef86e3601 Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 10 Feb 2013 04:49:27 +0200 Subject: [PATCH 041/120] whitespace fixes --- lib/jekyll/site.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index ae9c9d30..1f9bd565 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -5,8 +5,8 @@ module Jekyll class Site 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 + :permalink_style, :tags, :time, :future, :safe, :plugins, :limit_posts, + :show_drafts, :keep_files attr_accessor :converters, :generators @@ -173,7 +173,7 @@ module Jekyll # Read all the files in //_posts and create a new Post # object with each one. # - # dir - The String relative path of the directory to read. + # dir - The String relative path of the directory to read. # # Returns nothing. def read_posts(dir) @@ -198,7 +198,7 @@ module Jekyll # Read all the files in //_drafts and create a new Post # object with each one. # - # dir - The String relative path of the directory to read. + # dir - The String relative path of the directory to read. # # Returns nothing. def read_drafts(dir) From 311bcbb7ed99af23b3af94310e93f7515956a82a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristi=20Burc=C4=83?= Date: Sun, 10 Feb 2013 17:19:22 +0200 Subject: [PATCH 042/120] mention styleguide to new contributors --- CONTRIBUTING.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3135baf4..5245c868 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,6 +17,7 @@ following in mind: * If your contribution changes any Jekyll behavior, make sure to update the documentation. It lives in site/_posts. If the docs are missing information, please feel free to add it in. Great docs make a great project! +* Please follow the [Github Ruby Styleguide](https://github.com/styleguide/ruby) when modifying Ruby code. Test Dependencies ----------------- From 382b1b5a11590548aa6cee08c4cb8919571c70ca Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 10 Feb 2013 17:06:46 +0100 Subject: [PATCH 043/120] Updated History to reflect merge of #806 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 03ee23ec..3c6623d8 100644 --- a/History.txt +++ b/History.txt @@ -26,6 +26,7 @@ * Bring site into master branch with better preview/deploy (#709) * Redesigned site (#583) * Development fixes + * Including a link to the GitHub Ruby style guide in CONTRIBUTING.md (#806) * Added script/bootstrap (#776) * Running Simplecov under 2 conditions: ENV(COVERAGE)=true and with Ruby version of greater than 1.9 (#771) From 0c6d56365ae170b0c224d540c864e64a4b2c3fbe Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 10 Feb 2013 19:07:05 +0100 Subject: [PATCH 044/120] Upgrading to safe_yaml v0.7 --- jekyll.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index dcb2c909..87b5778e 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('kramdown', "~> 0.14.1") s.add_runtime_dependency('pygments.rb', "~> 0.3.2") s.add_runtime_dependency('commander', "~> 4.1.3") - s.add_runtime_dependency('safe_yaml', "~> 0.4") + s.add_runtime_dependency('safe_yaml', "~> 0.7") s.add_development_dependency('rake', "~> 10.0.3") s.add_development_dependency('rdoc', "~> 3.11") From 11eb1ecae16dee459053db5ff5d8d4800e2bec02 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 10 Feb 2013 19:07:38 +0100 Subject: [PATCH 045/120] Safe loading of files and YAML. --- lib/jekyll.rb | 4 +++- lib/jekyll/convertible.rb | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 2c1ab0e6..f58f3beb 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -48,6 +48,8 @@ require_all 'jekyll/converters' require_all 'jekyll/generators' require_all 'jekyll/tags' +SafeYAML::OPTIONS[:suppress_warnings] = true + module Jekyll VERSION = '0.12.0' @@ -130,7 +132,7 @@ module Jekyll # Get configuration from /_config.yml config_file = File.join(source, '_config.yml') begin - config = YAML.load_file(config_file) + config = YAML.safe_load_file(config_file) raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash) $stdout.puts "Configuration from #{config_file}" rescue => err diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index e71fe1bf..952fd670 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -30,7 +30,7 @@ module Jekyll if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m self.content = $POSTMATCH - self.data = YAML.load($1) + self.data = YAML.safe_load($1) end rescue => e puts "Error reading file #{File.join(base, name)}: #{e.message}" From c7c0a9432c08287d2f9f371d44fae88f039b01ef Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 10 Feb 2013 19:09:36 +0100 Subject: [PATCH 046/120] Updating tests for safe_yaml. --- test/test_configuration.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 76e8a812..49415de8 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -7,20 +7,20 @@ class TestConfiguration < Test::Unit::TestCase end should "fire warning with no _config.yml" do - mock(YAML).load_file(@path) { raise "No such file or directory - #{@path}" } + mock(YAML).safe_load_file(@path) { raise "No such file or directory - #{@path}" } mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).") mock($stderr).puts("\tNo such file or directory - #{@path}") assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) end should "load configuration as hash" do - mock(YAML).load_file(@path) { Hash.new } + mock(YAML).safe_load_file(@path) { Hash.new } mock($stdout).puts("Configuration from #{@path}") assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) end should "fire warning with bad config" do - mock(YAML).load_file(@path) { Array.new } + mock(YAML).safe_load_file(@path) { Array.new } mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).") mock($stderr).puts("\tInvalid configuration - #{@path}") assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) From 35c3ef05bfe9d1c07ec1efe91783659b5e18541e Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 10 Feb 2013 21:38:02 +0100 Subject: [PATCH 047/120] Update history to reflect merge of #801. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 3c6623d8..e7c0b0fe 100644 --- a/History.txt +++ b/History.txt @@ -26,6 +26,7 @@ * Bring site into master branch with better preview/deploy (#709) * Redesigned site (#583) * Development fixes + * Changed Ruby version for development to 1.9.3-p374 from p362 (#801) * Including a link to the GitHub Ruby style guide in CONTRIBUTING.md (#806) * Added script/bootstrap (#776) * Running Simplecov under 2 conditions: ENV(COVERAGE)=true and with Ruby version From ac8c7a0944541acda9e7d9c2215a97b56b75c373 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 19 Feb 2013 02:38:18 +0100 Subject: [PATCH 048/120] Relax Kramdown version to 0.14. Fixes #808. --- History.txt | 1 + jekyll.gemspec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/History.txt b/History.txt index e7c0b0fe..50bd5dca 100644 --- a/History.txt +++ b/History.txt @@ -3,6 +3,7 @@ * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements + * Relaxed Kramdown version to 0.14 (#808) * Aliased `jekyll server` to `jekyll serve`. (#792) * Updated gem versions for Kramdown, Rake, Shoulda, Cucumber, and RedCarpet. (#744) * Refactored jekyll subcommands into Jekyll::Commands submodule, which now contains them (#768) diff --git a/jekyll.gemspec b/jekyll.gemspec index dcb2c909..b5918bfb 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -27,7 +27,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('classifier', "~> 1.3") s.add_runtime_dependency('directory_watcher', "~> 1.1") s.add_runtime_dependency('maruku', "~> 0.5") - s.add_runtime_dependency('kramdown', "~> 0.14.1") + s.add_runtime_dependency('kramdown', "~> 0.14") s.add_runtime_dependency('pygments.rb', "~> 0.3.2") s.add_runtime_dependency('commander', "~> 4.1.3") s.add_runtime_dependency('safe_yaml', "~> 0.4") From 151ec1a487ad7e87abf7304b5cf0a8aedbba677c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 19 Feb 2013 12:02:10 +0100 Subject: [PATCH 049/120] Update history to reflect merge of #807. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 50bd5dca..97fdc6b9 100644 --- a/History.txt +++ b/History.txt @@ -3,6 +3,7 @@ * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements + * Fix SafeYAML Warnings (#807) * Relaxed Kramdown version to 0.14 (#808) * Aliased `jekyll server` to `jekyll serve`. (#792) * Updated gem versions for Kramdown, Rake, Shoulda, Cucumber, and RedCarpet. (#744) From 03e2e8d063a66400078e9e3ce0113eed6d2685ca Mon Sep 17 00:00:00 2001 From: Brett Hardin Date: Wed, 20 Feb 2013 09:37:19 -0800 Subject: [PATCH 050/120] Changing help message to reflect what actually happens when running build and serve --- bin/jekyll | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index a5ca0f52..35e35d01 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -19,7 +19,7 @@ global_option '--layouts', 'Layouts directory (defaults to ./_layouts)' command :build do |c| c.syntax = 'jekyll build [options]' - c.description = 'Build your site with the option of auto-renegeration' + c.description = 'Build your site' c.option '-w', '--watch', 'Watch for changes and rebuild' c.option '--lsi', 'Use LSI for improved related posts' @@ -33,7 +33,7 @@ end command :serve do |c| c.syntax = 'jekyll serve [options]' - c.description = 'Serve your site locally with the option of auto-regeneration' + c.description = 'Serve your site locally' c.option '-w', '--watch', 'Watch for changes and rebuild' c.option '--lsi', 'Use LSI for improved related posts' From d0d947995aefa5bc84209283e8628e9082ea27e4 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 20 Feb 2013 22:01:12 +0100 Subject: [PATCH 051/120] Update history to reflect merge of #815. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 97fdc6b9..ffb93a17 100644 --- a/History.txt +++ b/History.txt @@ -3,6 +3,7 @@ * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements + * Remove ambiguity from command descriptions (#815) * Fix SafeYAML Warnings (#807) * Relaxed Kramdown version to 0.14 (#808) * Aliased `jekyll server` to `jekyll serve`. (#792) From 090bbbe4f65f5eb30d282f136588f0d5c15c69e8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 20 Feb 2013 22:15:03 +0100 Subject: [PATCH 052/120] Update history to reflect merge of #788. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index ffb93a17..614c6960 100644 --- a/History.txt +++ b/History.txt @@ -3,6 +3,7 @@ * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements + * Reinstate --limit-posts and --future switches (#788) * Remove ambiguity from command descriptions (#815) * Fix SafeYAML Warnings (#807) * Relaxed Kramdown version to 0.14 (#808) From 388e0c80772a14fdb41dd9baf2e27ad2c9635126 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 20 Feb 2013 22:15:23 +0100 Subject: [PATCH 053/120] Fixed typo in History file --- History.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/History.txt b/History.txt index 614c6960..532f6837 100644 --- a/History.txt +++ b/History.txt @@ -3,7 +3,7 @@ * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements - * Reinstate --limit-posts and --future switches (#788) + * Reinstate --limit_posts and --future switches (#788) * Remove ambiguity from command descriptions (#815) * Fix SafeYAML Warnings (#807) * Relaxed Kramdown version to 0.14 (#808) From bf79b0ac37bf11ba8c1de38569ce4d242d8eaf6c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 20 Feb 2013 23:09:34 +0100 Subject: [PATCH 054/120] Fixed merge with new log output in lib/jekyll.rb --- lib/jekyll.rb | 14 +++++++++----- lib/jekyll/commands/build.rb | 6 ++++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index f58f3beb..b2ef5ad1 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -133,12 +133,16 @@ module Jekyll config_file = File.join(source, '_config.yml') begin config = YAML.safe_load_file(config_file) - raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash) - $stdout.puts "Configuration from #{config_file}" + raise "Invalid configuration file: #{config_file}" if !config.is_a?(Hash) + $stdout.puts "Configuration file: #{config_file}" rescue => err - $stderr.puts "WARNING: Could not read configuration. " + - "Using defaults (and options)." - $stderr.puts "\t" + err.to_s + unless File.exists?(config_file) + $stdout.puts "Configuration file: none" + else + $stderr.puts "WARNING: Could not read configuration. " + + "Using defaults (and options)." + $stderr.puts "\t" + err.to_s + end config = {} end diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index 0bb3c4f1..04942b77 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -23,7 +23,9 @@ module Jekyll def self.build(site, options) source = options['source'] destination = options['destination'] - puts "Building site: #{source} -> #{destination}" + puts " Source: #{source}" + puts " Destination: #{destination}" + print " Generating... " begin site.process rescue Jekyll::FatalException => e @@ -33,7 +35,7 @@ module Jekyll puts e.message exit(1) end - puts "Successfully generated site: #{source} -> #{destination}" + puts "done." end # Private: Watch for file changes and rebuild the site. From 9eb79ff135427d589f9ae22078036be971a0df71 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 3 Feb 2013 20:36:34 +0100 Subject: [PATCH 055/120] Improved output for auto-regeneration. --- lib/jekyll/commands/build.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index 04942b77..f85b65e7 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -50,7 +50,9 @@ module Jekyll source = options['source'] destination = options['destination'] - puts "Auto-Regenerating enabled: #{source} -> #{destination}" + puts " Source: #{source}" + puts " Destination: #{destination}" + puts " Auto-regeneration: enabled" dw = DirectoryWatcher.new(source) dw.interval = 1 @@ -58,15 +60,16 @@ module Jekyll dw.add_observer do |*args| t = Time.now.strftime("%Y-%m-%d %H:%M:%S") - puts "[#{t}] regeneration: #{args.size} files changed" + print " Regenerating: #{args.size} files at #{t} " site.process + puts "...done." end dw.start unless options['serving'] trap("INT") do - puts "Stopping auto-regeneration..." + puts " Halting auto-regeneration." exit 0 end From 5d8e0128997aa6303aab5aa411479b4f26d46e9e Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 20 Feb 2013 23:10:42 +0100 Subject: [PATCH 056/120] Fixed merge with new log output in lib/jekyll.rb --- lib/jekyll.rb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index b2ef5ad1..a669c911 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -133,16 +133,17 @@ module Jekyll config_file = File.join(source, '_config.yml') begin config = YAML.safe_load_file(config_file) - raise "Invalid configuration file: #{config_file}" if !config.is_a?(Hash) - $stdout.puts "Configuration file: #{config_file}" + raise "Configuration file: (INVALID) #{config_file}" if !config.is_a?(Hash) + $stdout.puts "Configuration file: #{config_file}" + rescue SystemCallError + # Errno:ENOENT = file not found + $stderr.puts "Configuration file: none" + config = {} rescue => err - unless File.exists?(config_file) - $stdout.puts "Configuration file: none" - else - $stderr.puts "WARNING: Could not read configuration. " + - "Using defaults (and options)." - $stderr.puts "\t" + err.to_s - end + $stderr.puts " " + + "WARNING: Error reading configuration. " + + "Using defaults (and options)." + $stderr.puts "#{err}" config = {} end From a19bb1815aaf10270e006b667145b860e215054c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 20 Feb 2013 23:13:06 +0100 Subject: [PATCH 057/120] Fixed merge conflicts in test/test_configuration.rb --- test/test_configuration.rb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 49415de8..abaf6117 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -7,22 +7,21 @@ class TestConfiguration < Test::Unit::TestCase end should "fire warning with no _config.yml" do - mock(YAML).safe_load_file(@path) { raise "No such file or directory - #{@path}" } - mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).") - mock($stderr).puts("\tNo such file or directory - #{@path}") + mock(YAML).safe_load_file(@path) { raise SystemCallError, "No such file or directory - #{@path}" } + mock($stderr).puts("Configuration file: none") assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) end should "load configuration as hash" do mock(YAML).safe_load_file(@path) { Hash.new } - mock($stdout).puts("Configuration from #{@path}") + mock($stdout).puts("Configuration file: #{@path}") assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) end should "fire warning with bad config" do mock(YAML).safe_load_file(@path) { Array.new } - mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).") - mock($stderr).puts("\tInvalid configuration - #{@path}") + mock($stderr).puts(" WARNING: Error reading configuration. Using defaults (and options).") + mock($stderr).puts("Configuration file: (INVALID) #{@path}") assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) end end From a22527c7ff898ceca4b2f8c6c3ef9cf84c01d2ee Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 20 Feb 2013 23:16:56 +0100 Subject: [PATCH 058/120] Update history to reflect merge of #795. Fixes #790. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 532f6837..eda3c50d 100644 --- a/History.txt +++ b/History.txt @@ -3,6 +3,7 @@ * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements + * New format to Jekyll output (#795) * Reinstate --limit_posts and --future switches (#788) * Remove ambiguity from command descriptions (#815) * Fix SafeYAML Warnings (#807) From 7457cbae2544b0b85beb118e3ca9b62bcb44d7f1 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 22 Feb 2013 00:59:44 +0100 Subject: [PATCH 059/120] Fix issue with watching (auto-regeneration) continuously running if destination is not '_site'. #457. --- lib/jekyll/command.rb | 4 ++-- lib/jekyll/commands/build.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/command.rb b/lib/jekyll/command.rb index f7f0fa6b..bbc9e8a6 100644 --- a/lib/jekyll/command.rb +++ b/lib/jekyll/command.rb @@ -1,9 +1,9 @@ module Jekyll class Command - def self.globs(source) + def self.globs(source, destination) Dir.chdir(source) do dirs = Dir['*'].select { |x| File.directory?(x) } - dirs -= ['_site'] + dirs -= [destination] dirs = dirs.map { |x| "#{x}/**/*" } dirs += ['*'] end diff --git a/lib/jekyll/commands/build.rb b/lib/jekyll/commands/build.rb index f85b65e7..181316d2 100644 --- a/lib/jekyll/commands/build.rb +++ b/lib/jekyll/commands/build.rb @@ -56,7 +56,7 @@ module Jekyll dw = DirectoryWatcher.new(source) dw.interval = 1 - dw.glob = self.globs(source) + dw.glob = self.globs(source, destination) dw.add_observer do |*args| t = Time.now.strftime("%Y-%m-%d %H:%M:%S") From cc0f84197afc4b73781e2a800ea4d1990605981b Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 22 Feb 2013 14:20:05 +0100 Subject: [PATCH 060/120] Updated history to reflect merge of #820. --- History.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/History.txt b/History.txt index eda3c50d..57143b04 100644 --- a/History.txt +++ b/History.txt @@ -26,7 +26,7 @@ * Force Categories to be Strings (#767) * Safe YAML plugin to prevent vulnerability (#777) * Add SVG support to Jekyll/WEBrick. (#407, #406) - * Prevent custom destination from causing continuous regen (#528) + * Prevent custom destination from causing continuous regen on watch (#528, #820) * Site Enhancements * Bring site into master branch with better preview/deploy (#709) * Redesigned site (#583) From 425f46684203b8c3d7a5c51d1ddd76b594c95cd0 Mon Sep 17 00:00:00 2001 From: sterebooster Date: Sun, 24 Feb 2013 00:38:10 +0100 Subject: [PATCH 061/120] 'gist' liquid tag by @stereobooster. Fixes #463. --- lib/jekyll/tags/gist.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/jekyll/tags/gist.rb diff --git a/lib/jekyll/tags/gist.rb b/lib/jekyll/tags/gist.rb new file mode 100644 index 00000000..e7d79302 --- /dev/null +++ b/lib/jekyll/tags/gist.rb @@ -0,0 +1,19 @@ +# Gist Liquid Tag +# +# Example: +# {% gist 1234567 %} + +module Jekyll + class GistTag < Liquid::Tag + def initialize(tag_name, gist, tokens) + super + @gist = gist + end + + def render(context) + "" + end + end +end + +Liquid::Template.register_tag('gist', Jekyll::GistTag) From 7e7cee6e56595cd17e88e767bb6aaf590584997f Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 24 Feb 2013 00:57:58 +0100 Subject: [PATCH 062/120] Strip space from the gist number, add test for gist tag --- lib/jekyll/tags/gist.rb | 4 ++-- test/test_tags.rb | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/tags/gist.rb b/lib/jekyll/tags/gist.rb index e7d79302..f881dd56 100644 --- a/lib/jekyll/tags/gist.rb +++ b/lib/jekyll/tags/gist.rb @@ -7,11 +7,11 @@ module Jekyll class GistTag < Liquid::Tag def initialize(tag_name, gist, tokens) super - @gist = gist + @gist = gist.strip end def render(context) - "" + "" end end end diff --git a/test/test_tags.rb b/test/test_tags.rb index 3d97410b..f58475b0 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -203,4 +203,22 @@ CONTENT assert_match %r{/2008/11/21/complex/}, @result end end + + context "simple gist inclusion" do + setup do + @gist = 358471 + content = < 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true}) + end + + should "write script tag" do + assert_match %r{}, @result + end + end end From cdd3c0ef0c8a69ef56bc297f5a99f849fe7eb297 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 24 Feb 2013 01:30:41 +0100 Subject: [PATCH 063/120] Remove 'type' attribute from script tag in gist liquid tag. --- lib/jekyll/tags/gist.rb | 2 +- test/test_tags.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/tags/gist.rb b/lib/jekyll/tags/gist.rb index f881dd56..87a3f52f 100644 --- a/lib/jekyll/tags/gist.rb +++ b/lib/jekyll/tags/gist.rb @@ -11,7 +11,7 @@ module Jekyll end def render(context) - "" + "" end end end diff --git a/test/test_tags.rb b/test/test_tags.rb index f58475b0..783bb531 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -218,7 +218,7 @@ CONTENT end should "write script tag" do - assert_match %r{}, @result + assert_match %r{}, @result end end end From f8a90d711f6b69e00b89a46de89f155f9a98f8f3 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 24 Feb 2013 01:54:13 +0100 Subject: [PATCH 064/120] Using https protocol instead of http. --- lib/jekyll/tags/gist.rb | 2 +- test/test_tags.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/tags/gist.rb b/lib/jekyll/tags/gist.rb index 87a3f52f..d3eb0b37 100644 --- a/lib/jekyll/tags/gist.rb +++ b/lib/jekyll/tags/gist.rb @@ -11,7 +11,7 @@ module Jekyll end def render(context) - "" + "" end end end diff --git a/test/test_tags.rb b/test/test_tags.rb index 783bb531..caefb9ac 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -218,7 +218,7 @@ CONTENT end should "write script tag" do - assert_match %r{}, @result + assert_match %r{}, @result end end end From 83675ee0958150f1252eee898321e22b6091a563 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 24 Feb 2013 02:01:10 +0100 Subject: [PATCH 065/120] Updated history to reflect merge of #822. --- History.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/History.txt b/History.txt index 57143b04..57c8b831 100644 --- a/History.txt +++ b/History.txt @@ -3,7 +3,8 @@ * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements - * New format to Jekyll output (#795) + * Add 'gist' liquid tag to core (#822) + * New format of Jekyll output (#795) * Reinstate --limit_posts and --future switches (#788) * Remove ambiguity from command descriptions (#815) * Fix SafeYAML Warnings (#807) From ffc42310b43d8e28c85bc8011ae820df7e3ab50c Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Mon, 25 Feb 2013 13:19:45 -0600 Subject: [PATCH 066/120] Add back a test that was mistakenly removed. --- test/test_site.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/test_site.rb b/test/test_site.rb index 9219e102..5c3c0c74 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -11,6 +11,11 @@ class TestSite < Test::Unit::TestCase site = Site.new(Jekyll::DEFAULTS.merge({'source' => source_dir})) assert_equal [File.join(source_dir, '_plugins')], site.plugins end + + should "have an array for plugins if passed as a string" do + site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => '/tmp/plugins'})) + assert_equal ['/tmp/plugins'], site.plugins + end should "have an array for plugins if passed as an array" do site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => ['/tmp/plugins', '/tmp/otherplugins']})) From 5a9c20983d5e6af7a010d2be75bf508786c53206 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Mon, 25 Feb 2013 13:20:32 -0600 Subject: [PATCH 067/120] Rename setup_plugins to plugins_path --- lib/jekyll/site.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index aa42b470..bc6330ec 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -18,7 +18,7 @@ module Jekyll self.safe = config['safe'] self.source = File.expand_path(config['source']) self.dest = File.expand_path(config['destination']) - self.plugins = setup_plugins + self.plugins = plugins_path self.lsi = config['lsi'] self.pygments = config['pygments'] self.permalink_style = config['permalink'].to_sym @@ -104,7 +104,7 @@ module Jekyll # # # Returns an Array of plugin search paths - def setup_plugins + def plugins_path if (config['plugins'] == Jekyll::DEFAULTS['plugins']) [File.join(self.source, config['plugins'])] else From d58859570d571310b6d92dcd757a897b7d8a5069 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Mon, 25 Feb 2013 13:21:41 -0600 Subject: [PATCH 068/120] Fix up the whitespace. Remove an extra blank line and fix another whitespace error pointed out by git diff --- lib/jekyll/site.rb | 3 +-- test/test_site.rb | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index bc6330ec..74ebd112 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -100,8 +100,7 @@ module Jekyll end end - # Internal: Setup the plugin search path - # + # Internal: Setup the plugin search path # # Returns an Array of plugin search paths def plugins_path diff --git a/test/test_site.rb b/test/test_site.rb index 5c3c0c74..64cc8437 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -11,7 +11,7 @@ class TestSite < Test::Unit::TestCase site = Site.new(Jekyll::DEFAULTS.merge({'source' => source_dir})) assert_equal [File.join(source_dir, '_plugins')], site.plugins end - + should "have an array for plugins if passed as a string" do site = Site.new(Jekyll::DEFAULTS.merge({'plugins' => '/tmp/plugins'})) assert_equal ['/tmp/plugins'], site.plugins From 3253e4132e1b8704108da8b29301a1ba900fbfbb Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 26 Feb 2013 21:35:48 +0100 Subject: [PATCH 069/120] Update history to reflect merge of #654 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 57c8b831..37b327c6 100644 --- a/History.txt +++ b/History.txt @@ -22,6 +22,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * Look for plugins under the source directory (#654) * Tumblr Migrator: finds _posts dir correctly, fixes truncation of long post names (#775) * Force Categories to be Strings (#767) From 849c34e913b6ed65991e95c830ea5f8de41e0a30 Mon Sep 17 00:00:00 2001 From: Paul Leitmanis Date: Wed, 27 Feb 2013 10:39:46 +1100 Subject: [PATCH 070/120] Add tests for filtering symlink entries when safe mode enabled --- test/test_site.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test_site.rb b/test/test_site.rb index c698a887..bc6ddb93 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -166,6 +166,22 @@ class TestSite < Test::Unit::TestCase assert_equal files, @site.filter_entries(files) end + should "filter symlink entries when safe mode enabled" do + stub(Jekyll).configuration do + Jekyll::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 + context 'error handling' do should "raise if destination is included in source" do stub(Jekyll).configuration do From 3fbb615d19cce9b5dc5bae456309dfe3091467e8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 27 Feb 2013 01:56:06 +0100 Subject: [PATCH 071/120] Update history to reflect merge of #824. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 37b327c6..76824a3f 100644 --- a/History.txt +++ b/History.txt @@ -3,6 +3,7 @@ * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements + * Allow symlinked files in unsafe mode (#824) * Add 'gist' liquid tag to core (#822) * New format of Jekyll output (#795) * Reinstate --limit_posts and --future switches (#788) From c648bc1157262a89f2f8d3cd66be965d13996e3d Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 27 Feb 2013 01:59:36 +0100 Subject: [PATCH 072/120] Update history to reflect merge of #785. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 76824a3f..570f8727 100644 --- a/History.txt +++ b/History.txt @@ -3,6 +3,7 @@ * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Minor Enhancements + * Improve debugability of error message for a malformed highlight tag (#785) * Allow symlinked files in unsafe mode (#824) * Add 'gist' liquid tag to core (#822) * New format of Jekyll output (#795) From 3a34957b41b04cb30a9f9b9cf2b2c0b30721ce66 Mon Sep 17 00:00:00 2001 From: chapmajs Date: Wed, 27 Feb 2013 20:28:09 -0500 Subject: [PATCH 073/120] Explicitly require HTTPS rubygems source Use HTTPS rubygems.org source to help prevent MITM attacks --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index e45e65f8..851fabc2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,2 +1,2 @@ -source :rubygems +source 'https://rubygems.org' gemspec From 441eddf1caf9905aa1a909a229c2045832da000b Mon Sep 17 00:00:00 2001 From: Fotos Georgiadis Date: Thu, 28 Feb 2013 03:49:39 +0200 Subject: [PATCH 074/120] Fix pretty url style paths. Ignore the basename if the page is an index page, preserve it if it's just an html page and use the full path in every other case. --- lib/jekyll/page.rb | 10 ++++++++-- test/test_page.rb | 9 +++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index faf340b8..b20bee22 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -45,8 +45,14 @@ module Jekyll # # Returns the template String. def template - if self.site.permalink_style == :pretty && !index? && html? - "/:path/:basename/" + if self.site.permalink_style == :pretty + if index? && html? + "/:path/" + elsif html? + "/:path/:basename/" + else + "/:path/:basename:output_ext" + end else "/:path/:basename:output_ext" end diff --git a/test/test_page.rb b/test/test_page.rb index 6d4bef2a..8d13cda7 100644 --- a/test/test_page.rb +++ b/test/test_page.rb @@ -64,8 +64,13 @@ class TestPage < Test::Unit::TestCase context "in a directory hierarchy" do should "create url based on filename" do + @page = setup_page('/contacts', 'bar.html') + assert_equal "/contacts/bar/", @page.url + end + + should "create index url based on filename" do @page = setup_page('/contacts', 'index.html') - assert_equal "/contacts/index.html", @page.url + assert_equal "/contacts/", @page.url end should "return dir correctly" do @@ -75,7 +80,7 @@ class TestPage < Test::Unit::TestCase should "return dir correctly for index page" do @page = setup_page('/contacts', 'index.html') - assert_equal '/contacts', @page.dir + assert_equal '/contacts/', @page.dir end end end From 5c788582a875dba625c161e2074cf6b39783a1ce Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 28 Feb 2013 21:57:01 +0100 Subject: [PATCH 075/120] Update history to reflect merge of #826. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 570f8727..d4703de5 100644 --- a/History.txt +++ b/History.txt @@ -35,6 +35,7 @@ * Bring site into master branch with better preview/deploy (#709) * Redesigned site (#583) * Development fixes + * Explicitly require HTTPS rubygems source in Gemfile (#826) * Changed Ruby version for development to 1.9.3-p374 from p362 (#801) * Including a link to the GitHub Ruby style guide in CONTRIBUTING.md (#806) * Added script/bootstrap (#776) From 053373de2790390ac3be0d56a30cdb21cf67aacb Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Sat, 2 Mar 2013 13:00:37 +0100 Subject: [PATCH 076/120] Update Readme to link to the Plugins wiki page --- README.textile | 1 + 1 file changed, 1 insertion(+) diff --git a/README.textile b/README.textile index 80ca6220..7dfa4d83 100644 --- a/README.textile +++ b/README.textile @@ -21,6 +21,7 @@ h2. Diving In * Put information on your site with "Template Data":http://wiki.github.com/mojombo/jekyll/template-data * Customize the "Permalinks":http://wiki.github.com/mojombo/jekyll/permalinks your posts are generated with * Use the built-in "Liquid Extensions":http://wiki.github.com/mojombo/jekyll/liquid-extensions to make your life easier +* Use custom "Plugins":https://github.com/mojombo/jekyll/wiki/Plugins to generate content specific to your site h2. Runtime Dependencies From 17c875f6f58d14db06f7a25ee68220fe2c0778ee Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 2 Mar 2013 18:51:42 +0100 Subject: [PATCH 077/120] Fixed plugin test error. --- .ruby-version | 2 +- test/test_site.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.ruby-version b/.ruby-version index 311baaf3..e46f9183 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -1.9.3-p374 +1.8.7-p371 diff --git a/test/test_site.rb b/test/test_site.rb index 84fc5c41..a6b5c2f4 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -8,7 +8,7 @@ class TestSite < Test::Unit::TestCase end should "look for plugins under the site directory by default" do - site = Site.new(Jekyll::DEFAULTS.merge({'source' => source_dir})) + site = Site.new(Jekyll::DEFAULTS.merge({'source' => File.expand_path(source_dir)})) assert_equal [File.join(source_dir, '_plugins')], site.plugins end From 1a351284ca4cb4a37031bfcd084e5437559f69c4 Mon Sep 17 00:00:00 2001 From: scribu Date: Sun, 3 Mar 2013 12:56:12 +0200 Subject: [PATCH 078/120] rename get_base() to containing_dir() --- lib/jekyll/draft.rb | 2 +- lib/jekyll/post.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/draft.rb b/lib/jekyll/draft.rb index 629efd64..32457fac 100644 --- a/lib/jekyll/draft.rb +++ b/lib/jekyll/draft.rb @@ -14,7 +14,7 @@ module Jekyll end # Get the full path to the directory containing the draft files - def get_base(source, dir) + def containing_dir(source, dir) return File.join(source, dir, '_drafts') end diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index 2a5bdafa..e4703c0d 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -34,7 +34,7 @@ module Jekyll # Returns the new Post. def initialize(site, source, dir, name) @site = site - @base = self.get_base(source, dir) + @base = self.containing_dir(source, dir) @name = name self.categories = dir.split('/').reject { |x| x.empty? } @@ -66,7 +66,7 @@ module Jekyll end # Get the full path to the directory containing the post files - def get_base(source, dir) + def containing_dir(source, dir) return File.join(source, dir, '_posts') end From cc83501489c41c96b35ea26b55f7df31faf65dee Mon Sep 17 00:00:00 2001 From: Daniel Hilgarth Date: Sun, 3 Mar 2013 14:56:18 +0100 Subject: [PATCH 079/120] Fix broken post_url with posts with a time in their YAML front matter. --- lib/jekyll/post.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index b8d0ad55..c2d70199 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -79,12 +79,15 @@ module Jekyll # Compares Post objects. First compares the Post date. If the dates are # equal, it compares the Post slugs. + # This comparison is used to create internal links using post_url. + # Post filenames are without a time, but the date property in the YAML + # front matter can be with time, so we compare only the date here. # # other - The other Post we are comparing to. # # Returns -1, 0, 1 def <=>(other) - cmp = self.date <=> other.date + cmp = self.date.to_date <=> other.date.to_date if 0 == cmp cmp = self.slug <=> other.slug end From ce8e1afba6574c1e2de651798c02be4e308c7dd6 Mon Sep 17 00:00:00 2001 From: Daniel Hilgarth Date: Sun, 3 Mar 2013 15:12:21 +0100 Subject: [PATCH 080/120] Add support for Ruby < 1.9 --- lib/jekyll/post.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index c2d70199..ab912d82 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -87,7 +87,9 @@ module Jekyll # # Returns -1, 0, 1 def <=>(other) - cmp = self.date.to_date <=> other.date.to_date + cmp = self.date.year <=> other.date.year + cmp = self.date.month <=> other.date.month if cmp == 0 + cmp = self.date.day <=> other.date.day if cmp == 0 if 0 == cmp cmp = self.slug <=> other.slug end From 87f6f8c971e1930fe37b82ffd76c19d57c4d485e Mon Sep 17 00:00:00 2001 From: Daniel Hilgarth Date: Sun, 3 Mar 2013 15:36:16 +0100 Subject: [PATCH 081/120] Fix invalid ordering of posts published on the same day and move post_url specific comparison of posts where it belongs: Into post_url --- lib/jekyll/post.rb | 7 +------ lib/jekyll/tags/post_url.rb | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/lib/jekyll/post.rb b/lib/jekyll/post.rb index ab912d82..b8d0ad55 100644 --- a/lib/jekyll/post.rb +++ b/lib/jekyll/post.rb @@ -79,17 +79,12 @@ module Jekyll # Compares Post objects. First compares the Post date. If the dates are # equal, it compares the Post slugs. - # This comparison is used to create internal links using post_url. - # Post filenames are without a time, but the date property in the YAML - # front matter can be with time, so we compare only the date here. # # other - The other Post we are comparing to. # # Returns -1, 0, 1 def <=>(other) - cmp = self.date.year <=> other.date.year - cmp = self.date.month <=> other.date.month if cmp == 0 - cmp = self.date.day <=> other.date.day if cmp == 0 + cmp = self.date <=> other.date if 0 == cmp cmp = self.slug <=> other.slug end diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb index ff4a29b8..008c12a2 100644 --- a/lib/jekyll/tags/post_url.rb +++ b/lib/jekyll/tags/post_url.rb @@ -23,7 +23,7 @@ module Jekyll site = context.registers[:site] site.posts.each do |p| - if p == @post + if p.slug == @post.slug and p.date.year == @post.date.year and p.date.month == @post.date.month and p.date.day == @post.date.day return p.url end end From 197f52b0e6b2b1d885932f4ebbf85413188cdc6f Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Sun, 3 Mar 2013 12:51:25 -0800 Subject: [PATCH 082/120] Fix jekyll-import LoadError message. --- bin/jekyll | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index d20c6018..37fdd312 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -63,6 +63,7 @@ command :import do |c| c.syntax = 'jekyll import [options]' c.description = 'Import your old blog to Jekyll' + c.option '--source', 'Source file or URL to migrate from' c.option '--file', 'File to migrate from' c.option '--dbname', 'Database name to migrate from' c.option '--user', 'Username to use when migrating' @@ -72,8 +73,11 @@ command :import do |c| c.action do |args, options| begin require 'jekyll-import' - rescue - abort "You must install the 'jekyll-import' gem before continuing." + 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`." + abort msg end Jekyll::Commands::Import.process(args.first, options) end From ef9388684b35f22cff66fc9e25b01fbc37135701 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Sun, 3 Mar 2013 18:04:31 -0800 Subject: [PATCH 083/120] Turn off debug mode on feature to suppress output. --- features/create_sites.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/create_sites.feature b/features/create_sites.feature index 438ee358..cbdfb64b 100644 --- a/features/create_sites.feature +++ b/features/create_sites.feature @@ -89,7 +89,7 @@ Feature: Create sites And I have an "_includes/about.textile" file that contains "Generated by {% include jekyll.textile %}" And I have an "_includes/jekyll.textile" file that contains "Jekyll" And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}" - When I debug jekyll + When I run jekyll Then the _site directory should exist And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html" From a4e37c9d0ac52eb6383c8800ad9f821395a79452 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 4 Mar 2013 03:12:31 +0100 Subject: [PATCH 084/120] Change default format to pretty and create travis profile --- cucumber.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cucumber.yml b/cucumber.yml index ff1d0580..78342a17 100644 --- a/cucumber.yml +++ b/cucumber.yml @@ -1,2 +1,3 @@ -default: --format progress +default: --format pretty +travis: --format progress html_report: --format progress --format html --out=features_report.html From 6cef28ed589318f3ef779dd840a68b4498e92ac8 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 4 Mar 2013 03:13:06 +0100 Subject: [PATCH 085/120] Add features:html task to Rakefile, use cucumber profiles --- Rakefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 9e6389ad..3b41504f 100644 --- a/Rakefile +++ b/Rakefile @@ -66,7 +66,10 @@ end begin require 'cucumber/rake/task' Cucumber::Rake::Task.new(:features) do |t| - t.cucumber_opts = "--format progress" + t.profile = "travis" + end + Cucumber::Rake::Task.new(:"features:html", "Run Cucumber features and produce HTML output") do |t| + t.profile = "html_report" end rescue LoadError desc 'Cucumber rake task not available' From 800bd290ec0dee592bb88c90be3fa5f5d95d5985 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 4 Mar 2013 03:19:57 +0100 Subject: [PATCH 086/120] Update history to reflect merge of #831 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index d4703de5..7c57c5ad 100644 --- a/History.txt +++ b/History.txt @@ -24,6 +24,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * Fix broken post_url with posts with a time in their YAML Front-Matter (#831) * Look for plugins under the source directory (#654) * Tumblr Migrator: finds _posts dir correctly, fixes truncation of long post names (#775) From 5af8e1f40ce4f2e319a87c594b152f8bc315866d Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 4 Mar 2013 03:20:59 +0100 Subject: [PATCH 087/120] Applying a more 'Ruby' style to post_url.rb --- lib/jekyll/tags/post_url.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb index 008c12a2..b9be4ab5 100644 --- a/lib/jekyll/tags/post_url.rb +++ b/lib/jekyll/tags/post_url.rb @@ -23,8 +23,12 @@ module Jekyll site = context.registers[:site] site.posts.each do |p| - if p.slug == @post.slug and p.date.year == @post.date.year and p.date.month == @post.date.month and p.date.day == @post.date.day - return p.url + if p.slug == @post.slug + and p.date.year == @post.date.year + and p.date.month == @post.date.month + and p.date.day == @post.date.day + + p.url end end From 2b9b61368745f85d0255ac50042922662733d818 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Sun, 3 Mar 2013 18:23:02 -0800 Subject: [PATCH 088/120] Normalize CLI options to match configuration expectations. --- bin/jekyll | 19 +++++++++++++++++-- lib/jekyll/site.rb | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bin/jekyll b/bin/jekyll index 0855ff03..d135b952 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -17,6 +17,19 @@ global_option '--safe', 'Safe mode (defaults to false)' global_option '--plugins', 'Plugins directory (defaults to ./_plugins)' global_option '--layouts', 'Layouts directory (defaults to ./_layouts)' +# Option names don't always directly match the configuration value we'd like. +# This method will rename options to match what Jekyll configuration expects. +# +# options - The Hash of options from Commander. +# +# Returns the normalized Hash. +def normalize_options(options) + if drafts_state = options.delete(:drafts) + options[:show_drafts] = drafts_state + end + options +end + command :build do |c| c.syntax = 'jekyll build [options]' c.description = 'Build your site' @@ -29,7 +42,8 @@ command :build do |c| c.action do |args, options| options.defaults :serving => false - options = Jekyll.configuration(options.__hash__) + options = normalize_options(options.__hash__) + options = Jekyll.configuration(options) Jekyll::Commands::Build.process(options) end end @@ -54,7 +68,8 @@ command :serve do |c| :baseurl => '/', :serving => true - options = Jekyll.configuration(options.__hash__) + options = normalize_options(options.__hash__) + options = Jekyll.configuration(options) Jekyll::Commands::Build.process(options) Jekyll::Commands::Serve.process(options) end diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index ad85d42f..18488431 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -25,7 +25,7 @@ module Jekyll self.exclude = config['exclude'] || [] self.include = config['include'] || [] self.future = config['future'] - self.show_drafts = config['drafts'] || nil + self.show_drafts = config['show_drafts'] || nil self.limit_posts = config['limit_posts'] || nil self.keep_files = config['keep_files'] || [] From ee057a99a7656dce066f3ae924d2be9f7a4b12a7 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 4 Mar 2013 03:24:26 +0100 Subject: [PATCH 089/120] Update history to reflect merge of #832. --- History.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/History.txt b/History.txt index 7c57c5ad..c94dea63 100644 --- a/History.txt +++ b/History.txt @@ -36,6 +36,8 @@ * Bring site into master branch with better preview/deploy (#709) * Redesigned site (#583) * Development fixes + * Added "features:html" rake task for debugging purposes, cleaned up + cucumber profiles (#832) * Explicitly require HTTPS rubygems source in Gemfile (#826) * Changed Ruby version for development to 1.9.3-p374 from p362 (#801) * Including a link to the GitHub Ruby style guide in CONTRIBUTING.md (#806) From 0d3ea5b71054d5e316b8f573ed9046dd739ef6bf Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 4 Mar 2013 03:41:18 +0100 Subject: [PATCH 090/120] Forgot to escape newlines. --- lib/jekyll/tags/post_url.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/tags/post_url.rb b/lib/jekyll/tags/post_url.rb index b9be4ab5..6dbec9be 100644 --- a/lib/jekyll/tags/post_url.rb +++ b/lib/jekyll/tags/post_url.rb @@ -23,12 +23,12 @@ module Jekyll site = context.registers[:site] site.posts.each do |p| - if p.slug == @post.slug - and p.date.year == @post.date.year - and p.date.month == @post.date.month + if p.slug == @post.slug \ + and p.date.year == @post.date.year \ + and p.date.month == @post.date.month \ and p.date.day == @post.date.day - p.url + return p.url end end From b46000f6afc3d9632ad870f85f24cd40990e3de9 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Sun, 3 Mar 2013 18:43:54 -0800 Subject: [PATCH 091/120] Kill unnecessary return keyword. --- lib/jekyll/draft.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/draft.rb b/lib/jekyll/draft.rb index 32457fac..321a6e58 100644 --- a/lib/jekyll/draft.rb +++ b/lib/jekyll/draft.rb @@ -15,7 +15,7 @@ module Jekyll # Get the full path to the directory containing the draft files def containing_dir(source, dir) - return File.join(source, dir, '_drafts') + File.join(source, dir, '_drafts') end # Extract information from the post filename. From da273b685a699d257ead4d590e861e4c14f9e288 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Sun, 3 Mar 2013 18:55:50 -0800 Subject: [PATCH 092/120] Update history for drafts feature. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index d4703de5..cd85b56d 100644 --- a/History.txt +++ b/History.txt @@ -2,6 +2,7 @@ * Major Enhancements * Refactored jekyll commands into subcommands: build, serve, and migrate. (#690) * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) + * Added ability to render drafts in _drafts folder via command line (#833) * Minor Enhancements * Improve debugability of error message for a malformed highlight tag (#785) * Allow symlinked files in unsafe mode (#824) From 035bbdf99f347416ec34fbdea77a49325f9c5ce9 Mon Sep 17 00:00:00 2001 From: larrylv Date: Mon, 4 Mar 2013 14:52:45 +0800 Subject: [PATCH 093/120] Fix typo. --- lib/jekyll/core_ext.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/core_ext.rb b/lib/jekyll/core_ext.rb index dfc5bbf7..1d6b83a1 100644 --- a/lib/jekyll/core_ext.rb +++ b/lib/jekyll/core_ext.rb @@ -24,7 +24,7 @@ class Hash # and then the plural key, and handling any nil entries. # +hash+ the hash to read from # +singular_key+ the singular key - # +plural_key+ the singular key + # +plural_key+ the plural key # # Returns an array def pluralized_array(singular_key, plural_key) From 2dd98816d48e2ebdf16e4d8ddf4fe76e787165ef Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Tue, 5 Mar 2013 19:06:20 -0600 Subject: [PATCH 094/120] Remove duplication when generating list of entries to process Posts and Drafts share the same logic to get the list of files to process into objects when generating the site. Factor this logic into its own method and use it when reading posts and reading drafts. --- lib/jekyll/site.rb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 18488431..f16b4387 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -187,9 +187,7 @@ module Jekyll # # Returns nothing. def read_posts(dir) - base = File.join(self.source, dir, '_posts') - return unless File.exists?(base) - entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } + entries = get_entries(dir, '_posts') # first pass processes, but does not yet render post content entries.each do |f| @@ -212,9 +210,7 @@ module Jekyll # # Returns nothing. def read_drafts(dir) - base = File.join(self.source, dir, '_drafts') - return unless File.exists?(base) - entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } + entries = get_entries(dir, '_drafts') # first pass processes, but does not yet render draft content entries.each do |f| @@ -395,5 +391,17 @@ module Jekyll raise "Converter implementation not found for #{klass}" end end + + # Read the entries from a particular directory for processing + # + # dir - The String relative path of the directory to read + # subfolder - The String directory to read + # + # Returns the list of entries to process + def get_entries(dir, subfolder) + base = File.join(self.source, dir, subfolder) + return [] unless File.exists?(base) + entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } + end end end From 6399ec9b2b07b4f8dbaf3dc72cac200a0185b2a8 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Tue, 5 Mar 2013 19:11:07 -0600 Subject: [PATCH 095/120] Remove duplication when aggregating post information --- lib/jekyll/site.rb | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index f16b4387..94c4b1a0 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -195,9 +195,7 @@ module Jekyll post = Post.new(self, self.source, dir, f) if post.published && (self.future || post.date <= self.time) - self.posts << post - post.categories.each { |c| self.categories[c] << post } - post.tags.each { |c| self.tags[c] << post } + aggregate_post_info(post) end end end @@ -217,9 +215,7 @@ module Jekyll if Draft.valid?(f) draft = Draft.new(self, self.source, dir, f) - self.posts << draft - draft.categories.each { |c| self.categories[c] << draft } - draft.tags.each { |c| self.tags[c] << draft } + aggregate_post_info(draft) end end end @@ -403,5 +399,16 @@ module Jekyll return [] unless File.exists?(base) entries = Dir.chdir(base) { filter_entries(Dir['**/*']) } end + + # Aggregate post information + # + # post - The Post object to aggregate information for + # + # Returns nothing + def aggregate_post_info(post) + self.posts << post + post.categories.each { |c| self.categories[c] << post } + post.tags.each { |c| self.tags[c] << post } + end end end From 5e6c2f6e4b09b83cf6c42470499482ee634f7b72 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 8 Mar 2013 20:12:21 +0100 Subject: [PATCH 096/120] Added mime.types file from Apache SVN repo. --- lib/jekyll/mime.types | 1588 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1588 insertions(+) create mode 100644 lib/jekyll/mime.types diff --git a/lib/jekyll/mime.types b/lib/jekyll/mime.types new file mode 100644 index 00000000..b90b1658 --- /dev/null +++ b/lib/jekyll/mime.types @@ -0,0 +1,1588 @@ +# This file maps Internet media types to unique file extension(s). +# Although created for httpd, this file is used by many software systems +# and has been placed in the public domain for unlimited redisribution. +# +# The table below contains both registered and (common) unregistered types. +# A type that has no unique extension can be ignored -- they are listed +# here to guide configurations toward known types and to make it easier to +# identify "new" types. File extensions are also commonly used to indicate +# content languages and encodings, so choose them carefully. +# +# Internet media types should be registered as described in RFC 4288. +# The registry is at . +# +# MIME type (lowercased) Extensions +# ============================================ ========== +# application/1d-interleaved-parityfec +# application/3gpp-ims+xml +# application/activemessage +application/andrew-inset ez +# application/applefile +application/applixware aw +application/atom+xml atom +application/atomcat+xml atomcat +# application/atomicmail +application/atomsvc+xml atomsvc +# application/auth-policy+xml +# application/batch-smtp +# application/beep+xml +# application/calendar+xml +# application/cals-1840 +# application/ccmp+xml +application/ccxml+xml ccxml +application/cdmi-capability cdmia +application/cdmi-container cdmic +application/cdmi-domain cdmid +application/cdmi-object cdmio +application/cdmi-queue cdmiq +# application/cea-2018+xml +# application/cellml+xml +# application/cfw +# application/cnrp+xml +# application/commonground +# application/conference-info+xml +# application/cpl+xml +# application/csta+xml +# application/cstadata+xml +application/cu-seeme cu +# application/cybercash +application/davmount+xml davmount +# application/dca-rft +# application/dec-dx +# application/dialog-info+xml +# application/dicom +# application/dns +application/docbook+xml dbk +# application/dskpp+xml +application/dssc+der dssc +application/dssc+xml xdssc +# application/dvcs +application/ecmascript ecma +# application/edi-consent +# application/edi-x12 +# application/edifact +application/emma+xml emma +# application/epp+xml +application/epub+zip epub +# application/eshop +# application/example +application/exi exi +# application/fastinfoset +# application/fastsoap +# application/fits +application/font-tdpfr pfr +# application/framework-attributes+xml +application/gml+xml gml +application/gpx+xml gpx +application/gxf gxf +# application/h224 +# application/held+xml +# application/http +application/hyperstudio stk +# application/ibe-key-request+xml +# application/ibe-pkg-reply+xml +# application/ibe-pp-data +# application/iges +# application/im-iscomposing+xml +# application/index +# application/index.cmd +# application/index.obj +# application/index.response +# application/index.vnd +application/inkml+xml ink inkml +# application/iotp +application/ipfix ipfix +# application/ipp +# application/isup +application/java-archive jar +application/java-serialized-object ser +application/java-vm class +application/javascript js +application/json json +application/jsonml+json jsonml +# application/kpml-request+xml +# application/kpml-response+xml +application/lost+xml lostxml +application/mac-binhex40 hqx +application/mac-compactpro cpt +# application/macwriteii +application/mads+xml mads +application/marc mrc +application/marcxml+xml mrcx +application/mathematica ma nb mb +# application/mathml-content+xml +# application/mathml-presentation+xml +application/mathml+xml mathml +# application/mbms-associated-procedure-description+xml +# application/mbms-deregister+xml +# application/mbms-envelope+xml +# application/mbms-msk+xml +# application/mbms-msk-response+xml +# application/mbms-protection-description+xml +# application/mbms-reception-report+xml +# application/mbms-register+xml +# application/mbms-register-response+xml +# application/mbms-user-service-description+xml +application/mbox mbox +# application/media_control+xml +application/mediaservercontrol+xml mscml +application/metalink+xml metalink +application/metalink4+xml meta4 +application/mets+xml mets +# application/mikey +application/mods+xml mods +# application/moss-keys +# application/moss-signature +# application/mosskey-data +# application/mosskey-request +application/mp21 m21 mp21 +application/mp4 mp4s +# application/mpeg4-generic +# application/mpeg4-iod +# application/mpeg4-iod-xmt +# application/msc-ivr+xml +# application/msc-mixer+xml +application/msword doc dot +application/mxf mxf +# application/nasdata +# application/news-checkgroups +# application/news-groupinfo +# application/news-transmission +# application/nss +# application/ocsp-request +# application/ocsp-response +application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy +application/oda oda +application/oebps-package+xml opf +application/ogg ogx +application/omdoc+xml omdoc +application/onenote onetoc onetoc2 onetmp onepkg +application/oxps oxps +# application/parityfec +application/patch-ops-error+xml xer +application/pdf pdf +application/pgp-encrypted pgp +# application/pgp-keys +application/pgp-signature asc sig +application/pics-rules prf +# application/pidf+xml +# application/pidf-diff+xml +application/pkcs10 p10 +application/pkcs7-mime p7m p7c +application/pkcs7-signature p7s +application/pkcs8 p8 +application/pkix-attr-cert ac +application/pkix-cert cer +application/pkix-crl crl +application/pkix-pkipath pkipath +application/pkixcmp pki +application/pls+xml pls +# application/poc-settings+xml +application/postscript ai eps ps +# application/prs.alvestrand.titrax-sheet +application/prs.cww cww +# application/prs.nprend +# application/prs.plucker +# application/prs.rdf-xml-crypt +# application/prs.xsf+xml +application/pskc+xml pskcxml +# application/qsig +application/rdf+xml rdf +application/reginfo+xml rif +application/relax-ng-compact-syntax rnc +# application/remote-printing +application/resource-lists+xml rl +application/resource-lists-diff+xml rld +# application/riscos +# application/rlmi+xml +application/rls-services+xml rs +application/rpki-ghostbusters gbr +application/rpki-manifest mft +application/rpki-roa roa +# application/rpki-updown +application/rsd+xml rsd +application/rss+xml rss +application/rtf rtf +# application/rtx +# application/samlassertion+xml +# application/samlmetadata+xml +application/sbml+xml sbml +application/scvp-cv-request scq +application/scvp-cv-response scs +application/scvp-vp-request spq +application/scvp-vp-response spp +application/sdp sdp +# application/set-payment +application/set-payment-initiation setpay +# application/set-registration +application/set-registration-initiation setreg +# application/sgml +# application/sgml-open-catalog +application/shf+xml shf +# application/sieve +# application/simple-filter+xml +# application/simple-message-summary +# application/simplesymbolcontainer +# application/slate +# application/smil +application/smil+xml smi smil +# application/soap+fastinfoset +# application/soap+xml +application/sparql-query rq +application/sparql-results+xml srx +# application/spirits-event+xml +application/srgs gram +application/srgs+xml grxml +application/sru+xml sru +application/ssdl+xml ssdl +application/ssml+xml ssml +# application/tamp-apex-update +# application/tamp-apex-update-confirm +# application/tamp-community-update +# application/tamp-community-update-confirm +# application/tamp-error +# application/tamp-sequence-adjust +# application/tamp-sequence-adjust-confirm +# application/tamp-status-query +# application/tamp-status-response +# application/tamp-update +# application/tamp-update-confirm +application/tei+xml tei teicorpus +application/thraud+xml tfi +# application/timestamp-query +# application/timestamp-reply +application/timestamped-data tsd +# application/tve-trigger +# application/ulpfec +# application/vcard+xml +# application/vemmi +# application/vividence.scriptfile +# application/vnd.3gpp.bsf+xml +application/vnd.3gpp.pic-bw-large plb +application/vnd.3gpp.pic-bw-small psb +application/vnd.3gpp.pic-bw-var pvb +# application/vnd.3gpp.sms +# application/vnd.3gpp2.bcmcsinfo+xml +# application/vnd.3gpp2.sms +application/vnd.3gpp2.tcap tcap +application/vnd.3m.post-it-notes pwn +application/vnd.accpac.simply.aso aso +application/vnd.accpac.simply.imp imp +application/vnd.acucobol acu +application/vnd.acucorp atc acutc +application/vnd.adobe.air-application-installer-package+zip air +application/vnd.adobe.formscentral.fcdt fcdt +application/vnd.adobe.fxp fxp fxpl +# application/vnd.adobe.partial-upload +application/vnd.adobe.xdp+xml xdp +application/vnd.adobe.xfdf xfdf +# application/vnd.aether.imp +# application/vnd.ah-barcode +application/vnd.ahead.space ahead +application/vnd.airzip.filesecure.azf azf +application/vnd.airzip.filesecure.azs azs +application/vnd.amazon.ebook azw +application/vnd.americandynamics.acc acc +application/vnd.amiga.ami ami +# application/vnd.amundsen.maze+xml +application/vnd.android.package-archive apk +application/vnd.anser-web-certificate-issue-initiation cii +application/vnd.anser-web-funds-transfer-initiation fti +application/vnd.antix.game-component atx +application/vnd.apple.installer+xml mpkg +application/vnd.apple.mpegurl m3u8 +# application/vnd.arastra.swi +application/vnd.aristanetworks.swi swi +application/vnd.astraea-software.iota iota +application/vnd.audiograph aep +# application/vnd.autopackage +# application/vnd.avistar+xml +application/vnd.blueice.multipass mpm +# application/vnd.bluetooth.ep.oob +application/vnd.bmi bmi +application/vnd.businessobjects rep +# application/vnd.cab-jscript +# application/vnd.canon-cpdl +# application/vnd.canon-lips +# application/vnd.cendio.thinlinc.clientconf +application/vnd.chemdraw+xml cdxml +application/vnd.chipnuts.karaoke-mmd mmd +application/vnd.cinderella cdy +# application/vnd.cirpack.isdn-ext +application/vnd.claymore cla +application/vnd.cloanto.rp9 rp9 +application/vnd.clonk.c4group c4g c4d c4f c4p c4u +application/vnd.cluetrust.cartomobile-config c11amc +application/vnd.cluetrust.cartomobile-config-pkg c11amz +# application/vnd.collection+json +# application/vnd.commerce-battelle +application/vnd.commonspace csp +application/vnd.contact.cmsg cdbcmsg +application/vnd.cosmocaller cmc +application/vnd.crick.clicker clkx +application/vnd.crick.clicker.keyboard clkk +application/vnd.crick.clicker.palette clkp +application/vnd.crick.clicker.template clkt +application/vnd.crick.clicker.wordbank clkw +application/vnd.criticaltools.wbs+xml wbs +application/vnd.ctc-posml pml +# application/vnd.ctct.ws+xml +# application/vnd.cups-pdf +# application/vnd.cups-postscript +application/vnd.cups-ppd ppd +# application/vnd.cups-raster +# application/vnd.cups-raw +# application/vnd.curl +application/vnd.curl.car car +application/vnd.curl.pcurl pcurl +# application/vnd.cybank +application/vnd.dart dart +application/vnd.data-vision.rdz rdz +application/vnd.dece.data uvf uvvf uvd uvvd +application/vnd.dece.ttml+xml uvt uvvt +application/vnd.dece.unspecified uvx uvvx +application/vnd.dece.zip uvz uvvz +application/vnd.denovo.fcselayout-link fe_launch +# application/vnd.dir-bi.plate-dl-nosuffix +application/vnd.dna dna +application/vnd.dolby.mlp mlp +# application/vnd.dolby.mobile.1 +# application/vnd.dolby.mobile.2 +application/vnd.dpgraph dpg +application/vnd.dreamfactory dfac +application/vnd.ds-keypoint kpxx +application/vnd.dvb.ait ait +# application/vnd.dvb.dvbj +# application/vnd.dvb.esgcontainer +# application/vnd.dvb.ipdcdftnotifaccess +# application/vnd.dvb.ipdcesgaccess +# application/vnd.dvb.ipdcesgaccess2 +# application/vnd.dvb.ipdcesgpdd +# application/vnd.dvb.ipdcroaming +# application/vnd.dvb.iptv.alfec-base +# application/vnd.dvb.iptv.alfec-enhancement +# application/vnd.dvb.notif-aggregate-root+xml +# application/vnd.dvb.notif-container+xml +# application/vnd.dvb.notif-generic+xml +# application/vnd.dvb.notif-ia-msglist+xml +# application/vnd.dvb.notif-ia-registration-request+xml +# application/vnd.dvb.notif-ia-registration-response+xml +# application/vnd.dvb.notif-init+xml +# application/vnd.dvb.pfr +application/vnd.dvb.service svc +# application/vnd.dxr +application/vnd.dynageo geo +# application/vnd.easykaraoke.cdgdownload +# application/vnd.ecdis-update +application/vnd.ecowin.chart mag +# application/vnd.ecowin.filerequest +# application/vnd.ecowin.fileupdate +# application/vnd.ecowin.series +# application/vnd.ecowin.seriesrequest +# application/vnd.ecowin.seriesupdate +# application/vnd.emclient.accessrequest+xml +application/vnd.enliven nml +# application/vnd.eprints.data+xml +application/vnd.epson.esf esf +application/vnd.epson.msf msf +application/vnd.epson.quickanime qam +application/vnd.epson.salt slt +application/vnd.epson.ssf ssf +# application/vnd.ericsson.quickcall +application/vnd.eszigno3+xml es3 et3 +# application/vnd.etsi.aoc+xml +# application/vnd.etsi.cug+xml +# application/vnd.etsi.iptvcommand+xml +# application/vnd.etsi.iptvdiscovery+xml +# application/vnd.etsi.iptvprofile+xml +# application/vnd.etsi.iptvsad-bc+xml +# application/vnd.etsi.iptvsad-cod+xml +# application/vnd.etsi.iptvsad-npvr+xml +# application/vnd.etsi.iptvservice+xml +# application/vnd.etsi.iptvsync+xml +# application/vnd.etsi.iptvueprofile+xml +# application/vnd.etsi.mcid+xml +# application/vnd.etsi.overload-control-policy-dataset+xml +# application/vnd.etsi.sci+xml +# application/vnd.etsi.simservs+xml +# application/vnd.etsi.tsl+xml +# application/vnd.etsi.tsl.der +# application/vnd.eudora.data +application/vnd.ezpix-album ez2 +application/vnd.ezpix-package ez3 +# application/vnd.f-secure.mobile +application/vnd.fdf fdf +application/vnd.fdsn.mseed mseed +application/vnd.fdsn.seed seed dataless +# application/vnd.ffsns +# application/vnd.fints +application/vnd.flographit gph +application/vnd.fluxtime.clip ftc +# application/vnd.font-fontforge-sfd +application/vnd.framemaker fm frame maker book +application/vnd.frogans.fnc fnc +application/vnd.frogans.ltf ltf +application/vnd.fsc.weblaunch fsc +application/vnd.fujitsu.oasys oas +application/vnd.fujitsu.oasys2 oa2 +application/vnd.fujitsu.oasys3 oa3 +application/vnd.fujitsu.oasysgp fg5 +application/vnd.fujitsu.oasysprs bh2 +# application/vnd.fujixerox.art-ex +# application/vnd.fujixerox.art4 +# application/vnd.fujixerox.hbpl +application/vnd.fujixerox.ddd ddd +application/vnd.fujixerox.docuworks xdw +application/vnd.fujixerox.docuworks.binder xbd +# application/vnd.fut-misnet +application/vnd.fuzzysheet fzs +application/vnd.genomatix.tuxedo txd +# application/vnd.geocube+xml +application/vnd.geogebra.file ggb +application/vnd.geogebra.tool ggt +application/vnd.geometry-explorer gex gre +application/vnd.geonext gxt +application/vnd.geoplan g2w +application/vnd.geospace g3w +# application/vnd.globalplatform.card-content-mgt +# application/vnd.globalplatform.card-content-mgt-response +application/vnd.gmx gmx +application/vnd.google-earth.kml+xml kml +application/vnd.google-earth.kmz kmz +application/vnd.grafeq gqf gqs +# application/vnd.gridmp +application/vnd.groove-account gac +application/vnd.groove-help ghf +application/vnd.groove-identity-message gim +application/vnd.groove-injector grv +application/vnd.groove-tool-message gtm +application/vnd.groove-tool-template tpl +application/vnd.groove-vcard vcg +# application/vnd.hal+json +application/vnd.hal+xml hal +application/vnd.handheld-entertainment+xml zmm +application/vnd.hbci hbci +# application/vnd.hcl-bireports +application/vnd.hhe.lesson-player les +application/vnd.hp-hpgl hpgl +application/vnd.hp-hpid hpid +application/vnd.hp-hps hps +application/vnd.hp-jlyt jlt +application/vnd.hp-pcl pcl +application/vnd.hp-pclxl pclxl +# application/vnd.httphone +application/vnd.hydrostatix.sof-data sfd-hdstx +# application/vnd.hzn-3d-crossword +# application/vnd.ibm.afplinedata +# application/vnd.ibm.electronic-media +application/vnd.ibm.minipay mpy +application/vnd.ibm.modcap afp listafp list3820 +application/vnd.ibm.rights-management irm +application/vnd.ibm.secure-container sc +application/vnd.iccprofile icc icm +application/vnd.igloader igl +application/vnd.immervision-ivp ivp +application/vnd.immervision-ivu ivu +# application/vnd.informedcontrol.rms+xml +# application/vnd.informix-visionary +# application/vnd.infotech.project +# application/vnd.infotech.project+xml +# application/vnd.innopath.wamp.notification +application/vnd.insors.igm igm +application/vnd.intercon.formnet xpw xpx +application/vnd.intergeo i2g +# application/vnd.intertrust.digibox +# application/vnd.intertrust.nncp +application/vnd.intu.qbo qbo +application/vnd.intu.qfx qfx +# application/vnd.iptc.g2.conceptitem+xml +# application/vnd.iptc.g2.knowledgeitem+xml +# application/vnd.iptc.g2.newsitem+xml +# application/vnd.iptc.g2.newsmessage+xml +# application/vnd.iptc.g2.packageitem+xml +# application/vnd.iptc.g2.planningitem+xml +application/vnd.ipunplugged.rcprofile rcprofile +application/vnd.irepository.package+xml irp +application/vnd.is-xpr xpr +application/vnd.isac.fcs fcs +application/vnd.jam jam +# application/vnd.japannet-directory-service +# application/vnd.japannet-jpnstore-wakeup +# application/vnd.japannet-payment-wakeup +# application/vnd.japannet-registration +# application/vnd.japannet-registration-wakeup +# application/vnd.japannet-setstore-wakeup +# application/vnd.japannet-verification +# application/vnd.japannet-verification-wakeup +application/vnd.jcp.javame.midlet-rms rms +application/vnd.jisp jisp +application/vnd.joost.joda-archive joda +application/vnd.kahootz ktz ktr +application/vnd.kde.karbon karbon +application/vnd.kde.kchart chrt +application/vnd.kde.kformula kfo +application/vnd.kde.kivio flw +application/vnd.kde.kontour kon +application/vnd.kde.kpresenter kpr kpt +application/vnd.kde.kspread ksp +application/vnd.kde.kword kwd kwt +application/vnd.kenameaapp htke +application/vnd.kidspiration kia +application/vnd.kinar kne knp +application/vnd.koan skp skd skt skm +application/vnd.kodak-descriptor sse +application/vnd.las.las+xml lasxml +# application/vnd.liberty-request+xml +application/vnd.llamagraphics.life-balance.desktop lbd +application/vnd.llamagraphics.life-balance.exchange+xml lbe +application/vnd.lotus-1-2-3 123 +application/vnd.lotus-approach apr +application/vnd.lotus-freelance pre +application/vnd.lotus-notes nsf +application/vnd.lotus-organizer org +application/vnd.lotus-screencam scm +application/vnd.lotus-wordpro lwp +application/vnd.macports.portpkg portpkg +# application/vnd.marlin.drm.actiontoken+xml +# application/vnd.marlin.drm.conftoken+xml +# application/vnd.marlin.drm.license+xml +# application/vnd.marlin.drm.mdcf +application/vnd.mcd mcd +application/vnd.medcalcdata mc1 +application/vnd.mediastation.cdkey cdkey +# application/vnd.meridian-slingshot +application/vnd.mfer mwf +application/vnd.mfmp mfm +application/vnd.micrografx.flo flo +application/vnd.micrografx.igx igx +application/vnd.mif mif +# application/vnd.minisoft-hp3000-save +# application/vnd.mitsubishi.misty-guard.trustweb +application/vnd.mobius.daf daf +application/vnd.mobius.dis dis +application/vnd.mobius.mbk mbk +application/vnd.mobius.mqy mqy +application/vnd.mobius.msl msl +application/vnd.mobius.plc plc +application/vnd.mobius.txf txf +application/vnd.mophun.application mpn +application/vnd.mophun.certificate mpc +# application/vnd.motorola.flexsuite +# application/vnd.motorola.flexsuite.adsi +# application/vnd.motorola.flexsuite.fis +# application/vnd.motorola.flexsuite.gotap +# application/vnd.motorola.flexsuite.kmr +# application/vnd.motorola.flexsuite.ttc +# application/vnd.motorola.flexsuite.wem +# application/vnd.motorola.iprm +application/vnd.mozilla.xul+xml xul +application/vnd.ms-artgalry cil +# application/vnd.ms-asf +application/vnd.ms-cab-compressed cab +# application/vnd.ms-color.iccprofile +application/vnd.ms-excel xls xlm xla xlc xlt xlw +application/vnd.ms-excel.addin.macroenabled.12 xlam +application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb +application/vnd.ms-excel.sheet.macroenabled.12 xlsm +application/vnd.ms-excel.template.macroenabled.12 xltm +application/vnd.ms-fontobject eot +application/vnd.ms-htmlhelp chm +application/vnd.ms-ims ims +application/vnd.ms-lrm lrm +# application/vnd.ms-office.activex+xml +application/vnd.ms-officetheme thmx +# application/vnd.ms-opentype +# application/vnd.ms-package.obfuscated-opentype +application/vnd.ms-pki.seccat cat +application/vnd.ms-pki.stl stl +# application/vnd.ms-playready.initiator+xml +application/vnd.ms-powerpoint ppt pps pot +application/vnd.ms-powerpoint.addin.macroenabled.12 ppam +application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm +application/vnd.ms-powerpoint.slide.macroenabled.12 sldm +application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm +application/vnd.ms-powerpoint.template.macroenabled.12 potm +# application/vnd.ms-printing.printticket+xml +application/vnd.ms-project mpp mpt +# application/vnd.ms-tnef +# application/vnd.ms-wmdrm.lic-chlg-req +# application/vnd.ms-wmdrm.lic-resp +# application/vnd.ms-wmdrm.meter-chlg-req +# application/vnd.ms-wmdrm.meter-resp +application/vnd.ms-word.document.macroenabled.12 docm +application/vnd.ms-word.template.macroenabled.12 dotm +application/vnd.ms-works wps wks wcm wdb +application/vnd.ms-wpl wpl +application/vnd.ms-xpsdocument xps +application/vnd.mseq mseq +# application/vnd.msign +# application/vnd.multiad.creator +# application/vnd.multiad.creator.cif +# application/vnd.music-niff +application/vnd.musician mus +application/vnd.muvee.style msty +application/vnd.mynfc taglet +# application/vnd.ncd.control +# application/vnd.ncd.reference +# application/vnd.nervana +# application/vnd.netfpx +application/vnd.neurolanguage.nlu nlu +application/vnd.nitf ntf nitf +application/vnd.noblenet-directory nnd +application/vnd.noblenet-sealer nns +application/vnd.noblenet-web nnw +# application/vnd.nokia.catalogs +# application/vnd.nokia.conml+wbxml +# application/vnd.nokia.conml+xml +# application/vnd.nokia.isds-radio-presets +# application/vnd.nokia.iptv.config+xml +# application/vnd.nokia.landmark+wbxml +# application/vnd.nokia.landmark+xml +# application/vnd.nokia.landmarkcollection+xml +# application/vnd.nokia.n-gage.ac+xml +application/vnd.nokia.n-gage.data ngdat +application/vnd.nokia.n-gage.symbian.install n-gage +# application/vnd.nokia.ncd +# application/vnd.nokia.pcd+wbxml +# application/vnd.nokia.pcd+xml +application/vnd.nokia.radio-preset rpst +application/vnd.nokia.radio-presets rpss +application/vnd.novadigm.edm edm +application/vnd.novadigm.edx edx +application/vnd.novadigm.ext ext +# application/vnd.ntt-local.file-transfer +# application/vnd.ntt-local.sip-ta_remote +# application/vnd.ntt-local.sip-ta_tcp_stream +application/vnd.oasis.opendocument.chart odc +application/vnd.oasis.opendocument.chart-template otc +application/vnd.oasis.opendocument.database odb +application/vnd.oasis.opendocument.formula odf +application/vnd.oasis.opendocument.formula-template odft +application/vnd.oasis.opendocument.graphics odg +application/vnd.oasis.opendocument.graphics-template otg +application/vnd.oasis.opendocument.image odi +application/vnd.oasis.opendocument.image-template oti +application/vnd.oasis.opendocument.presentation odp +application/vnd.oasis.opendocument.presentation-template otp +application/vnd.oasis.opendocument.spreadsheet ods +application/vnd.oasis.opendocument.spreadsheet-template ots +application/vnd.oasis.opendocument.text odt +application/vnd.oasis.opendocument.text-master odm +application/vnd.oasis.opendocument.text-template ott +application/vnd.oasis.opendocument.text-web oth +# application/vnd.obn +# application/vnd.oftn.l10n+json +# application/vnd.oipf.contentaccessdownload+xml +# application/vnd.oipf.contentaccessstreaming+xml +# application/vnd.oipf.cspg-hexbinary +# application/vnd.oipf.dae.svg+xml +# application/vnd.oipf.dae.xhtml+xml +# application/vnd.oipf.mippvcontrolmessage+xml +# application/vnd.oipf.pae.gem +# application/vnd.oipf.spdiscovery+xml +# application/vnd.oipf.spdlist+xml +# application/vnd.oipf.ueprofile+xml +# application/vnd.oipf.userprofile+xml +application/vnd.olpc-sugar xo +# application/vnd.oma-scws-config +# application/vnd.oma-scws-http-request +# application/vnd.oma-scws-http-response +# application/vnd.oma.bcast.associated-procedure-parameter+xml +# application/vnd.oma.bcast.drm-trigger+xml +# application/vnd.oma.bcast.imd+xml +# application/vnd.oma.bcast.ltkm +# application/vnd.oma.bcast.notification+xml +# application/vnd.oma.bcast.provisioningtrigger +# application/vnd.oma.bcast.sgboot +# application/vnd.oma.bcast.sgdd+xml +# application/vnd.oma.bcast.sgdu +# application/vnd.oma.bcast.simple-symbol-container +# application/vnd.oma.bcast.smartcard-trigger+xml +# application/vnd.oma.bcast.sprov+xml +# application/vnd.oma.bcast.stkm +# application/vnd.oma.cab-address-book+xml +# application/vnd.oma.cab-feature-handler+xml +# application/vnd.oma.cab-pcc+xml +# application/vnd.oma.cab-user-prefs+xml +# application/vnd.oma.dcd +# application/vnd.oma.dcdc +application/vnd.oma.dd2+xml dd2 +# application/vnd.oma.drm.risd+xml +# application/vnd.oma.group-usage-list+xml +# application/vnd.oma.pal+xml +# application/vnd.oma.poc.detailed-progress-report+xml +# application/vnd.oma.poc.final-report+xml +# application/vnd.oma.poc.groups+xml +# application/vnd.oma.poc.invocation-descriptor+xml +# application/vnd.oma.poc.optimized-progress-report+xml +# application/vnd.oma.push +# application/vnd.oma.scidm.messages+xml +# application/vnd.oma.xcap-directory+xml +# application/vnd.omads-email+xml +# application/vnd.omads-file+xml +# application/vnd.omads-folder+xml +# application/vnd.omaloc-supl-init +application/vnd.openofficeorg.extension oxt +# application/vnd.openxmlformats-officedocument.custom-properties+xml +# application/vnd.openxmlformats-officedocument.customxmlproperties+xml +# application/vnd.openxmlformats-officedocument.drawing+xml +# application/vnd.openxmlformats-officedocument.drawingml.chart+xml +# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml +# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml +# application/vnd.openxmlformats-officedocument.extended-properties+xml +# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml +# application/vnd.openxmlformats-officedocument.presentationml.comments+xml +# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml +# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml +# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml +application/vnd.openxmlformats-officedocument.presentationml.presentation pptx +# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml +# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml +application/vnd.openxmlformats-officedocument.presentationml.slide sldx +# application/vnd.openxmlformats-officedocument.presentationml.slide+xml +# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml +# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml +application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx +# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml +# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml +# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml +# application/vnd.openxmlformats-officedocument.presentationml.tags+xml +application/vnd.openxmlformats-officedocument.presentationml.template potx +# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml +# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml +application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx +# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml +application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx +# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml +# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml +# application/vnd.openxmlformats-officedocument.theme+xml +# application/vnd.openxmlformats-officedocument.themeoverride+xml +# application/vnd.openxmlformats-officedocument.vmldrawing +# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml +application/vnd.openxmlformats-officedocument.wordprocessingml.document docx +# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml +application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx +# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml +# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml +# application/vnd.openxmlformats-package.core-properties+xml +# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml +# application/vnd.openxmlformats-package.relationships+xml +# application/vnd.quobject-quoxdocument +# application/vnd.osa.netdeploy +application/vnd.osgeo.mapguide.package mgp +# application/vnd.osgi.bundle +application/vnd.osgi.dp dp +application/vnd.osgi.subsystem esa +# application/vnd.otps.ct-kip+xml +application/vnd.palm pdb pqa oprc +# application/vnd.paos.xml +application/vnd.pawaafile paw +application/vnd.pg.format str +application/vnd.pg.osasli ei6 +# application/vnd.piaccess.application-licence +application/vnd.picsel efif +application/vnd.pmi.widget wg +# application/vnd.poc.group-advertisement+xml +application/vnd.pocketlearn plf +application/vnd.powerbuilder6 pbd +# application/vnd.powerbuilder6-s +# application/vnd.powerbuilder7 +# application/vnd.powerbuilder7-s +# application/vnd.powerbuilder75 +# application/vnd.powerbuilder75-s +# application/vnd.preminet +application/vnd.previewsystems.box box +application/vnd.proteus.magazine mgz +application/vnd.publishare-delta-tree qps +application/vnd.pvi.ptid1 ptid +# application/vnd.pwg-multiplexed +# application/vnd.pwg-xhtml-print+xml +# application/vnd.qualcomm.brew-app-res +application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb +# application/vnd.radisys.moml+xml +# application/vnd.radisys.msml+xml +# application/vnd.radisys.msml-audit+xml +# application/vnd.radisys.msml-audit-conf+xml +# application/vnd.radisys.msml-audit-conn+xml +# application/vnd.radisys.msml-audit-dialog+xml +# application/vnd.radisys.msml-audit-stream+xml +# application/vnd.radisys.msml-conf+xml +# application/vnd.radisys.msml-dialog+xml +# application/vnd.radisys.msml-dialog-base+xml +# application/vnd.radisys.msml-dialog-fax-detect+xml +# application/vnd.radisys.msml-dialog-fax-sendrecv+xml +# application/vnd.radisys.msml-dialog-group+xml +# application/vnd.radisys.msml-dialog-speech+xml +# application/vnd.radisys.msml-dialog-transform+xml +# application/vnd.rainstor.data +# application/vnd.rapid +application/vnd.realvnc.bed bed +application/vnd.recordare.musicxml mxl +application/vnd.recordare.musicxml+xml musicxml +# application/vnd.renlearn.rlprint +application/vnd.rig.cryptonote cryptonote +application/vnd.rim.cod cod +application/vnd.rn-realmedia rm +application/vnd.rn-realmedia-vbr rmvb +application/vnd.route66.link66+xml link66 +# application/vnd.rs-274x +# application/vnd.ruckus.download +# application/vnd.s3sms +application/vnd.sailingtracker.track st +# application/vnd.sbm.cid +# application/vnd.sbm.mid2 +# application/vnd.scribus +# application/vnd.sealed.3df +# application/vnd.sealed.csf +# application/vnd.sealed.doc +# application/vnd.sealed.eml +# application/vnd.sealed.mht +# application/vnd.sealed.net +# application/vnd.sealed.ppt +# application/vnd.sealed.tiff +# application/vnd.sealed.xls +# application/vnd.sealedmedia.softseal.html +# application/vnd.sealedmedia.softseal.pdf +application/vnd.seemail see +application/vnd.sema sema +application/vnd.semd semd +application/vnd.semf semf +application/vnd.shana.informed.formdata ifm +application/vnd.shana.informed.formtemplate itp +application/vnd.shana.informed.interchange iif +application/vnd.shana.informed.package ipk +application/vnd.simtech-mindmapper twd twds +application/vnd.smaf mmf +# application/vnd.smart.notebook +application/vnd.smart.teacher teacher +# application/vnd.software602.filler.form+xml +# application/vnd.software602.filler.form-xml-zip +application/vnd.solent.sdkm+xml sdkm sdkd +application/vnd.spotfire.dxp dxp +application/vnd.spotfire.sfs sfs +# application/vnd.sss-cod +# application/vnd.sss-dtf +# application/vnd.sss-ntf +application/vnd.stardivision.calc sdc +application/vnd.stardivision.draw sda +application/vnd.stardivision.impress sdd +application/vnd.stardivision.math smf +application/vnd.stardivision.writer sdw vor +application/vnd.stardivision.writer-global sgl +application/vnd.stepmania.package smzip +application/vnd.stepmania.stepchart sm +# application/vnd.street-stream +application/vnd.sun.xml.calc sxc +application/vnd.sun.xml.calc.template stc +application/vnd.sun.xml.draw sxd +application/vnd.sun.xml.draw.template std +application/vnd.sun.xml.impress sxi +application/vnd.sun.xml.impress.template sti +application/vnd.sun.xml.math sxm +application/vnd.sun.xml.writer sxw +application/vnd.sun.xml.writer.global sxg +application/vnd.sun.xml.writer.template stw +# application/vnd.sun.wadl+xml +application/vnd.sus-calendar sus susp +application/vnd.svd svd +# application/vnd.swiftview-ics +application/vnd.symbian.install sis sisx +application/vnd.syncml+xml xsm +application/vnd.syncml.dm+wbxml bdm +application/vnd.syncml.dm+xml xdm +# application/vnd.syncml.dm.notification +# application/vnd.syncml.ds.notification +application/vnd.tao.intent-module-archive tao +application/vnd.tcpdump.pcap pcap cap dmp +application/vnd.tmobile-livetv tmo +application/vnd.trid.tpt tpt +application/vnd.triscape.mxs mxs +application/vnd.trueapp tra +# application/vnd.truedoc +# application/vnd.ubisoft.webplayer +application/vnd.ufdl ufd ufdl +application/vnd.uiq.theme utz +application/vnd.umajin umj +application/vnd.unity unityweb +application/vnd.uoml+xml uoml +# application/vnd.uplanet.alert +# application/vnd.uplanet.alert-wbxml +# application/vnd.uplanet.bearer-choice +# application/vnd.uplanet.bearer-choice-wbxml +# application/vnd.uplanet.cacheop +# application/vnd.uplanet.cacheop-wbxml +# application/vnd.uplanet.channel +# application/vnd.uplanet.channel-wbxml +# application/vnd.uplanet.list +# application/vnd.uplanet.list-wbxml +# application/vnd.uplanet.listcmd +# application/vnd.uplanet.listcmd-wbxml +# application/vnd.uplanet.signal +application/vnd.vcx vcx +# application/vnd.vd-study +# application/vnd.vectorworks +# application/vnd.verimatrix.vcas +# application/vnd.vidsoft.vidconference +application/vnd.visio vsd vst vss vsw +application/vnd.visionary vis +# application/vnd.vividence.scriptfile +application/vnd.vsf vsf +# application/vnd.wap.sic +# application/vnd.wap.slc +application/vnd.wap.wbxml wbxml +application/vnd.wap.wmlc wmlc +application/vnd.wap.wmlscriptc wmlsc +application/vnd.webturbo wtb +# application/vnd.wfa.wsc +# application/vnd.wmc +# application/vnd.wmf.bootstrap +# application/vnd.wolfram.mathematica +# application/vnd.wolfram.mathematica.package +application/vnd.wolfram.player nbp +application/vnd.wordperfect wpd +application/vnd.wqd wqd +# application/vnd.wrq-hp3000-labelled +application/vnd.wt.stf stf +# application/vnd.wv.csp+wbxml +# application/vnd.wv.csp+xml +# application/vnd.wv.ssp+xml +application/vnd.xara xar +application/vnd.xfdl xfdl +# application/vnd.xfdl.webform +# application/vnd.xmi+xml +# application/vnd.xmpie.cpkg +# application/vnd.xmpie.dpkg +# application/vnd.xmpie.plan +# application/vnd.xmpie.ppkg +# application/vnd.xmpie.xlim +application/vnd.yamaha.hv-dic hvd +application/vnd.yamaha.hv-script hvs +application/vnd.yamaha.hv-voice hvp +application/vnd.yamaha.openscoreformat osf +application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg +# application/vnd.yamaha.remote-setup +application/vnd.yamaha.smaf-audio saf +application/vnd.yamaha.smaf-phrase spf +# application/vnd.yamaha.through-ngn +# application/vnd.yamaha.tunnel-udpencap +application/vnd.yellowriver-custom-menu cmp +application/vnd.zul zir zirz +application/vnd.zzazz.deck+xml zaz +application/voicexml+xml vxml +# application/vq-rtcpxr +# application/watcherinfo+xml +# application/whoispp-query +# application/whoispp-response +application/widget wgt +application/winhlp hlp +# application/wita +# application/wordperfect5.1 +application/wsdl+xml wsdl +application/wspolicy+xml wspolicy +application/x-7z-compressed 7z +application/x-abiword abw +application/x-ace-compressed ace +# application/x-amf +application/x-apple-diskimage dmg +application/x-authorware-bin aab x32 u32 vox +application/x-authorware-map aam +application/x-authorware-seg aas +application/x-bcpio bcpio +application/x-bittorrent torrent +application/x-blorb blb blorb +application/x-bzip bz +application/x-bzip2 bz2 boz +application/x-cbr cbr cba cbt cbz cb7 +application/x-cdlink vcd +application/x-cfs-compressed cfs +application/x-chat chat +application/x-chess-pgn pgn +application/x-conference nsc +# application/x-compress +application/x-cpio cpio +application/x-csh csh +application/x-debian-package deb udeb +application/x-dgc-compressed dgc +application/x-director dir dcr dxr cst cct cxt w3d fgd swa +application/x-doom wad +application/x-dtbncx+xml ncx +application/x-dtbook+xml dtb +application/x-dtbresource+xml res +application/x-dvi dvi +application/x-envoy evy +application/x-eva eva +application/x-font-bdf bdf +# application/x-font-dos +# application/x-font-framemaker +application/x-font-ghostscript gsf +# application/x-font-libgrx +application/x-font-linux-psf psf +application/x-font-otf otf +application/x-font-pcf pcf +application/x-font-snf snf +# application/x-font-speedo +# application/x-font-sunos-news +application/x-font-ttf ttf ttc +application/x-font-type1 pfa pfb pfm afm +application/x-font-woff woff +# application/x-font-vfont +application/x-freearc arc +application/x-futuresplash spl +application/x-gca-compressed gca +application/x-glulx ulx +application/x-gnumeric gnumeric +application/x-gramps-xml gramps +application/x-gtar gtar +# application/x-gzip +application/x-hdf hdf +application/x-install-instructions install +application/x-iso9660-image iso +application/x-java-jnlp-file jnlp +application/x-latex latex +application/x-lzh-compressed lzh lha +application/x-mie mie +application/x-mobipocket-ebook prc mobi +application/x-ms-application application +application/x-ms-shortcut lnk +application/x-ms-wmd wmd +application/x-ms-wmz wmz +application/x-ms-xbap xbap +application/x-msaccess mdb +application/x-msbinder obd +application/x-mscardfile crd +application/x-msclip clp +application/x-msdownload exe dll com bat msi +application/x-msmediaview mvb m13 m14 +application/x-msmetafile wmf wmz emf emz +application/x-msmoney mny +application/x-mspublisher pub +application/x-msschedule scd +application/x-msterminal trm +application/x-mswrite wri +application/x-netcdf nc cdf +application/x-nzb nzb +application/x-pkcs12 p12 pfx +application/x-pkcs7-certificates p7b spc +application/x-pkcs7-certreqresp p7r +application/x-rar-compressed rar +application/x-research-info-systems ris +application/x-sh sh +application/x-shar shar +application/x-shockwave-flash swf +application/x-silverlight-app xap +application/x-sql sql +application/x-stuffit sit +application/x-stuffitx sitx +application/x-subrip srt +application/x-sv4cpio sv4cpio +application/x-sv4crc sv4crc +application/x-t3vm-image t3 +application/x-tads gam +application/x-tar tar +application/x-tcl tcl +application/x-tex tex +application/x-tex-tfm tfm +application/x-texinfo texinfo texi +application/x-tgif obj +application/x-ustar ustar +application/x-wais-source src +application/x-x509-ca-cert der crt +application/x-xfig fig +application/x-xliff+xml xlf +application/x-xpinstall xpi +application/x-xz xz +application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8 +# application/x400-bp +application/xaml+xml xaml +# application/xcap-att+xml +# application/xcap-caps+xml +application/xcap-diff+xml xdf +# application/xcap-el+xml +# application/xcap-error+xml +# application/xcap-ns+xml +# application/xcon-conference-info-diff+xml +# application/xcon-conference-info+xml +application/xenc+xml xenc +application/xhtml+xml xhtml xht +# application/xhtml-voice+xml +application/xml xml xsl +application/xml-dtd dtd +# application/xml-external-parsed-entity +# application/xmpp+xml +application/xop+xml xop +application/xproc+xml xpl +application/xslt+xml xslt +application/xspf+xml xspf +application/xv+xml mxml xhvml xvml xvm +application/yang yang +application/yin+xml yin +application/zip zip +# audio/1d-interleaved-parityfec +# audio/32kadpcm +# audio/3gpp +# audio/3gpp2 +# audio/ac3 +audio/adpcm adp +# audio/amr +# audio/amr-wb +# audio/amr-wb+ +# audio/asc +# audio/atrac-advanced-lossless +# audio/atrac-x +# audio/atrac3 +audio/basic au snd +# audio/bv16 +# audio/bv32 +# audio/clearmode +# audio/cn +# audio/dat12 +# audio/dls +# audio/dsr-es201108 +# audio/dsr-es202050 +# audio/dsr-es202211 +# audio/dsr-es202212 +# audio/dv +# audio/dvi4 +# audio/eac3 +# audio/evrc +# audio/evrc-qcp +# audio/evrc0 +# audio/evrc1 +# audio/evrcb +# audio/evrcb0 +# audio/evrcb1 +# audio/evrcwb +# audio/evrcwb0 +# audio/evrcwb1 +# audio/example +# audio/fwdred +# audio/g719 +# audio/g722 +# audio/g7221 +# audio/g723 +# audio/g726-16 +# audio/g726-24 +# audio/g726-32 +# audio/g726-40 +# audio/g728 +# audio/g729 +# audio/g7291 +# audio/g729d +# audio/g729e +# audio/gsm +# audio/gsm-efr +# audio/gsm-hr-08 +# audio/ilbc +# audio/ip-mr_v2.5 +# audio/isac +# audio/l16 +# audio/l20 +# audio/l24 +# audio/l8 +# audio/lpc +audio/midi mid midi kar rmi +# audio/mobile-xmf +audio/mp4 mp4a +# audio/mp4a-latm +# audio/mpa +# audio/mpa-robust +audio/mpeg mpga mp2 mp2a mp3 m2a m3a +# audio/mpeg4-generic +# audio/musepack +audio/ogg oga ogg spx +# audio/opus +# audio/parityfec +# audio/pcma +# audio/pcma-wb +# audio/pcmu-wb +# audio/pcmu +# audio/prs.sid +# audio/qcelp +# audio/red +# audio/rtp-enc-aescm128 +# audio/rtp-midi +# audio/rtx +audio/s3m s3m +audio/silk sil +# audio/smv +# audio/smv0 +# audio/smv-qcp +# audio/sp-midi +# audio/speex +# audio/t140c +# audio/t38 +# audio/telephone-event +# audio/tone +# audio/uemclip +# audio/ulpfec +# audio/vdvi +# audio/vmr-wb +# audio/vnd.3gpp.iufp +# audio/vnd.4sb +# audio/vnd.audiokoz +# audio/vnd.celp +# audio/vnd.cisco.nse +# audio/vnd.cmles.radio-events +# audio/vnd.cns.anp1 +# audio/vnd.cns.inf1 +audio/vnd.dece.audio uva uvva +audio/vnd.digital-winds eol +# audio/vnd.dlna.adts +# audio/vnd.dolby.heaac.1 +# audio/vnd.dolby.heaac.2 +# audio/vnd.dolby.mlp +# audio/vnd.dolby.mps +# audio/vnd.dolby.pl2 +# audio/vnd.dolby.pl2x +# audio/vnd.dolby.pl2z +# audio/vnd.dolby.pulse.1 +audio/vnd.dra dra +audio/vnd.dts dts +audio/vnd.dts.hd dtshd +# audio/vnd.dvb.file +# audio/vnd.everad.plj +# audio/vnd.hns.audio +audio/vnd.lucent.voice lvp +audio/vnd.ms-playready.media.pya pya +# audio/vnd.nokia.mobile-xmf +# audio/vnd.nortel.vbk +audio/vnd.nuera.ecelp4800 ecelp4800 +audio/vnd.nuera.ecelp7470 ecelp7470 +audio/vnd.nuera.ecelp9600 ecelp9600 +# audio/vnd.octel.sbc +# audio/vnd.qcelp +# audio/vnd.rhetorex.32kadpcm +audio/vnd.rip rip +# audio/vnd.sealedmedia.softseal.mpeg +# audio/vnd.vmx.cvsd +# audio/vorbis +# audio/vorbis-config +audio/webm weba +audio/x-aac aac +audio/x-aiff aif aiff aifc +audio/x-caf caf +audio/x-flac flac +audio/x-matroska mka +audio/x-mpegurl m3u +audio/x-ms-wax wax +audio/x-ms-wma wma +audio/x-pn-realaudio ram ra +audio/x-pn-realaudio-plugin rmp +# audio/x-tta +audio/x-wav wav +audio/xm xm +chemical/x-cdx cdx +chemical/x-cif cif +chemical/x-cmdf cmdf +chemical/x-cml cml +chemical/x-csml csml +# chemical/x-pdb +chemical/x-xyz xyz +image/bmp bmp +image/cgm cgm +# image/example +# image/fits +image/g3fax g3 +image/gif gif +image/ief ief +# image/jp2 +image/jpeg jpeg jpg jpe +# image/jpm +# image/jpx +image/ktx ktx +# image/naplps +image/png png +image/prs.btif btif +# image/prs.pti +image/sgi sgi +image/svg+xml svg svgz +# image/t38 +image/tiff tiff tif +# image/tiff-fx +image/vnd.adobe.photoshop psd +# image/vnd.cns.inf2 +image/vnd.dece.graphic uvi uvvi uvg uvvg +image/vnd.dvb.subtitle sub +image/vnd.djvu djvu djv +image/vnd.dwg dwg +image/vnd.dxf dxf +image/vnd.fastbidsheet fbs +image/vnd.fpx fpx +image/vnd.fst fst +image/vnd.fujixerox.edmics-mmr mmr +image/vnd.fujixerox.edmics-rlc rlc +# image/vnd.globalgraphics.pgb +# image/vnd.microsoft.icon +# image/vnd.mix +image/vnd.ms-modi mdi +image/vnd.ms-photo wdp +image/vnd.net-fpx npx +# image/vnd.radiance +# image/vnd.sealed.png +# image/vnd.sealedmedia.softseal.gif +# image/vnd.sealedmedia.softseal.jpg +# image/vnd.svf +image/vnd.wap.wbmp wbmp +image/vnd.xiff xif +image/webp webp +image/x-3ds 3ds +image/x-cmu-raster ras +image/x-cmx cmx +image/x-freehand fh fhc fh4 fh5 fh7 +image/x-icon ico +image/x-mrsid-image sid +image/x-pcx pcx +image/x-pict pic pct +image/x-portable-anymap pnm +image/x-portable-bitmap pbm +image/x-portable-graymap pgm +image/x-portable-pixmap ppm +image/x-rgb rgb +image/x-tga tga +image/x-xbitmap xbm +image/x-xpixmap xpm +image/x-xwindowdump xwd +# message/cpim +# message/delivery-status +# message/disposition-notification +# message/example +# message/external-body +# message/feedback-report +# message/global +# message/global-delivery-status +# message/global-disposition-notification +# message/global-headers +# message/http +# message/imdn+xml +# message/news +# message/partial +message/rfc822 eml mime +# message/s-http +# message/sip +# message/sipfrag +# message/tracking-status +# message/vnd.si.simp +# model/example +model/iges igs iges +model/mesh msh mesh silo +model/vnd.collada+xml dae +model/vnd.dwf dwf +# model/vnd.flatland.3dml +model/vnd.gdl gdl +# model/vnd.gs-gdl +# model/vnd.gs.gdl +model/vnd.gtw gtw +# model/vnd.moml+xml +model/vnd.mts mts +# model/vnd.parasolid.transmit.binary +# model/vnd.parasolid.transmit.text +model/vnd.vtu vtu +model/vrml wrl vrml +model/x3d+binary x3db x3dbz +model/x3d+vrml x3dv x3dvz +model/x3d+xml x3d x3dz +# multipart/alternative +# multipart/appledouble +# multipart/byteranges +# multipart/digest +# multipart/encrypted +# multipart/example +# multipart/form-data +# multipart/header-set +# multipart/mixed +# multipart/parallel +# multipart/related +# multipart/report +# multipart/signed +# multipart/voice-message +# text/1d-interleaved-parityfec +text/cache-manifest appcache +text/calendar ics ifb +text/css css +text/csv csv +# text/directory +# text/dns +# text/ecmascript +# text/enriched +# text/example +# text/fwdred +text/html html htm +# text/javascript +text/n3 n3 +# text/parityfec +text/plain txt text conf def list log in +# text/prs.fallenstein.rst +text/prs.lines.tag dsc +# text/vnd.radisys.msml-basic-layout +# text/red +# text/rfc822-headers +text/richtext rtx +# text/rtf +# text/rtp-enc-aescm128 +# text/rtx +text/sgml sgml sgm +# text/t140 +text/tab-separated-values tsv +text/troff t tr roff man me ms +text/turtle ttl +# text/ulpfec +text/uri-list uri uris urls +text/vcard vcard +# text/vnd.abc +text/vnd.curl curl +text/vnd.curl.dcurl dcurl +text/vnd.curl.scurl scurl +text/vnd.curl.mcurl mcurl +# text/vnd.dmclientscript +text/vnd.dvb.subtitle sub +# text/vnd.esmertec.theme-descriptor +text/vnd.fly fly +text/vnd.fmi.flexstor flx +text/vnd.graphviz gv +text/vnd.in3d.3dml 3dml +text/vnd.in3d.spot spot +# text/vnd.iptc.newsml +# text/vnd.iptc.nitf +# text/vnd.latex-z +# text/vnd.motorola.reflex +# text/vnd.ms-mediapackage +# text/vnd.net2phone.commcenter.command +# text/vnd.si.uricatalogue +text/vnd.sun.j2me.app-descriptor jad +# text/vnd.trolltech.linguist +# text/vnd.wap.si +# text/vnd.wap.sl +text/vnd.wap.wml wml +text/vnd.wap.wmlscript wmls +text/x-asm s asm +text/x-c c cc cxx cpp h hh dic +text/x-fortran f for f77 f90 +text/x-java-source java +text/x-opml opml +text/x-pascal p pas +text/x-nfo nfo +text/x-setext etx +text/x-sfv sfv +text/x-uuencode uu +text/x-vcalendar vcs +text/x-vcard vcf +# text/xml +# text/xml-external-parsed-entity +# video/1d-interleaved-parityfec +video/3gpp 3gp +# video/3gpp-tt +video/3gpp2 3g2 +# video/bmpeg +# video/bt656 +# video/celb +# video/dv +# video/example +video/h261 h261 +video/h263 h263 +# video/h263-1998 +# video/h263-2000 +video/h264 h264 +# video/h264-rcdo +# video/h264-svc +video/jpeg jpgv +# video/jpeg2000 +video/jpm jpm jpgm +video/mj2 mj2 mjp2 +# video/mp1s +# video/mp2p +# video/mp2t +video/mp4 mp4 mp4v mpg4 +# video/mp4v-es +video/mpeg mpeg mpg mpe m1v m2v +# video/mpeg4-generic +# video/mpv +# video/nv +video/ogg ogv +# video/parityfec +# video/pointer +video/quicktime qt mov +# video/raw +# video/rtp-enc-aescm128 +# video/rtx +# video/smpte292m +# video/ulpfec +# video/vc1 +# video/vnd.cctv +video/vnd.dece.hd uvh uvvh +video/vnd.dece.mobile uvm uvvm +# video/vnd.dece.mp4 +video/vnd.dece.pd uvp uvvp +video/vnd.dece.sd uvs uvvs +video/vnd.dece.video uvv uvvv +# video/vnd.directv.mpeg +# video/vnd.directv.mpeg-tts +# video/vnd.dlna.mpeg-tts +video/vnd.dvb.file dvb +video/vnd.fvt fvt +# video/vnd.hns.video +# video/vnd.iptvforum.1dparityfec-1010 +# video/vnd.iptvforum.1dparityfec-2005 +# video/vnd.iptvforum.2dparityfec-1010 +# video/vnd.iptvforum.2dparityfec-2005 +# video/vnd.iptvforum.ttsavc +# video/vnd.iptvforum.ttsmpeg2 +# video/vnd.motorola.video +# video/vnd.motorola.videop +video/vnd.mpegurl mxu m4u +video/vnd.ms-playready.media.pyv pyv +# video/vnd.nokia.interleaved-multimedia +# video/vnd.nokia.videovoip +# video/vnd.objectvideo +# video/vnd.sealed.mpeg1 +# video/vnd.sealed.mpeg4 +# video/vnd.sealed.swf +# video/vnd.sealedmedia.softseal.mov +video/vnd.uvvu.mp4 uvu uvvu +video/vnd.vivo viv +video/webm webm +video/x-f4v f4v +video/x-fli fli +video/x-flv flv +video/x-m4v m4v +video/x-matroska mkv mk3d mks +video/x-mng mng +video/x-ms-asf asf asx +video/x-ms-vob vob +video/x-ms-wm wm +video/x-ms-wmv wmv +video/x-ms-wmx wmx +video/x-ms-wvx wvx +video/x-msvideo avi +video/x-sgi-movie movie +video/x-smv smv +x-conference/x-cooltalk ice From 524aa1f36a1d580fabcdafe047130f36ba28ce19 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 8 Mar 2013 20:12:52 +0100 Subject: [PATCH 097/120] Jekyll::Commands::Serve reads in mime.types file. --- lib/jekyll/commands/serve.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb index 4ced4fce..a12096ae 100644 --- a/lib/jekyll/commands/serve.rb +++ b/lib/jekyll/commands/serve.rb @@ -9,9 +9,8 @@ module Jekyll FileUtils.mkdir_p(destination) - mime_types = WEBrick::HTTPUtils::DefaultMimeTypes - mime_types.store 'js', 'application/javascript' - mime_types.store 'svg', 'image/svg+xml' + mime_types_file = File.expand_path('../mime.types', File.dirname(__FILE__)) + mime_types = WEBrick::HTTPUtils::load_mime_types(mime_types_file) s = HTTPServer.new( :Port => options['port'], From f79662719befef6f9b2e3b5638b974015f9e780f Mon Sep 17 00:00:00 2001 From: Fotos Georgiadis Date: Sat, 9 Mar 2013 15:07:22 +0200 Subject: [PATCH 098/120] Fix indentation. --- lib/jekyll/page.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/page.rb b/lib/jekyll/page.rb index b20bee22..ccdbda86 100644 --- a/lib/jekyll/page.rb +++ b/lib/jekyll/page.rb @@ -48,7 +48,7 @@ module Jekyll if self.site.permalink_style == :pretty if index? && html? "/:path/" - elsif html? + elsif html? "/:path/:basename/" else "/:path/:basename:output_ext" From 005f58c9006be37f23a4d20f4d41401d675052d7 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 10 Mar 2013 02:09:15 +0100 Subject: [PATCH 099/120] Update history to reflect merge of #536 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 81ca0a31..f306e9e3 100644 --- a/History.txt +++ b/History.txt @@ -25,6 +25,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * Fixed Page#dir and Page#url for edge cases (#536) * Fix broken post_url with posts with a time in their YAML Front-Matter (#831) * Look for plugins under the source directory (#654) * Tumblr Migrator: finds _posts dir correctly, fixes truncation of long From 605332cc05c53848b03c23f1ce5c9d9b183bf0ad Mon Sep 17 00:00:00 2001 From: Marcus Stollsteimer Date: Mon, 11 Mar 2013 20:33:09 +0100 Subject: [PATCH 100/120] Fix link in Readme --- README.textile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.textile b/README.textile index 7dfa4d83..6ce392a8 100644 --- a/README.textile +++ b/README.textile @@ -21,7 +21,7 @@ h2. Diving In * Put information on your site with "Template Data":http://wiki.github.com/mojombo/jekyll/template-data * Customize the "Permalinks":http://wiki.github.com/mojombo/jekyll/permalinks your posts are generated with * Use the built-in "Liquid Extensions":http://wiki.github.com/mojombo/jekyll/liquid-extensions to make your life easier -* Use custom "Plugins":https://github.com/mojombo/jekyll/wiki/Plugins to generate content specific to your site +* Use custom "Plugins":http://wiki.github.com/mojombo/jekyll/Plugins to generate content specific to your site h2. Runtime Dependencies From 8886727bd83237d51702c2c565b127cb2adcd4e0 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 11 Mar 2013 22:17:19 +0100 Subject: [PATCH 101/120] Requiring safe_yaml ~> 0.7.0 because 0.8.x has weird bugs. --- jekyll.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 17fb421b..5c9fdaee 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -30,7 +30,7 @@ Gem::Specification.new do |s| s.add_runtime_dependency('kramdown', "~> 0.14") s.add_runtime_dependency('pygments.rb', "~> 0.3.2") s.add_runtime_dependency('commander', "~> 4.1.3") - s.add_runtime_dependency('safe_yaml', "~> 0.7") + s.add_runtime_dependency('safe_yaml', "~> 0.7.0") s.add_development_dependency('rake', "~> 10.0.3") s.add_development_dependency('rdoc', "~> 3.11") From 2053a8fa8c74c5f36bd4e29e8961e19de479cf5e Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 12 Mar 2013 19:07:51 +0100 Subject: [PATCH 102/120] Update history to reflect merge of #847 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index f306e9e3..e620d380 100644 --- a/History.txt +++ b/History.txt @@ -4,6 +4,7 @@ * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Added ability to render drafts in _drafts folder via command line (#833) * Minor Enhancements + * Load in Apache MIME Types on `jekyll serve` (#847) * Improve debugability of error message for a malformed highlight tag (#785) * Allow symlinked files in unsafe mode (#824) * Add 'gist' liquid tag to core (#822) From e8b82348980fd2386845b4852544de7935e693ff Mon Sep 17 00:00:00 2001 From: Daniel Grieve Date: Wed, 13 Mar 2013 18:47:07 +0000 Subject: [PATCH 103/120] ignore .ruby-version --- .gitignore | 1 + .ruby-version | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 .ruby-version diff --git a/.gitignore b/.gitignore index 1bc95092..d1f1f8c5 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ bbin/ gh-pages/ site/_site/ coverage +.ruby-version diff --git a/.ruby-version b/.ruby-version deleted file mode 100644 index e46f9183..00000000 --- a/.ruby-version +++ /dev/null @@ -1 +0,0 @@ -1.8.7-p371 From dbc356f9f4cb3b903e65c02eaff5a26513e91491 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 14 Mar 2013 21:23:34 +0100 Subject: [PATCH 104/120] Bump version to 1.0.0.pre. --- lib/jekyll.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 51011764..cbd7e400 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -52,7 +52,7 @@ require_all 'jekyll/tags' SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll - VERSION = '0.12.0' + VERSION = '1.0.0.pre' # Default options. Overriden by values in _config.yml. # Strings rather than symbols are used for compatability with YAML. From 5c35a84662c5e4fb00e4b7c4e973eeafa16d590c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 14 Mar 2013 21:26:06 +0100 Subject: [PATCH 106/120] Updated version and gemspec to reflect 1.0.0.beta1 release --- jekyll.gemspec | 64 +++++++++++++++++++++++++++++++++++++++++++++++--- lib/jekyll.rb | 2 +- 2 files changed, 62 insertions(+), 4 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index 5c9fdaee..785c185f 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 = '0.12.0' + s.version = '1.0.0.beta1' s.license = 'MIT' - s.date = '2012-12-22' + s.date = '2013-03-14' s.rubyforge_project = 'jekyll' s.summary = "A simple, blog aware, static site generator." @@ -47,7 +47,6 @@ Gem::Specification.new do |s| # = MANIFEST = s.files = %w[ - .travis.yml CONTRIBUTING.md Gemfile History.txt @@ -57,6 +56,7 @@ Gem::Specification.new do |s| bin/jekyll cucumber.yml features/create_sites.feature + features/drafts.feature features/embed_filters.feature features/markdown.feature features/pagination.feature @@ -77,22 +77,76 @@ Gem::Specification.new do |s| lib/jekyll/converters/textile.rb lib/jekyll/convertible.rb lib/jekyll/core_ext.rb + lib/jekyll/draft.rb lib/jekyll/errors.rb lib/jekyll/filters.rb lib/jekyll/generator.rb lib/jekyll/generators/pagination.rb lib/jekyll/layout.rb + lib/jekyll/mime.types lib/jekyll/page.rb lib/jekyll/plugin.rb lib/jekyll/post.rb lib/jekyll/site.rb lib/jekyll/static_file.rb + lib/jekyll/tags/gist.rb lib/jekyll/tags/highlight.rb lib/jekyll/tags/include.rb lib/jekyll/tags/post_url.rb + script/bootstrap + site/.gitignore + site/CNAME + site/README + site/_config.yml + site/_includes/analytics.html + site/_includes/docs_contents.html + site/_includes/footer.html + site/_includes/header.html + site/_includes/section_nav.html + site/_includes/top.html + site/_layouts/default.html + site/_layouts/docs.html + site/_posts/2012-07-01-configuration.md + site/_posts/2012-07-01-contributing.md + site/_posts/2012-07-01-deployment-methods.md + site/_posts/2012-07-01-extras.md + site/_posts/2012-07-01-frontmatter.md + site/_posts/2012-07-01-github-pages.md + site/_posts/2012-07-01-heroku.md + site/_posts/2012-07-01-home.md + site/_posts/2012-07-01-installation.md + site/_posts/2012-07-01-migrations.md + site/_posts/2012-07-01-pages.md + site/_posts/2012-07-01-pagination.md + site/_posts/2012-07-01-permalinks.md + site/_posts/2012-07-01-plugins.md + site/_posts/2012-07-01-posts.md + site/_posts/2012-07-01-resources.md + site/_posts/2012-07-01-sites.md + site/_posts/2012-07-01-structure.md + site/_posts/2012-07-01-templates.md + site/_posts/2012-07-01-troubleshooting.md + site/_posts/2012-07-01-usage.md + site/_posts/2012-07-01-variables.md + site/css/grid.css + site/css/normalize.css + site/css/pygments.css + site/css/style.css + site/docs/index.html + site/favicon.png + site/img/article-footer.png + site/img/footer-arrow.png + site/img/footer-logo.png + site/img/logo-2x.png + site/img/octojekyll.png + site/img/tube.png + site/img/tube1x.png + site/index.html + site/js/modernizr-2.5.3.min.js test/fixtures/broken_front_matter1.erb test/fixtures/broken_front_matter2.erb test/fixtures/broken_front_matter3.erb + test/fixtures/exploit_front_matter.erb test/fixtures/front_matter.erb test/helper.rb test/source/.htaccess @@ -124,9 +178,13 @@ Gem::Specification.new do |s| test/source/_posts/2010-01-16-override-data.textile test/source/_posts/2011-04-12-md-extension.md test/source/_posts/2011-04-12-text-extension.text + test/source/_posts/2013-01-12-nil-layout.textile + test/source/_posts/2013-01-12-no-layout.textile test/source/about.html test/source/category/_posts/2008-9-23-categories.textile test/source/contacts.html + test/source/contacts/bar.html + test/source/contacts/index.html test/source/css/screen.css test/source/deal.with.dots.html test/source/foo/_posts/bar/2008-12-12-topical-post.textile diff --git a/lib/jekyll.rb b/lib/jekyll.rb index cbd7e400..493b8562 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -52,7 +52,7 @@ require_all 'jekyll/tags' SafeYAML::OPTIONS[:suppress_warnings] = true module Jekyll - VERSION = '1.0.0.pre' + VERSION = '1.0.0.beta1' # Default options. Overriden by values in _config.yml. # Strings rather than symbols are used for compatability with YAML. From b49bba93512e6989de1902565ce776ea49207c26 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 16 Mar 2013 13:15:15 +0100 Subject: [PATCH 108/120] Renamed test under wrong name. --- features/site_configuration.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/site_configuration.feature b/features/site_configuration.feature index b9a082fa..c07a3c73 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -3,7 +3,7 @@ Feature: Site configuration I want to be able to configure jekyll In order to make setting up a site easier - Scenario: Change destination directory + Scenario: Change source directory Given I have a blank site in "_sourcedir" And I have an "_sourcedir/index.html" file that contains "Changing source directory" And I have a configuration file with "source" set to "_sourcedir" From 7e1100962ce8b95ef96f498d99ba89fa384d9543 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 16 Mar 2013 14:44:49 +0100 Subject: [PATCH 109/120] Load in config from --config switch --- lib/jekyll.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 493b8562..6e489264 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -129,8 +129,10 @@ module Jekyll # then, we need to know where to look for _config.yml source = override['source'] || Jekyll::DEFAULTS['source'] - # Get configuration from /_config.yml - config_file = File.join(source, '_config.yml') + # Get configuration from /_config.yml or / + config_file = override.delete('config') + config_file = File.join(source, "_config.yml") if config_file.to_s.empty? + begin config = YAML.safe_load_file(config_file) raise "Configuration file: (INVALID) #{config_file}" if !config.is_a?(Hash) From 9100967ebd0a4c4a767af50afd239572040e1816 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 16 Mar 2013 14:46:26 +0100 Subject: [PATCH 110/120] Add unit tests for custom configuration. --- test/test_configuration.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/test_configuration.rb b/test/test_configuration.rb index abaf6117..40b091de 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -25,4 +25,31 @@ class TestConfiguration < Test::Unit::TestCase assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) end end + context "loading config from external file" do + setup do + @paths = { + :default => File.join(Dir.pwd, '_config.yml'), + :other => File.join(Dir.pwd, '_config.live.yml'), + :empty => "" + } + end + + should "load default config if no config_file is set" do + mock(YAML).safe_load_file(@paths[:default]) { Hash.new } + mock($stdout).puts("Configuration file: #{@paths[:default]}") + assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) + end + + should "load different config if specified" do + mock(YAML).safe_load_file(@paths[:other]) { {"baseurl" => "http://wahoo.dev"} } + mock($stdout).puts("Configuration file: #{@paths[:other]}") + assert_equal Jekyll::DEFAULTS.deep_merge({ "baseurl" => "http://wahoo.dev" }), Jekyll.configuration({ "config" => @paths[:other] }) + end + + should "load default config if path passed is empty" do + mock(YAML).safe_load_file(@paths[:default]) { Hash.new } + mock($stdout).puts("Configuration file: #{@paths[:default]}") + assert_equal Jekyll::DEFAULTS, Jekyll.configuration({ "config" => @paths[:empty] }) + end + end end From 7a57451962ea55716c4f3790e39cd350871a76d2 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 16 Mar 2013 14:54:44 +0100 Subject: [PATCH 111/120] Add --config switch to build and serve commands. --- bin/jekyll | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/jekyll b/bin/jekyll index d135b952..1f3a9c8d 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -34,6 +34,7 @@ command :build do |c| c.syntax = 'jekyll build [options]' c.description = 'Build your site' + c.option '--config [CONFIG_FILE]', 'Custom configuration file' c.option '--future', 'Publishes posts with a future date' c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish' c.option '-w', '--watch', 'Watch for changes and rebuild' @@ -52,6 +53,7 @@ command :serve do |c| c.syntax = 'jekyll serve [options]' c.description = 'Serve your site locally' + c.option '--config [CONFIG_FILE]', 'Custom configuration file' c.option '--future', 'Publishes posts with a future date' c.option '--limit_posts MAX_POSTS', 'Limits the number of posts to parse and publish' c.option '-w', '--watch', 'Watch for changes and rebuild' From 7425b2c32e92ef33da8c7cc68f128fe4ec39602f Mon Sep 17 00:00:00 2001 From: Tommy Sullivan Date: Sat, 16 Mar 2013 15:12:30 +0100 Subject: [PATCH 112/120] Add test to ensure plugins are executed in order of priority. --- test/source/_plugins/dummy.rb | 8 ++++++++ test/test_site.rb | 5 +++++ 2 files changed, 13 insertions(+) create mode 100644 test/source/_plugins/dummy.rb diff --git a/test/source/_plugins/dummy.rb b/test/source/_plugins/dummy.rb new file mode 100644 index 00000000..bfd46e1c --- /dev/null +++ b/test/source/_plugins/dummy.rb @@ -0,0 +1,8 @@ +module Jekyll + class Dummy < Generator + priority :high + + def generate(site) + end + end +end diff --git a/test/test_site.rb b/test/test_site.rb index a6b5c2f4..f9851875 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -124,6 +124,11 @@ class TestSite < Test::Unit::TestCase assert_equal mtime3, mtime4 # no modifications, so must be the same end + should "setup plugins in priority order" do + assert_equal @site.converters.sort_by(&:class).map{|c|c.class.priority}, @site.converters.map{|c|c.class.priority} + assert_equal @site.generators.sort_by(&:class).map{|g|g.class.priority}, @site.generators.map{|g|g.class.priority} + end + should "read layouts" do @site.read_layouts assert_equal ["default", "simple"].sort, @site.layouts.keys.sort From 10ee5c8999626ce91746c3720f6051475e3e58d0 Mon Sep 17 00:00:00 2001 From: Matt Rogers Date: Sat, 16 Mar 2013 15:19:32 +0100 Subject: [PATCH 113/120] Remove the duplication when creating Converters and Generators Encapsulate it in a method and give the method the class to walk the subclass tree for to create new objects. --- lib/jekyll/site.rb | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 94c4b1a0..da7f7f8b 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -88,17 +88,8 @@ module Jekyll end end - self.converters = Jekyll::Converter.subclasses.select do |c| - !self.safe || c.safe - end.map do |c| - c.new(self.config) - end - - self.generators = Jekyll::Generator.subclasses.select do |c| - !self.safe || c.safe - end.map do |c| - c.new(self.config) - end + self.converters = instantiate_subclasses(Jekyll::Converter) + self.generators = instantiate_subclasses(Jekyll::Generator) end # Internal: Setup the plugin search path @@ -388,6 +379,21 @@ module Jekyll end end + # Create array of instances of the subclasses of the class or module + # passed in as argument. + # + # klass - class or module containing the subclasses which should be + # instantiated + # + # Returns array of instances of subclasses of parameter + def instantiate_subclasses(klass) + klass.subclasses.select do |c| + !self.safe || c.safe + end.map do |c| + c.new(self.config) + end + end + # Read the entries from a particular directory for processing # # dir - The String relative path of the directory to read From caa6a4ebfd7b60d824a7a31c288c9038e2e1cbae Mon Sep 17 00:00:00 2001 From: Tommy Sullivan Date: Sat, 16 Mar 2013 15:24:12 +0100 Subject: [PATCH 114/120] Sort instantiated subclasses in Site. --- lib/jekyll/site.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index da7f7f8b..3b21c6ad 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -389,7 +389,7 @@ module Jekyll def instantiate_subclasses(klass) klass.subclasses.select do |c| !self.safe || c.safe - end.map do |c| + end.sort.map do |c| c.new(self.config) end end From 1d05e0be81a0cb596c34c1c69493b6feb9c7ef38 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 16 Mar 2013 20:06:40 +0100 Subject: [PATCH 115/120] Added tests for generators. --- test/test_site.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/test_site.rb b/test/test_site.rb index a6b5c2f4..00c2766e 100644 --- a/test/test_site.rb +++ b/test/test_site.rb @@ -45,6 +45,21 @@ class TestSite < Test::Unit::TestCase assert_equal Hash.new, @site.tags end + should "give site with parsed pages and posts to generators" do + @site.reset + @site.read + class MyGenerator < Generator + def generate(site) + site.pages.dup.each do |page| + raise "#{page} isn't a page" unless page.is_a?(Page) + raise "#{page} doesn't respond to :name" unless page.respond_to?(:name) + end + end + end + @site.generate + assert_not_equal 0, @site.pages.size + end + should "reset data before processing" do clear_dest @site.process From 39f144ed0182b95ba49e651ae3c0eea66ffcd007 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 16 Mar 2013 20:06:50 +0100 Subject: [PATCH 116/120] Newline. --- test/suite.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/suite.rb b/test/suite.rb index 98923ca1..81b61719 100644 --- a/test/suite.rb +++ b/test/suite.rb @@ -8,4 +8,4 @@ require 'test/unit' tests = Dir[File.expand_path("#{File.dirname(__FILE__)}/test_*.rb")] tests.each do |file| require file -end \ No newline at end of file +end From bdc3d67799b87d6a5ea511ef0eef64bde2d5efd6 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 16 Mar 2013 20:09:22 +0100 Subject: [PATCH 117/120] Update history to reflect merge of #863 --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index e620d380..177d1e76 100644 --- a/History.txt +++ b/History.txt @@ -4,6 +4,7 @@ * Removed importers/migrators from main project, migrated to jekyll-import sub-gem (#793) * Added ability to render drafts in _drafts folder via command line (#833) * Minor Enhancements + * Accept custom configuration file via CLI (#863) * Load in Apache MIME Types on `jekyll serve` (#847) * Improve debugability of error message for a malformed highlight tag (#785) * Allow symlinked files in unsafe mode (#824) From df7b9f4f01d1a55f4ba19beca6f41dbf3b00da83 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 16 Mar 2013 20:11:11 +0100 Subject: [PATCH 118/120] Update history to reflect merge of #864. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 177d1e76..5948d62a 100644 --- a/History.txt +++ b/History.txt @@ -27,6 +27,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * Order plugin execution by priority (#864) * Fixed Page#dir and Page#url for edge cases (#536) * Fix broken post_url with posts with a time in their YAML Front-Matter (#831) * Look for plugins under the source directory (#654) From 23a01e77661bba6cb4a8e31de972bc4a17fcc39c Mon Sep 17 00:00:00 2001 From: paco Date: Sat, 16 Mar 2013 21:20:04 +0100 Subject: [PATCH 119/120] Patch for multibyte URI problem. Closes #723. --- lib/jekyll/commands/serve.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/commands/serve.rb b/lib/jekyll/commands/serve.rb index a12096ae..ae28665b 100644 --- a/lib/jekyll/commands/serve.rb +++ b/lib/jekyll/commands/serve.rb @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- module Jekyll module Commands class Serve < Command @@ -12,13 +13,17 @@ module Jekyll mime_types_file = File.expand_path('../mime.types', File.dirname(__FILE__)) mime_types = WEBrick::HTTPUtils::load_mime_types(mime_types_file) + # recreate NondisclosureName under utf-8 circumstance + fh_option = WEBrick::Config::FileHandler + fh_option[:NondisclosureName] = ['.ht*','~*'] + s = HTTPServer.new( :Port => options['port'], :BindAddress => options['host'], :MimeTypes => mime_types ) - s.mount(options['baseurl'], HTTPServlet::FileHandler, destination) + s.mount(options['baseurl'], HTTPServlet::FileHandler, destination, fh_option) t = Thread.new { s.start } trap("INT") { s.shutdown } t.join() From 9ae7ca008be9ef6ee44ff039c3c2e5b9ec6a9c27 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 16 Mar 2013 21:21:13 +0100 Subject: [PATCH 120/120] Update history to reflect merge of #723. --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index 5948d62a..18c26a0a 100644 --- a/History.txt +++ b/History.txt @@ -27,6 +27,7 @@ * Add source and destination directory protection (#535) * Better YAML error message (#718) * Bug Fixes + * Patch for multibyte URI problem with jekyll serve (#723) * Order plugin execution by priority (#864) * Fixed Page#dir and Page#url for edge cases (#536) * Fix broken post_url with posts with a time in their YAML Front-Matter (#831)