Skip to content

Commit

Permalink
merged 'mojombo/master' at 'v0.5.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
krisb committed Jan 9, 2010
2 parents 7806a0d + c92eb56 commit 2a7b1cb
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 39 deletions.
23 changes: 19 additions & 4 deletions History.txt
@@ -1,10 +1,25 @@
== edge
== Edge
* Enhancements
* added support for extensions [issue #100]

== 0.5.6 / 2010-01-08
* Bug Fixes
* changed tests to require redcloth >= 4.2.1 [issue #92]
* fixed pagination when number of pages is an exact multiple of max per page [issue #78]
* fixed rendering order of site artifacts [issue #71]
* 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
* Use $stdout/err instead of constants (#99)
* Properly wrap code blocks (#91)
* Add javascript mime type for webrick (#98)

== 0.5.5 / 2010-01-08
* 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
Expand Down
23 changes: 15 additions & 8 deletions README.textile
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions VERSION.yml
@@ -1,4 +1,5 @@
---
:patch: 4
:major: 0
:minor: 5
:patch: 6
:build:
:major: 0
6 changes: 5 additions & 1 deletion bin/jekyll
Expand Up @@ -145,9 +145,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
Expand Down
12 changes: 7 additions & 5 deletions krisb-jekyll.gemspec → jekyll.gemspec
@@ -1,15 +1,15 @@
# Generated by jeweler
# DO NOT EDIT THIS FILE DIRECTLY
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{krisb-jekyll}
s.version = "0.5.4"
s.name = %q{jekyll}
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", "Kris Brown"]
s.date = %q{2010-01-05}
s.authors = ["Tom Preston-Werner"]
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{kris@kris.me.uk}
Expand Down Expand Up @@ -50,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",
Expand All @@ -70,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",
Expand Down
6 changes: 3 additions & 3 deletions lib/jekyll.rb
Expand Up @@ -69,10 +69,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

Expand Down
4 changes: 2 additions & 2 deletions lib/jekyll/convertible.rb
Expand Up @@ -22,7 +22,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)
Expand Down Expand Up @@ -53,7 +53,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'
Expand Down
14 changes: 10 additions & 4 deletions lib/jekyll/tags/highlight.rb
Expand Up @@ -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" + Albino.new(code, @lang).to_s(@options) + "\n"
return "\n" + output + "\n"
elsif context["content_type"] == "textile"
return "<notextile>" + Albino.new(code, @lang).to_s(@options) + "</notextile>"
else
return Albino.new(code, @lang).to_s(@options)
return "<notextile>" + output + "</notextile>"
end
end

Expand All @@ -49,6 +48,13 @@ def render_codehighlighter(context, code)
</div>
HTML
end

def add_code_tags(code, lang)
# Add nested <code> tags to code blocks
code = code.sub(/<pre>/,'<pre><code class="' + lang + '">')
code = code.sub(/<\/pre>/,"</code></pre>")
end

end

end
Expand Down
5 changes: 5 additions & 0 deletions test/source/_posts/2010-01-08-triple-dash.markdown
@@ -0,0 +1,5 @@
---
title: Foo --- Bar
---

Triple the fun!
10 changes: 5 additions & 5 deletions test/test_configuration.rb
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/test_generated_site.rb
Expand Up @@ -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
Expand Down
16 changes: 14 additions & 2 deletions test/test_post.rb
Expand Up @@ -78,7 +78,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

Expand Down Expand Up @@ -164,7 +176,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
Expand Down
4 changes: 2 additions & 2 deletions test/test_tags.rb
Expand Up @@ -49,7 +49,7 @@ def fill_post(code, override = {})
end

should "render markdown with pygments line handling" do
assert_match %{<pre>test\n</pre>}, @result
assert_match %{<pre><code class='text'>test\n</code></pre>}, @result
end
end

Expand All @@ -59,7 +59,7 @@ def fill_post(code, override = {})
end

should "render markdown with pygments line handling" do
assert_match %{<pre>Æ\n</pre>}, @result
assert_match %{<pre><code class='text'>Æ\n</code></pre>}, @result
end
end

Expand Down

0 comments on commit 2a7b1cb

Please sign in to comment.