Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/mojombo/jekyll
Browse files Browse the repository at this point in the history
  • Loading branch information
ealdent committed Feb 12, 2009
2 parents 0ff75b3 + 9a81255 commit 598bc99
Show file tree
Hide file tree
Showing 17 changed files with 225 additions and 134 deletions.
11 changes: 11 additions & 0 deletions History.txt
@@ -1,4 +1,12 @@
==
* Minor Enhancements
* Changed date format on wordpress converter (zeropadding) [github.com/dysinger]
* Bug Fixes
* Add jekyll binary as executable to gemspec [github.com/dysinger]

== 0.4.0 / 2009-02-03
* Major Enhancements
* Switch to Jeweler for packaging tasks
* Minor Enhancements
* Type importer [github.com/codeslinger]
* site.topics accessor [github.com/baz]
Expand All @@ -7,10 +15,13 @@
* Add a working Mephisto / MySQL converter [github.com/ivey]
* Allowing .htaccess files to be copied over into the generated site [github.com/briandoll]
* Add option to not put file date in permalink URL [github.com/mreid]
* Add line number capabilities to highlight blocks [github.com/jcon]
* Bug Fixes
* Fix permalink behavior [github.com/cavalle]
* Fixed an issue with pygments, markdown, and newlines [github.com/zpinter]
* Ampersands need to be escaped [github.com/pufuwozu, github.com/ap]
* Test and fix the site.categories hash [github.com/zzot]
* Fix site payload available to files [github.com/matrix9180]

== 0.3.0 / 2008-12-24
* Major Enhancements
Expand Down
40 changes: 0 additions & 40 deletions Manifest.txt

This file was deleted.

62 changes: 39 additions & 23 deletions README.textile
Expand Up @@ -342,17 +342,33 @@ The argument to <code>highlight</code> is the language identifier. To find the
appropriate identifier to use for your favorite language, look for the "short
name" on the "Lexers":http://pygments.org/docs/lexers/ page.

There is a second argument to <code>highlight</code> called
<code>linenos</code> that is optional. Including the <code>linenos</code>
argument will force the highlighted code to include line numbers. For
instance, the following code block would include line numbers next to each
line:

<pre>
{% highlight ruby linenos %}
def foo
puts 'foo'
end
{% endhighlight %}
</pre>

In order for the highlighting to show up, you'll need to include a
highlighting stylesheet. For an example stylesheet you can look at
"syntax.css":http://github.com/mojombo/tpw/tree/master/css/syntax.css. These
are the same styles as used by GitHub and you are free to use them for your
own site.
own site. If you use linenos, you might want to include an additional CSS
class definition for <code>lineno</code> in syntax.css to distinguish the line
numbers from the highlighted code.

h2. Categories

Posts are placed into categories based on the directory structure they are found
within (see above for an example). The categories can be accessed from within
a Liquid template as follows:
Posts are placed into categories based on the directory structure they are
found within (see above for an example). The categories can be accessed from
within a Liquid template as follows:

<pre>
{% for post in site.categories.foo %}
Expand All @@ -364,25 +380,6 @@ This would list all the posts in the category 'foo' by date and title.

The posts within each category are sorted in reverse chronological order.

h2. Contribute

If you'd like to hack on Jekyll, grab the source from GitHub. To get
all of the dependencies, install the gem first.

$ git clone git://github.com/mojombo/jekyll

The best way to get your changes merged back into core is as follows:

# Fork mojombo/jekyll on GitHub
# Clone down your fork
# Create a topic branch to contain your change
# Hack away
# If you are adding new functionality, document it in README.textile
# Do not change the version number, I will do that on my end
# If necessary, rebase your commits into logical chunks, without errors
# Push the branch up to GitHub
# Send me (mojombo) a pull request for your branch

h2. Blog migrations

h3. Movable Type
Expand Down Expand Up @@ -433,6 +430,25 @@ The hostname defaults to _localhost_, all other variables are needed
You may need to adjust the code used to filter entries. Left alone,
it will attempt to pull all entries that are live or sticky.

h2. Contribute

If you'd like to hack on Jekyll, start by forking my repo on GitHub:

http://github.com/mojombo/jekyll

To get all of the dependencies, install the gem first. The best way to get
your changes merged back into core is as follows:

# Clone down your fork
# Create a topic branch to contain your change
# Hack away
# Add tests and make sure everything still passes by running `rake`
# If you are adding new functionality, document it in README.textile
# Do not change the version number, I will do that on my end
# If necessary, rebase your commits into logical chunks, without errors
# Push the branch up to GitHub
# Send me (mojombo) a pull request for your branch

h2. License

(The MIT License)
Expand Down
63 changes: 54 additions & 9 deletions Rakefile
@@ -1,18 +1,63 @@
require 'rubygems'
require 'hoe'
require 'lib/jekyll'

Hoe.new('jekyll', Jekyll::VERSION) do |p|
p.developer('Tom Preston-Werner', 'tom@mojombo.com')
p.summary = "Jekyll is a simple, blog aware, static site generator."
p.extra_deps = ['RedCloth', 'liquid', 'classifier', 'maruku', 'directory_watcher', 'open4']
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

begin
require 'jeweler'
Jeweler::Tasks.new do |s|
s.name = "jekyll"
s.summary = %Q{Jekyll is a simple, blog aware, static site generator.}
s.email = "tom@mojombo.com"
s.homepage = "http://github.com/mojombo/jekyll"
s.description = "Jekyll is a simple, blog aware, static site generator."
s.authors = ["Tom Preston-Werner"]
s.rubyforge_project = "jekyll"
s.add_dependency('RedCloth', '>= 4.0.4')
s.add_dependency('liquid', '>= 1.9.0')
s.add_dependency('classifier', '>= 1.3.1')
s.add_dependency('maruku', '>= 0.5.9')
s.add_dependency('directory_watcher', '>= 1.1.1')
s.add_dependency('open4', '>= 0.9.6')
end
rescue LoadError
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end

Rake::TestTask.new do |t|
t.libs << 'lib'
t.pattern = 'test/**/test_*.rb'
t.verbose = false
end

Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'jekyll'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end

begin
require 'rcov/rcovtask'
Rcov::RcovTask.new do |t|
t.libs << 'test'
t.test_files = FileList['test/**/test_*.rb']
t.verbose = true
end
rescue LoadError
end

task :default => :test

# console

desc "Open an irb session preloaded with this library"
task :console do
sh "irb -rubygems -r ./lib/jekyll.rb"
sh "irb -rubygems -I lib -r jekyll.rb"
end

# converters

namespace :convert do
desc "Migrate from mephisto in the current directory"
task :mephisto do
Expand Down
4 changes: 4 additions & 0 deletions VERSION.yml
@@ -0,0 +1,4 @@
---
:minor: 4
:patch: 1
:major: 0
6 changes: 5 additions & 1 deletion bin/jekyll
Expand Up @@ -51,7 +51,11 @@ opts = OptionParser.new do |opts|
opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|
Jekyll.permalink_style = (style || 'date').to_sym
end


opts.on("--version", "Display current version") do
puts "Jekyll " + Jekyll.version
exit 0
end
end

opts.parse!
Expand Down
55 changes: 27 additions & 28 deletions jekyll.gemspec
@@ -1,51 +1,50 @@
# -*- encoding: utf-8 -*-

Gem::Specification.new do |s|
s.name = %q{jekyll}
s.version = "0.3.0"
s.version = "0.4.1"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Tom Preston-Werner"]
s.date = %q{2009-01-21}
s.date = %q{2009-02-10}
s.default_executable = %q{jekyll}
s.email = ["tom@mojombo.com"]
s.description = %q{Jekyll is a simple, blog aware, static site generator.}
s.email = %q{tom@mojombo.com}
s.executables = ["jekyll"]
s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
s.files = ["History.txt", "Manifest.txt", "README.textile", "Rakefile", "bin/jekyll", "jekyll.gemspec", "lib/jekyll.rb", "lib/jekyll/albino.rb", "lib/jekyll/converters/csv.rb", "lib/jekyll/converters/mephisto.rb", "lib/jekyll/converters/mt.rb", "lib/jekyll/converters/textpattern.rb", "lib/jekyll/converters/typo.rb", "lib/jekyll/converters/wordpress.rb", "lib/jekyll/convertible.rb", "lib/jekyll/core_ext.rb", "lib/jekyll/filters.rb", "lib/jekyll/layout.rb", "lib/jekyll/page.rb", "lib/jekyll/post.rb", "lib/jekyll/site.rb", "lib/jekyll/tags/highlight.rb", "lib/jekyll/tags/include.rb", "test/helper.rb", "test/source/_includes/sig.markdown", "test/source/_layouts/default.html", "test/source/_layouts/simple.html", "test/source/_posts/2008-10-18-foo-bar.textile", "test/source/_posts/2008-11-21-complex.textile", "test/source/_posts/2008-12-03-permalinked-post.textile", "test/source/_posts/2008-12-13-include.markdown", "test/source/css/screen.css", "test/source/index.html", "test/suite.rb", "test/test_filters.rb", "test/test_generated_site.rb", "test/test_jekyll.rb", "test/test_post.rb", "test/test_site.rb", "test/test_tags.rb"]
s.files = ["History.txt", "README.textile", "VERSION.yml", "bin/jekyll", "lib/jekyll", "lib/jekyll/albino.rb", "lib/jekyll/converters", "lib/jekyll/converters/csv.rb", "lib/jekyll/converters/mephisto.rb", "lib/jekyll/converters/mt.rb", "lib/jekyll/converters/textpattern.rb", "lib/jekyll/converters/typo.rb", "lib/jekyll/converters/wordpress.rb", "lib/jekyll/convertible.rb", "lib/jekyll/core_ext.rb", "lib/jekyll/filters.rb", "lib/jekyll/layout.rb", "lib/jekyll/page.rb", "lib/jekyll/post.rb", "lib/jekyll/site.rb", "lib/jekyll/tags", "lib/jekyll/tags/highlight.rb", "lib/jekyll/tags/include.rb", "lib/jekyll.rb", "test/dest", "test/dest/2008", "test/dest/2008/10", "test/dest/2008/10/18", "test/dest/2008/10/18/foo-bar.html", "test/dest/2008/11", "test/dest/2008/11/21", "test/dest/2008/11/21/complex.html", "test/dest/2008/12", "test/dest/2008/12/13", "test/dest/2008/12/13/include.html", "test/dest/_posts", "test/dest/_posts/2008-10-18-foo-bar.html", "test/dest/_posts/2008-11-21-complex.html", "test/dest/_posts/2008-12-03-permalinked-post.html", "test/dest/_posts/2008-12-13-include.html", "test/dest/category", "test/dest/category/2008", "test/dest/category/2008/09", "test/dest/category/2008/09/23", "test/dest/category/2008/09/23/categories.html", "test/dest/category/_posts", "test/dest/category/_posts/2008-9-23-categories.html", "test/dest/css", "test/dest/css/screen.css", "test/dest/foo", "test/dest/foo/2008", "test/dest/foo/2008/12", "test/dest/foo/2008/12/12", "test/dest/foo/2008/12/12/topical-post.html", "test/dest/foo/_posts", "test/dest/foo/_posts/bar", "test/dest/foo/_posts/bar/2008-12-12-topical-post.html", "test/dest/index.html", "test/dest/my_category", "test/dest/my_category/permalinked-post", "test/dest/z_category", "test/dest/z_category/2008", "test/dest/z_category/2008/09", "test/dest/z_category/2008/09/23", "test/dest/z_category/2008/09/23/categories.html", "test/dest/z_category/_posts", "test/dest/z_category/_posts/2008-9-23-categories.html", "test/helper.rb", "test/source", "test/source/_includes", "test/source/_includes/sig.markdown", "test/source/_layouts", "test/source/_layouts/default.html", "test/source/_layouts/simple.html", "test/source/_posts", "test/source/_posts/2008-10-18-foo-bar.textile", "test/source/_posts/2008-11-21-complex.textile", "test/source/_posts/2008-12-03-permalinked-post.textile", "test/source/_posts/2008-12-13-include.markdown", "test/source/category", "test/source/category/_posts", "test/source/category/_posts/2008-9-23-categories.textile", "test/source/css", "test/source/css/screen.css", "test/source/foo", "test/source/foo/_posts", "test/source/foo/_posts/bar", "test/source/foo/_posts/bar/2008-12-12-topical-post.textile", "test/source/index.html", "test/source/z_category", "test/source/z_category/_posts", "test/source/z_category/_posts/2008-9-23-categories.textile", "test/suite.rb", "test/test_filters.rb", "test/test_generated_site.rb", "test/test_jekyll.rb", "test/test_post.rb", "test/test_site.rb", "test/test_tags.rb"]
s.has_rdoc = true
s.rdoc_options = ["--main", "README.txt"]
s.homepage = %q{http://github.com/mojombo/jekyll}
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
s.require_paths = ["lib"]
s.rubyforge_project = %q{jekyll}
s.rubygems_version = %q{1.3.0}
s.summary = %q{Jekyll is a simple, blog aware, static site generator.}
s.test_files = ["test/test_filters.rb", "test/test_generated_site.rb", "test/test_jekyll.rb", "test/test_post.rb", "test/test_site.rb", "test/test_tags.rb"]

if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2

if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
s.add_runtime_dependency(%q<RedCloth>, [">= 0"])
s.add_runtime_dependency(%q<liquid>, [">= 0"])
s.add_runtime_dependency(%q<classifier>, [">= 0"])
s.add_runtime_dependency(%q<maruku>, [">= 0"])
s.add_runtime_dependency(%q<directory_watcher>, [">= 0"])
s.add_runtime_dependency(%q<open4>, [">= 0"])
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
s.add_runtime_dependency(%q<RedCloth>, [">= 4.0.4"])
s.add_runtime_dependency(%q<liquid>, [">= 1.9.0"])
s.add_runtime_dependency(%q<classifier>, [">= 1.3.1"])
s.add_runtime_dependency(%q<maruku>, [">= 0.5.9"])
s.add_runtime_dependency(%q<directory_watcher>, [">= 1.1.1"])
s.add_runtime_dependency(%q<open4>, [">= 0.9.6"])
else
s.add_dependency(%q<RedCloth>, [">= 0"])
s.add_dependency(%q<liquid>, [">= 0"])
s.add_dependency(%q<classifier>, [">= 0"])
s.add_dependency(%q<maruku>, [">= 0"])
s.add_dependency(%q<directory_watcher>, [">= 0"])
s.add_dependency(%q<open4>, [">= 0"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
s.add_dependency(%q<RedCloth>, [">= 4.0.4"])
s.add_dependency(%q<liquid>, [">= 1.9.0"])
s.add_dependency(%q<classifier>, [">= 1.3.1"])
s.add_dependency(%q<maruku>, [">= 0.5.9"])
s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
s.add_dependency(%q<open4>, [">= 0.9.6"])
end
else
s.add_dependency(%q<RedCloth>, [">= 0"])
s.add_dependency(%q<liquid>, [">= 0"])
s.add_dependency(%q<classifier>, [">= 0"])
s.add_dependency(%q<maruku>, [">= 0"])
s.add_dependency(%q<directory_watcher>, [">= 0"])
s.add_dependency(%q<open4>, [">= 0"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
s.add_dependency(%q<RedCloth>, [">= 4.0.4"])
s.add_dependency(%q<liquid>, [">= 1.9.0"])
s.add_dependency(%q<classifier>, [">= 1.3.1"])
s.add_dependency(%q<maruku>, [">= 0.5.9"])
s.add_dependency(%q<directory_watcher>, [">= 1.1.1"])
s.add_dependency(%q<open4>, [">= 0.9.6"])
end
end
7 changes: 5 additions & 2 deletions lib/jekyll.rb
Expand Up @@ -43,8 +43,6 @@
require 'jekyll/albino'

module Jekyll
VERSION = '0.3.0'

class << self
attr_accessor :source, :dest, :lsi, :pygments, :markdown_proc, :content_type, :permalink_style
end
Expand All @@ -61,4 +59,9 @@ def self.process(source, dest)
Jekyll.dest = dest
Jekyll::Site.new(source, dest).process
end

def self.version
yml = YAML.load(File.read(File.join(File.dirname(__FILE__), *%w[.. VERSION.yml])))
"#{yml[:major]}.#{yml[:minor]}.#{yml[:patch]}"
end
end
17 changes: 9 additions & 8 deletions lib/jekyll/converters/wordpress.rb
Expand Up @@ -10,29 +10,30 @@

module Jekyll
module WordPress
# Reads a MySQL database via Sequel and creates a post file for each

# 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 * from wp_posts where post_status = 'publish' and post_type = 'post'"

def self.process(dbname, user, pass, host = 'localhost')
db = Sequel.mysql(dbname, :user => user, :password => pass, :host => host)

FileUtils.mkdir_p "_posts"

db[QUERY].each do |post|
# Get required fields and construct Jekyll compatible name
title = post[:post_title]
slug = post[:post_name]
date = post[:post_date]
content = post[:post_content]

name = [date.year, date.month, date.day, slug].join('-') + ".markdown"

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
# to YAML for the header
data = {
'layout' => 'post',
'title' => title.to_s,
Expand All @@ -51,4 +52,4 @@ def self.process(dbname, user, pass, host = 'localhost')

end
end
end
end

0 comments on commit 598bc99

Please sign in to comment.