mojombo-jekyll 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Manifest.txt +3 -4
- data/README.textile +38 -7
- data/Rakefile +8 -2
- data/bin/jekyll +61 -8
- data/jekyll.gemspec +9 -3
- data/lib/jekyll.rb +4 -1
- data/lib/jekyll/blocks.rb +22 -0
- data/lib/jekyll/converters/csv.rb +26 -0
- data/lib/jekyll/converters/mephisto.rb +24 -0
- data/lib/jekyll/convertible.rb +7 -2
- data/lib/jekyll/filters.rb +4 -0
- data/lib/jekyll/page.rb +1 -1
- data/lib/jekyll/post.rb +5 -2
- metadata +23 -6
data/History.txt
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
== 0.1.3 /
|
2
|
+
* Major Features
|
3
|
+
* Markdown support [github.com/vanpelt]
|
4
|
+
* Mephisto and CSV converters [github.com/vanpelt]
|
5
|
+
* Code hilighting [github.com/vanpelt]
|
6
|
+
* Autobuild
|
7
|
+
* Bug Fixes
|
8
|
+
* Accept both \r\n and \n in YAML header [github.com/vanpelt]
|
9
|
+
|
1
10
|
== 0.1.2 / 2008-11-22
|
2
11
|
* Major Features
|
3
12
|
* Add a real "related posts" implementation using Classifier
|
data/Manifest.txt
CHANGED
@@ -6,15 +6,14 @@ bin/jekyll
|
|
6
6
|
jekyll.gemspec
|
7
7
|
lib/jekyll.rb
|
8
8
|
lib/jekyll/convertible.rb
|
9
|
+
lib/jekyll/converters/csv.rb
|
10
|
+
lib/jekyll/converters/mephisto.rb
|
9
11
|
lib/jekyll/filters.rb
|
12
|
+
lib/jekyll/blocks.rb
|
10
13
|
lib/jekyll/layout.rb
|
11
14
|
lib/jekyll/page.rb
|
12
15
|
lib/jekyll/post.rb
|
13
16
|
lib/jekyll/site.rb
|
14
|
-
test/dest/2008/10/18/foo-bar.html
|
15
|
-
test/dest/2008/11/21/complex.html
|
16
|
-
test/dest/css/screen.css
|
17
|
-
test/dest/index.html
|
18
17
|
test/helper.rb
|
19
18
|
test/source/_layouts/default.html
|
20
19
|
test/source/_layouts/simple.html
|
data/README.textile
CHANGED
@@ -27,17 +27,48 @@ My own personal site/blog is generated with Jekyll.
|
|
27
27
|
The proto-site repo ("http://github.com/mojombo/tpw":http://github.com/mojombo/tpw)
|
28
28
|
is converted into the actual site ("http://tom.preston-werner.com/":http://tom.preston-werner.com)
|
29
29
|
|
30
|
-
h2. Install
|
30
|
+
h2. Install
|
31
31
|
|
32
|
-
|
33
|
-
and run the software from there.
|
32
|
+
The best way to install Jekyll is via RubyGems:
|
34
33
|
|
35
|
-
$ sudo gem install
|
36
|
-
|
34
|
+
$ sudo gem install jekyll
|
35
|
+
|
36
|
+
h2. Run
|
37
|
+
|
38
|
+
$ cd /path/to/proto/site
|
39
|
+
$ jekyll
|
40
|
+
|
41
|
+
This will generate the site and place it in /path/to/proto/site/_site. There is an autobuild feature that will regenerate your site if any of the files change:
|
42
|
+
|
43
|
+
$ jekyll --auto
|
44
|
+
|
45
|
+
If you'd like the generated site placed somewhere else:
|
46
|
+
|
47
|
+
$ jekyll /path/to/place/generated/site
|
48
|
+
|
49
|
+
And if you don't want to be in the proto site root to run Jekyll:
|
50
|
+
|
51
|
+
$ jekyll /path/to/proto/site /path/to/place/generated/site
|
37
52
|
|
53
|
+
The autobuid feature can be used on any of the invocations.
|
54
|
+
|
55
|
+
h2. Contribute
|
56
|
+
|
57
|
+
If you'd like to hack on Jekyll, grab the source from GitHub. To get
|
58
|
+
all of the dependencies, install the gem first.
|
59
|
+
|
38
60
|
$ git clone git://github.com/mojombo/jekyll
|
39
|
-
|
40
|
-
|
61
|
+
|
62
|
+
The best way to get your changes merged back into core is as follows:
|
63
|
+
|
64
|
+
# Fork mojombo/jekyll on GitHub
|
65
|
+
# Clone down your fork
|
66
|
+
# Create a topic branch to contain your change
|
67
|
+
# Hack away
|
68
|
+
# Do not change the version number, I will do that on my end
|
69
|
+
# If necessary, rebase your commits into logical chunks, without errors
|
70
|
+
# Push the branch up to GitHub
|
71
|
+
# Send me (mojombo) a pull request for your branch
|
41
72
|
|
42
73
|
h2. License
|
43
74
|
|
data/Rakefile
CHANGED
@@ -3,13 +3,19 @@ require 'hoe'
|
|
3
3
|
require 'lib/jekyll'
|
4
4
|
|
5
5
|
Hoe.new('jekyll', Jekyll::VERSION) do |p|
|
6
|
-
# p.rubyforge_name = 'jekyllx' # if different than lowercase project name
|
7
6
|
p.developer('Tom Preston-Werner', 'tom@mojombo.com')
|
8
7
|
p.summary = "Jekyll is a simple, blog aware, static site generator."
|
9
|
-
p.extra_deps = ['RedCloth', 'liquid', 'classifier']
|
8
|
+
p.extra_deps = ['RedCloth', 'liquid', 'classifier', 'rdiscount', 'directory_watcher']
|
10
9
|
end
|
11
10
|
|
12
11
|
desc "Open an irb session preloaded with this library"
|
13
12
|
task :console do
|
14
13
|
sh "irb -rubygems -r ./lib/jekyll.rb"
|
15
14
|
end
|
15
|
+
|
16
|
+
namespace :convert do
|
17
|
+
desc "Migrate from mephisto in the current directory"
|
18
|
+
task :mephisto do
|
19
|
+
sh %q(ruby -r './lib/jekyll/converters/mephisto' -e 'Jekyll::Mephisto.postgres(:database => "#{ENV["DB"]}")')
|
20
|
+
end
|
21
|
+
end
|
data/bin/jekyll
CHANGED
@@ -2,20 +2,71 @@
|
|
2
2
|
|
3
3
|
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
4
4
|
|
5
|
+
require 'optparse'
|
5
6
|
require 'jekyll'
|
6
7
|
|
8
|
+
options = {}
|
9
|
+
|
10
|
+
opts = OptionParser.new do |opts|
|
11
|
+
opts.banner = DATA.read
|
12
|
+
|
13
|
+
opts.on("--auto", "Auto-regenerate") do
|
14
|
+
options[:auto] = true
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
opts.parse!
|
19
|
+
|
20
|
+
def clean(dest)
|
21
|
+
FileUtils.rm_rf(dest)
|
22
|
+
FileUtils.mkdir_p(dest)
|
23
|
+
end
|
24
|
+
|
25
|
+
def globs(source)
|
26
|
+
Dir.chdir(source) do
|
27
|
+
dirs = Dir['*'].select { |x| File.directory?(x) }
|
28
|
+
dirs -= ['_site']
|
29
|
+
dirs = dirs.map { |x| "#{x}/**/*" }
|
30
|
+
dirs += ['*']
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
source = nil
|
35
|
+
destination = nil
|
36
|
+
|
7
37
|
case ARGV.size
|
8
38
|
when 0
|
9
|
-
|
10
|
-
|
11
|
-
FileUtils.mkdir_p(dest)
|
12
|
-
Jekyll.process('.', dest)
|
39
|
+
source = '.'
|
40
|
+
destination = File.join('.', '_site')
|
13
41
|
when 1
|
14
|
-
|
42
|
+
source = '.'
|
43
|
+
destination = ARGV[0]
|
15
44
|
when 2
|
16
|
-
|
45
|
+
source = ARGV[0]
|
46
|
+
destination = ARGV[1]
|
17
47
|
else
|
18
|
-
puts
|
48
|
+
puts "Invalid options. Run `jekyll --help` for assistance."
|
49
|
+
exit(1)
|
50
|
+
end
|
51
|
+
|
52
|
+
if options[:auto]
|
53
|
+
puts "Auto-regenerating enabled: #{source} -> #{destination}"
|
54
|
+
|
55
|
+
dw = DirectoryWatcher.new(source)
|
56
|
+
dw.interval = 1
|
57
|
+
dw.glob = globs(source)
|
58
|
+
|
59
|
+
dw.add_observer do |*args|
|
60
|
+
t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
61
|
+
puts "[#{t}] regeneration: #{args.size} files changed"
|
62
|
+
Jekyll.process(source, destination)
|
63
|
+
end
|
64
|
+
|
65
|
+
dw.start
|
66
|
+
|
67
|
+
loop { sleep 1000 }
|
68
|
+
else
|
69
|
+
Jekyll.process(source, destination)
|
19
70
|
end
|
20
71
|
|
21
72
|
__END__
|
@@ -24,4 +75,6 @@ Jekyll is a blog-aware, static site generator.
|
|
24
75
|
Basic Command Line Usage:
|
25
76
|
jekyll # . -> ./_site
|
26
77
|
jekyll <path to write generated site> # . -> <path>
|
27
|
-
jekyll <path to source> <path to write generated site> # <path> -> <path>
|
78
|
+
jekyll <path to source> <path to write generated site> # <path> -> <path>
|
79
|
+
|
80
|
+
Options:
|
data/jekyll.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = %q{jekyll}
|
3
|
-
s.version = "0.1.
|
3
|
+
s.version = "0.1.3"
|
4
4
|
|
5
5
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
6
|
s.authors = ["Tom Preston-Werner"]
|
7
|
-
s.date = %q{2008-
|
7
|
+
s.date = %q{2008-12-06}
|
8
8
|
s.default_executable = %q{jekyll}
|
9
9
|
s.email = ["tom@mojombo.com"]
|
10
10
|
s.executables = ["jekyll"]
|
11
11
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
|
12
|
-
s.files = ["History.txt", "Manifest.txt", "README.textile", "Rakefile", "bin/jekyll", "jekyll.gemspec", "lib/jekyll.rb", "lib/jekyll/convertible.rb", "lib/jekyll/
|
12
|
+
s.files = ["History.txt", "Manifest.txt", "README.textile", "Rakefile", "bin/jekyll", "jekyll.gemspec", "lib/jekyll.rb", "lib/jekyll/convertible.rb", "lib/jekyll/converters/csv.rb", "lib/jekyll/converters/mephisto.rb", "lib/jekyll/filters.rb", "lib/jekyll/blocks.rb", "lib/jekyll/layout.rb", "lib/jekyll/page.rb", "lib/jekyll/post.rb", "lib/jekyll/site.rb", "test/helper.rb", "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/css/screen.css", "test/source/index.html", "test/suite.rb", "test/test_jekyll.rb", "test/test_post.rb", "test/test_site.rb"]
|
13
13
|
s.has_rdoc = true
|
14
14
|
s.rdoc_options = ["--main", "README.txt"]
|
15
15
|
s.require_paths = ["lib"]
|
@@ -26,17 +26,23 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_runtime_dependency(%q<RedCloth>, [">= 0"])
|
27
27
|
s.add_runtime_dependency(%q<liquid>, [">= 0"])
|
28
28
|
s.add_runtime_dependency(%q<classifier>, [">= 0"])
|
29
|
+
s.add_runtime_dependency(%q<rdiscount>, [">= 0"])
|
30
|
+
s.add_runtime_dependency(%q<directory_watcher>, [">= 0"])
|
29
31
|
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
|
30
32
|
else
|
31
33
|
s.add_dependency(%q<RedCloth>, [">= 0"])
|
32
34
|
s.add_dependency(%q<liquid>, [">= 0"])
|
33
35
|
s.add_dependency(%q<classifier>, [">= 0"])
|
36
|
+
s.add_dependency(%q<rdiscount>, [">= 0"])
|
37
|
+
s.add_dependency(%q<directory_watcher>, [">= 0"])
|
34
38
|
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
35
39
|
end
|
36
40
|
else
|
37
41
|
s.add_dependency(%q<RedCloth>, [">= 0"])
|
38
42
|
s.add_dependency(%q<liquid>, [">= 0"])
|
39
43
|
s.add_dependency(%q<classifier>, [">= 0"])
|
44
|
+
s.add_dependency(%q<rdiscount>, [">= 0"])
|
45
|
+
s.add_dependency(%q<directory_watcher>, [">= 0"])
|
40
46
|
s.add_dependency(%q<hoe>, [">= 1.8.0"])
|
41
47
|
end
|
42
48
|
end
|
data/lib/jekyll.rb
CHANGED
@@ -12,7 +12,9 @@ require 'time'
|
|
12
12
|
# 3rd party
|
13
13
|
require 'liquid'
|
14
14
|
require 'redcloth'
|
15
|
+
require 'rdiscount' rescue puts "The rdiscount gem is required for markdown support!"
|
15
16
|
require 'classifier'
|
17
|
+
require 'directory_watcher'
|
16
18
|
|
17
19
|
# internal requires
|
18
20
|
require 'jekyll/site'
|
@@ -21,9 +23,10 @@ require 'jekyll/layout'
|
|
21
23
|
require 'jekyll/page'
|
22
24
|
require 'jekyll/post'
|
23
25
|
require 'jekyll/filters'
|
26
|
+
require 'jekyll/blocks'
|
24
27
|
|
25
28
|
module Jekyll
|
26
|
-
VERSION = '0.1.
|
29
|
+
VERSION = '0.1.3'
|
27
30
|
|
28
31
|
def self.process(source, dest)
|
29
32
|
Jekyll::Site.new(source, dest).process
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Jekyll
|
2
|
+
class Highlight < Liquid::Block
|
3
|
+
include Liquid::StandardFilters
|
4
|
+
|
5
|
+
def initialize(tag_name, lang, tokens)
|
6
|
+
super
|
7
|
+
@lang = lang.strip
|
8
|
+
end
|
9
|
+
|
10
|
+
def render(context)
|
11
|
+
#The div is required because RDiscount blows ass
|
12
|
+
<<-HTML
|
13
|
+
<div>
|
14
|
+
<pre>
|
15
|
+
<code class='#{@lang}'>#{h(super.to_s).strip}</code>
|
16
|
+
</pre>
|
17
|
+
</div>
|
18
|
+
HTML
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
Liquid::Template.register_tag('highlight', Jekyll::Highlight)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module CSV
|
3
|
+
#Reads a csv with title, permalink, body, published_at, and filter.
|
4
|
+
#It creates a post file for each row in the csv
|
5
|
+
def self.process(file = "posts.csv")
|
6
|
+
FileUtils.mkdir_p "_posts"
|
7
|
+
posts = 0
|
8
|
+
FasterCSV.foreach(file) do |row|
|
9
|
+
next if row[0] == "title"
|
10
|
+
posts += 1
|
11
|
+
name = row[3].split(" ")[0]+"-"+row[1]+(row[4] =~ /markdown/ ? ".markdown" : ".textile")
|
12
|
+
File.open("_posts/#{name}", "w") do |f|
|
13
|
+
f.puts <<-HEADER
|
14
|
+
---
|
15
|
+
layout: post
|
16
|
+
title: #{row[0]}
|
17
|
+
---
|
18
|
+
|
19
|
+
HEADER
|
20
|
+
f.puts row[2]
|
21
|
+
end
|
22
|
+
end
|
23
|
+
"Created #{posts} posts!"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'fastercsv'
|
3
|
+
require 'fileutils'
|
4
|
+
require File.join(File.dirname(__FILE__),"csv.rb")
|
5
|
+
module Jekyll
|
6
|
+
module Mephisto
|
7
|
+
#Accepts a hash with database config variables, exports mephisto posts into a csv
|
8
|
+
#export PGPASSWORD if you must
|
9
|
+
def self.postgres(c)
|
10
|
+
sql = <<-SQL
|
11
|
+
BEGIN;
|
12
|
+
CREATE TEMP TABLE jekyll AS
|
13
|
+
SELECT title, permalink, body, published_at, filter FROM contents
|
14
|
+
WHERE user_id = 1 AND type = 'Article' ORDER BY published_at;
|
15
|
+
COPY jekyll TO STDOUT WITH CSV HEADER;
|
16
|
+
ROLLBACK;
|
17
|
+
SQL
|
18
|
+
command = %Q(psql -h #{c[:host] || "localhost"} -c "#{sql.strip}" #{c[:database]} #{c[:username]} -o #{c[:filename] || "posts.csv"})
|
19
|
+
puts command
|
20
|
+
`#{command}`
|
21
|
+
CSV.process
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/jekyll/convertible.rb
CHANGED
@@ -13,7 +13,7 @@ module Jekyll
|
|
13
13
|
def read_yaml(base, name)
|
14
14
|
self.content = File.read(File.join(base, name))
|
15
15
|
|
16
|
-
if self.content =~ /^(
|
16
|
+
if self.content =~ /^(---.*\n.*?)\n---.*\n/m
|
17
17
|
self.content = self.content[($1.size + 5)..-1]
|
18
18
|
|
19
19
|
self.data = YAML.load($1)
|
@@ -24,9 +24,13 @@ module Jekyll
|
|
24
24
|
#
|
25
25
|
# Returns nothing
|
26
26
|
def transform
|
27
|
-
|
27
|
+
case self.ext
|
28
|
+
when ".textile":
|
28
29
|
self.ext = ".html"
|
29
30
|
self.content = RedCloth.new(self.content).to_html
|
31
|
+
when ".markdown":
|
32
|
+
self.ext = ".html"
|
33
|
+
self.content = RDiscount.new(self.content).to_html
|
30
34
|
end
|
31
35
|
end
|
32
36
|
|
@@ -41,6 +45,7 @@ module Jekyll
|
|
41
45
|
|
42
46
|
# render content
|
43
47
|
self.content = Liquid::Template.parse(self.content).render(payload, [Jekyll::Filters])
|
48
|
+
self.transform
|
44
49
|
|
45
50
|
# output keeps track of what will finally be written
|
46
51
|
self.output = self.content
|
data/lib/jekyll/filters.rb
CHANGED
data/lib/jekyll/page.rb
CHANGED
data/lib/jekyll/post.rb
CHANGED
@@ -32,7 +32,8 @@ module Jekyll
|
|
32
32
|
|
33
33
|
self.process(name)
|
34
34
|
self.read_yaml(base, name)
|
35
|
-
|
35
|
+
#Removed to avoid munging of liquid tags, replaced in convertible.rb#48
|
36
|
+
#self.transform
|
36
37
|
end
|
37
38
|
|
38
39
|
# Spaceship is based on Post#date
|
@@ -82,8 +83,10 @@ module Jekyll
|
|
82
83
|
# Returns [<Post>]
|
83
84
|
def related_posts(posts)
|
84
85
|
self.class.lsi ||= begin
|
86
|
+
puts "Running the classifier... this could take a while."
|
85
87
|
lsi = Classifier::LSI.new
|
86
|
-
posts.each { |x| lsi.add_item(x) }
|
88
|
+
posts.each { |x| $stdout.print(".");$stdout.flush;lsi.add_item(x) }
|
89
|
+
puts ""
|
87
90
|
lsi
|
88
91
|
end
|
89
92
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mojombo-jekyll
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Preston-Werner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-12-06 00:00:00 -08:00
|
13
13
|
default_executable: jekyll
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -39,6 +39,24 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: "0"
|
41
41
|
version:
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rdiscount
|
44
|
+
version_requirement:
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: "0"
|
50
|
+
version:
|
51
|
+
- !ruby/object:Gem::Dependency
|
52
|
+
name: directory_watcher
|
53
|
+
version_requirement:
|
54
|
+
version_requirements: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: "0"
|
59
|
+
version:
|
42
60
|
- !ruby/object:Gem::Dependency
|
43
61
|
name: hoe
|
44
62
|
version_requirement:
|
@@ -67,15 +85,14 @@ files:
|
|
67
85
|
- jekyll.gemspec
|
68
86
|
- lib/jekyll.rb
|
69
87
|
- lib/jekyll/convertible.rb
|
88
|
+
- lib/jekyll/converters/csv.rb
|
89
|
+
- lib/jekyll/converters/mephisto.rb
|
70
90
|
- lib/jekyll/filters.rb
|
91
|
+
- lib/jekyll/blocks.rb
|
71
92
|
- lib/jekyll/layout.rb
|
72
93
|
- lib/jekyll/page.rb
|
73
94
|
- lib/jekyll/post.rb
|
74
95
|
- lib/jekyll/site.rb
|
75
|
-
- test/dest/2008/10/18/foo-bar.html
|
76
|
-
- test/dest/2008/11/21/complex.html
|
77
|
-
- test/dest/css/screen.css
|
78
|
-
- test/dest/index.html
|
79
96
|
- test/helper.rb
|
80
97
|
- test/source/_layouts/default.html
|
81
98
|
- test/source/_layouts/simple.html
|