From 4cc0873172db3112839373e73b6f9caea9d562ec Mon Sep 17 00:00:00 2001 From: Patrick Crowley Date: Thu, 22 Oct 2009 21:14:05 -0700 Subject: [PATCH 01/15] updated pygments output to wrap code blocks with tags --- lib/jekyll/tags/highlight.rb | 13 ++++++++++--- test/test_tags.rb | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index eb069c270f6..067a487f27f 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -31,11 +31,11 @@ def render(context) def render_pygments(context, code) if context["content_type"] == "markdown" - return "\n" + Albino.new(code, @lang).to_s(@options) + "\n" + return "\n" + add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + "\n" elsif context["content_type"] == "textile" - return "" + Albino.new(code, @lang).to_s(@options) + "" + return "" + add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + "" else - return Albino.new(code, @lang).to_s(@options) + return add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) end end @@ -49,6 +49,13 @@ def render_codehighlighter(context, code) HTML end + + def add_code_tags(code, lang) + # Add nested tags to code blocks + code = code.sub(/
/,'
')
+      code = code.sub(/<\/pre>/,"
") + end + end end diff --git a/test/test_tags.rb b/test/test_tags.rb index 0c3caa6d60d..6411957272c 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -49,7 +49,7 @@ def fill_post(code, override = {}) end should "render markdown with pygments line handling" do - assert_match %{
test\n
}, @result + assert_match %{
test\n
}, @result end end @@ -59,7 +59,7 @@ def fill_post(code, override = {}) end should "render markdown with pygments line handling" do - assert_match %{
Æ\n
}, @result + assert_match %{
Æ\n
}, @result end end From e3bd1c88e9ad6c9d6c89a543ca72c82a289b6bd7 Mon Sep 17 00:00:00 2001 From: Patrick Crowley Date: Fri, 23 Oct 2009 08:03:25 -0700 Subject: [PATCH 02/15] refactored render_pygments to remove duplicate code --- lib/jekyll/tags/highlight.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 067a487f27f..93d94868389 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -30,12 +30,11 @@ def render(context) end def render_pygments(context, code) + output = add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) if context["content_type"] == "markdown" - return "\n" + add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + "\n" + return "\n" + output + "\n" elsif context["content_type"] == "textile" - return "" + add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + "" - else - return add_code_tags(Albino.new(code, @lang).to_s(@options), @lang) + return "" + output + "" end end From 597c7a7904198d92aa5eacad356019165685c311 Mon Sep 17 00:00:00 2001 From: Gregor Schmidt Date: Tue, 24 Nov 2009 21:40:56 +0100 Subject: [PATCH 03/15] changes to stdout and -err - tests and behaviour By using $stdin adn $stderr instead of STDIN and STDERR it is possible to capture or redirect them using in process ruby code without the need to manage pipes and external processes --- lib/jekyll.rb | 6 +++--- test/test_configuration.rb | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/jekyll.rb b/lib/jekyll.rb index 8a27e1614be..795c705c754 100644 --- a/lib/jekyll.rb +++ b/lib/jekyll.rb @@ -67,10 +67,10 @@ def self.configuration(override) begin config = YAML.load_file(config_file) raise "Invalid configuration - #{config_file}" if !config.is_a?(Hash) - STDOUT.puts "Configuration from #{config_file}" + $stdout.puts "Configuration from #{config_file}" rescue => err - STDERR.puts "WARNING: Could not read configuration. Using defaults (and options)." - STDERR.puts "\t" + err.to_s + $stderr.puts "WARNING: Could not read configuration. Using defaults (and options)." + $stderr.puts "\t" + err.to_s config = {} end diff --git a/test/test_configuration.rb b/test/test_configuration.rb index 3b05ed51ab0..c6d5ad6c32b 100644 --- a/test/test_configuration.rb +++ b/test/test_configuration.rb @@ -8,21 +8,21 @@ class TestConfiguration < Test::Unit::TestCase 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($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(STDOUT).puts("Configuration from #{@path}") + 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(STDERR).puts("WARNING: Could not read configuration. Using defaults (and options).") - mock(STDERR).puts("\tInvalid configuration - #{@path}") + mock($stderr).puts("WARNING: Could not read configuration. Using defaults (and options).") + mock($stderr).puts("\tInvalid configuration - #{@path}") assert_equal Jekyll::DEFAULTS, Jekyll.configuration({}) end end From 5a37e0d96ed2a5ba6ca25d60a5f3d23a26267b11 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 16:11:47 -0800 Subject: [PATCH 04/15] update history --- History.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/History.txt b/History.txt index 2cbaa68ccdf..82180ba8d82 100644 --- a/History.txt +++ b/History.txt @@ -1,3 +1,12 @@ +== + * Bug Fixes + * Fix pagination % 0 bug (#78) + * Ensure all posts are processed first (#71) + +== NOTE + * After this point I will no longer be giving credit in the history; + that is what the commit log is for. + == 0.5.4 / 2009-08-23 * Bug Fixes * Do not allow symlinks (security vulnerability) From c569f5e641df72bdeb2517ca9e111268e1d4eb7e Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 16:12:09 -0800 Subject: [PATCH 05/15] Version bump to 0.5.5 --- VERSION.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/VERSION.yml b/VERSION.yml index 66ebe587c3a..0644632985f 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,4 +1,5 @@ --- -:patch: 4 +:patch: 5 :major: 0 :minor: 5 +:build: From 59ee8a68693d80a1a9461b59095328f60374c318 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 16:12:44 -0800 Subject: [PATCH 06/15] Regenerated gemspec for version 0.5.5 --- jekyll.gemspec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index aaba390eb1c..ba291d5601c 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -1,12 +1,15 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{jekyll} - s.version = "0.5.4" + s.version = "0.5.5" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Tom Preston-Werner"] - s.date = %q{2009-08-24} + s.date = %q{2010-01-08} s.default_executable = %q{jekyll} s.description = %q{Jekyll is a simple, blog aware, static site generator.} s.email = %q{tom@mojombo.com} @@ -47,6 +50,7 @@ Gem::Specification.new do |s| "lib/jekyll/pager.rb", "lib/jekyll/post.rb", "lib/jekyll/site.rb", + "lib/jekyll/static_file.rb", "lib/jekyll/tags/highlight.rb", "lib/jekyll/tags/include.rb", "test/helper.rb", @@ -133,3 +137,4 @@ Gem::Specification.new do |s| s.add_dependency(%q, [">= 0.9.6"]) end end + From 52b82af6e2fd7e25154d5b977bde6f50482e200f Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 17:21:26 -0800 Subject: [PATCH 07/15] update history --- History.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/History.txt b/History.txt index 82180ba8d82..3895619bb67 100644 --- a/History.txt +++ b/History.txt @@ -1,4 +1,8 @@ == + * Bug Fixes + * Require redcloth >= 4.2.1 in tests (#92) + +== 0.5.5 * Bug Fixes * Fix pagination % 0 bug (#78) * Ensure all posts are processed first (#71) From c89d8dd0f39f421e135e07e86efad8861facacc9 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 17:26:48 -0800 Subject: [PATCH 08/15] allow .mkd as a markdown extension --- History.txt | 2 ++ lib/jekyll/convertible.rb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/History.txt b/History.txt index 3895619bb67..5e415d545f9 100644 --- a/History.txt +++ b/History.txt @@ -1,6 +1,8 @@ == * Bug Fixes * Require redcloth >= 4.2.1 in tests (#92) + * Minor Enhancements + * Allow .mkd as markdown extension == 0.5.5 * Bug Fixes diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index f0348ab59ed..3e733d72cd2 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -49,7 +49,7 @@ def content_type case self.ext[1..-1] when /textile/i return 'textile' - when /markdown/i, /mkdn/i, /md/i + when /markdown/i, /mkdn/i, /md/i, /mkd/i return 'markdown' end return 'unknown' From 4c1021d597eeebc6930bbbfe654458c7f74fce77 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 18:04:36 -0800 Subject: [PATCH 09/15] don't prematurely terminate front matter on mid-line triple dashes. fixes #93 --- History.txt | 1 + lib/jekyll/convertible.rb | 2 +- .../_posts/2010-01-08-triple-dash.markdown | 5 +++++ test/test_generated_site.rb | 2 +- test/test_post.rb | 16 ++++++++++++++-- 5 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 test/source/_posts/2010-01-08-triple-dash.markdown diff --git a/History.txt b/History.txt index 5e415d545f9..c1aaa7a024c 100644 --- a/History.txt +++ b/History.txt @@ -1,6 +1,7 @@ == * Bug Fixes * Require redcloth >= 4.2.1 in tests (#92) + * Don't break on triple dashes in yaml frontmatter (#93) * Minor Enhancements * Allow .mkd as markdown extension diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 3e733d72cd2..fd63f57a0da 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -18,7 +18,7 @@ def to_s def read_yaml(base, name) self.content = File.read(File.join(base, name)) - if self.content =~ /^(---\s*\n.*?\n?)(---.*?\n)/m + if self.content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m self.content = self.content[($1.size + $2.size)..-1] self.data = YAML.load($1) diff --git a/test/source/_posts/2010-01-08-triple-dash.markdown b/test/source/_posts/2010-01-08-triple-dash.markdown new file mode 100644 index 00000000000..cbb79e7a002 --- /dev/null +++ b/test/source/_posts/2010-01-08-triple-dash.markdown @@ -0,0 +1,5 @@ +--- +title: Foo --- Bar +--- + +Triple the fun! \ No newline at end of file diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index fe9878e9702..357dd4db6e9 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase end should "ensure post count is as expected" do - assert_equal 17, @site.posts.size + assert_equal 18, @site.posts.size end should "insert site.posts into the index" do diff --git a/test/test_post.rb b/test/test_post.rb index 649e2f46a97..b4b4502dc2b 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -77,7 +77,19 @@ def do_render(post) @post.read_yaml(@source, @real_file) assert_equal({"title" => "Test title", "layout" => "post", "tag" => "Ruby"}, @post.data) - assert_equal "\r\nThis is the content", @post.content + assert_equal "This is the content", @post.content + end + end + + context "with embedded triple dash" do + setup do + @real_file = "2010-01-08-triple-dash.markdown" + end + should "consume the embedded dashes" do + @post.read_yaml(@source, @real_file) + + assert_equal({"title" => "Foo --- Bar"}, @post.data) + assert_equal "Triple the fun!", @post.content end end @@ -163,7 +175,7 @@ def do_render(post) @post.read_yaml(@source, @real_file) assert_equal({"title" => "Foo Bar", "layout" => "default"}, @post.data) - assert_equal "\nh1. {{ page.title }}\n\nBest *post* ever", @post.content + assert_equal "h1. {{ page.title }}\n\nBest *post* ever", @post.content end should "transform textile" do From d020d4f2bf34b8ace0d0e4b6409d031196648152 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 18:09:36 -0800 Subject: [PATCH 10/15] update history --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index c1aaa7a024c..a9ab47ec7b4 100644 --- a/History.txt +++ b/History.txt @@ -4,6 +4,7 @@ * Don't break on triple dashes in yaml frontmatter (#93) * Minor Enhancements * Allow .mkd as markdown extension + * Use $stdout/err instead of constants (#99) == 0.5.5 * Bug Fixes From 60fed241cd17b679e654a18e731e20908491d2f0 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 18:14:31 -0800 Subject: [PATCH 11/15] better deps in readme. fixes #87. fixes #88 --- README.textile | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/README.textile b/README.textile index d5165711fad..f32432f61c8 100644 --- a/README.textile +++ b/README.textile @@ -20,14 +20,21 @@ h2. Diving In * 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 -h2. Dependencies - -* RedCloth: Textile support -* Liquid: Templating system -* Classifier: Generating related posts -* Maruku: Default markdown engine -* Directory Watcher: Auto-regeneration of sites -* Open4: Talking to pygments for syntax highlighting +h2. Runtime Dependencies + +* RedCloth: Textile support (Ruby) +* Liquid: Templating system (Ruby) +* Classifier: Generating related posts (Ruby) +* Maruku: Default markdown engine (Ruby) +* Directory Watcher: Auto-regeneration of sites (Ruby) +* Open4: Talking to pygments for syntax highlighting (Ruby) +* Pygments: Syntax highlighting (Python) + +h2. Developer Dependencies + +* Shoulda: Test framework (Ruby) +* RR: Mocking (Ruby) +* RedGreen: Nicer test output (Ruby) h2. License From add546f61e5b441d028151a7617213fb52f52b4b Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 18:27:05 -0800 Subject: [PATCH 12/15] update history --- History.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/History.txt b/History.txt index a9ab47ec7b4..d01f63b48b5 100644 --- a/History.txt +++ b/History.txt @@ -5,6 +5,7 @@ * Minor Enhancements * Allow .mkd as markdown extension * Use $stdout/err instead of constants (#99) + * Properly wrap code blocks (#91) == 0.5.5 * Bug Fixes From 602a252364e09dcc000e4b796814df4ea64f0727 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 18:59:35 -0800 Subject: [PATCH 13/15] add javascript mime type for webrick. fixes #98 --- History.txt | 1 + bin/jekyll | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/History.txt b/History.txt index d01f63b48b5..29a6a2ddfee 100644 --- a/History.txt +++ b/History.txt @@ -6,6 +6,7 @@ * Allow .mkd as markdown extension * Use $stdout/err instead of constants (#99) * Properly wrap code blocks (#91) + * Add javascript mime type for webrick (#98) == 0.5.5 * Bug Fixes diff --git a/bin/jekyll b/bin/jekyll index 3e8469e1e92..6e03d48bdaa 100755 --- a/bin/jekyll +++ b/bin/jekyll @@ -137,9 +137,13 @@ if options['server'] FileUtils.mkdir_p(destination) + mime_types = WEBrick::HTTPUtils::DefaultMimeTypes + mime_types.store 'js', 'application/javascript' + s = HTTPServer.new( :Port => options['server_port'], - :DocumentRoot => destination + :DocumentRoot => destination, + :MimeTypes => mime_types ) t = Thread.new { s.start From 98f3767af397ed06ec6fb1bb0b4f4a204f21b149 Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 19:23:10 -0800 Subject: [PATCH 14/15] Version bump to 0.5.6 --- History.txt | 4 ++-- VERSION.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/History.txt b/History.txt index 29a6a2ddfee..8e5220f5ab7 100644 --- a/History.txt +++ b/History.txt @@ -1,4 +1,4 @@ -== +== 0.5.6 / 2010-01-08 * Bug Fixes * Require redcloth >= 4.2.1 in tests (#92) * Don't break on triple dashes in yaml frontmatter (#93) @@ -8,7 +8,7 @@ * Properly wrap code blocks (#91) * Add javascript mime type for webrick (#98) -== 0.5.5 +== 0.5.5 / 2010-01-08 * Bug Fixes * Fix pagination % 0 bug (#78) * Ensure all posts are processed first (#71) diff --git a/VERSION.yml b/VERSION.yml index 0644632985f..a4ed05e5a77 100644 --- a/VERSION.yml +++ b/VERSION.yml @@ -1,5 +1,5 @@ --- -:patch: 5 -:major: 0 :minor: 5 +:patch: 6 :build: +:major: 0 From c92eb564d2c0603c722cf292f16628954dabcf7e Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Fri, 8 Jan 2010 19:23:35 -0800 Subject: [PATCH 15/15] Regenerated gemspec for version 0.5.6 --- jekyll.gemspec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jekyll.gemspec b/jekyll.gemspec index ba291d5601c..9bac57182c6 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |s| s.name = %q{jekyll} - s.version = "0.5.5" + s.version = "0.5.6" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Tom Preston-Werner"] @@ -71,6 +71,7 @@ Gem::Specification.new do |s| "test/source/_posts/2009-05-18-tags.textile", "test/source/_posts/2009-06-22-empty-yaml.textile", "test/source/_posts/2009-06-22-no-yaml.textile", + "test/source/_posts/2010-01-08-triple-dash.markdown", "test/source/about.html", "test/source/category/_posts/2008-9-23-categories.textile", "test/source/contacts.html",