dysinger-jekyll 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. data/History.txt +91 -0
  2. data/README.textile +475 -0
  3. data/VERSION.yml +4 -0
  4. data/bin/jekyll +136 -0
  5. data/lib/jekyll.rb +67 -0
  6. data/lib/jekyll/albino.rb +116 -0
  7. data/lib/jekyll/converters/csv.rb +26 -0
  8. data/lib/jekyll/converters/mephisto.rb +79 -0
  9. data/lib/jekyll/converters/mt.rb +59 -0
  10. data/lib/jekyll/converters/textpattern.rb +50 -0
  11. data/lib/jekyll/converters/typo.rb +49 -0
  12. data/lib/jekyll/converters/wordpress.rb +54 -0
  13. data/lib/jekyll/convertible.rb +71 -0
  14. data/lib/jekyll/core_ext.rb +22 -0
  15. data/lib/jekyll/filters.rb +39 -0
  16. data/lib/jekyll/layout.rb +33 -0
  17. data/lib/jekyll/page.rb +64 -0
  18. data/lib/jekyll/post.rb +174 -0
  19. data/lib/jekyll/site.rb +167 -0
  20. data/lib/jekyll/tags/highlight.rb +53 -0
  21. data/lib/jekyll/tags/include.rb +31 -0
  22. data/test/helper.rb +13 -0
  23. data/test/source/_includes/sig.markdown +3 -0
  24. data/test/source/_layouts/default.html +27 -0
  25. data/test/source/_layouts/simple.html +1 -0
  26. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  27. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  28. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  29. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  30. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  31. data/test/source/css/screen.css +76 -0
  32. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  33. data/test/source/index.html +22 -0
  34. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  35. data/test/suite.rb +9 -0
  36. data/test/test_filters.rb +37 -0
  37. data/test/test_generated_site.rb +22 -0
  38. data/test/test_jekyll.rb +0 -0
  39. data/test/test_post.rb +113 -0
  40. data/test/test_site.rb +33 -0
  41. data/test/test_tags.rb +31 -0
  42. metadata +205 -0
@@ -0,0 +1,6 @@
1
+ ---
2
+ layout: default
3
+ title: Categories
4
+ ---
5
+
6
+ Categories _should_ work. Even if ordered after index.
@@ -0,0 +1,9 @@
1
+ require 'test/unit'
2
+
3
+ # for some reason these tests fail when run via TextMate
4
+ # but succeed when run on the command line.
5
+
6
+ tests = Dir["#{File.dirname(__FILE__)}/test_*.rb"]
7
+ tests.each do |file|
8
+ require file
9
+ end
@@ -0,0 +1,37 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestFilters < Test::Unit::TestCase
4
+
5
+ class JekyllFilter
6
+ include Jekyll::Filters
7
+ end
8
+
9
+ def setup
10
+ @filter = JekyllFilter.new
11
+ end
12
+
13
+ def test_array_to_sentence_string_with_no_args
14
+ assert_equal "", @filter.array_to_sentence_string([])
15
+ end
16
+
17
+ def test_array_to_sentence_string_with_one_arg
18
+ assert_equal "1", @filter.array_to_sentence_string([1])
19
+ assert_equal "chunky", @filter.array_to_sentence_string(["chunky"])
20
+ end
21
+
22
+ def test_array_to_sentence_string_with_two_args
23
+ assert_equal "1 and 2", @filter.array_to_sentence_string([1, 2])
24
+ assert_equal "chunky and bacon", @filter.array_to_sentence_string(["chunky", "bacon"])
25
+ end
26
+
27
+ def test_array_to_sentence_string_with_multiple_args
28
+ assert_equal "1, 2, 3, and 4", @filter.array_to_sentence_string([1, 2, 3, 4])
29
+ assert_equal "chunky, bacon, bits, and pieces", @filter.array_to_sentence_string(["chunky", "bacon", "bits", "pieces"])
30
+ end
31
+
32
+ def test_xml_escape_with_ampersands
33
+ assert_equal "AT&amp;T", @filter.xml_escape("AT&T")
34
+ assert_equal "&lt;code&gt;command &amp;lt;filename&amp;gt;&lt;/code&gt;", @filter.xml_escape("<code>command &lt;filename&gt;</code>")
35
+ end
36
+
37
+ end
@@ -0,0 +1,22 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestGeneratedSite < Test::Unit::TestCase
4
+ def setup
5
+ clear_dest
6
+ source = File.join(File.dirname(__FILE__), *%w[source])
7
+ @s = Site.new(source, dest_dir)
8
+ @s.process
9
+ @index = File.read(File.join(dest_dir, 'index.html'))
10
+ end
11
+
12
+ def test_site_posts_in_index
13
+ # confirm that {{ site.posts }} is working
14
+ puts @s.posts.size
15
+ assert @index.include?("#{@s.posts.size} Posts")
16
+ end
17
+
18
+ def test_post_content_in_index
19
+ # confirm that the {{ post.content }} is rendered OK
20
+ assert @index.include?('<p>This <em>is</em> cool</p>')
21
+ end
22
+ end
File without changes
@@ -0,0 +1,113 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestPost < Test::Unit::TestCase
4
+ def setup
5
+
6
+ end
7
+
8
+ def test_valid
9
+ assert Post.valid?("2008-10-19-foo-bar.textile")
10
+ assert Post.valid?("foo/bar/2008-10-19-foo-bar.textile")
11
+
12
+ assert !Post.valid?("lol2008-10-19-foo-bar.textile")
13
+ assert !Post.valid?("blah")
14
+ end
15
+
16
+ def test_process
17
+ p = Post.allocate
18
+ p.process("2008-10-19-foo-bar.textile")
19
+
20
+ assert_equal Time.parse("2008-10-19"), p.date
21
+ assert_equal "foo-bar", p.slug
22
+ assert_equal ".textile", p.ext
23
+ end
24
+
25
+ def test_url
26
+ p = Post.allocate
27
+ p.categories = []
28
+ p.process("2008-10-19-foo-bar.textile")
29
+
30
+ assert_equal "/2008/10/19/foo-bar.html", p.url
31
+ end
32
+
33
+ def test_permalink
34
+ p = Post.allocate
35
+ p.process("2008-12-03-permalinked-post.textile")
36
+ p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
37
+
38
+ assert_equal "my_category/permalinked-post", p.permalink
39
+ end
40
+
41
+ def test_dir_respects_permalink
42
+ p = Post.allocate
43
+ p.process("2008-12-03-permalinked-post.textile")
44
+ p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
45
+
46
+ assert_equal "my_category/", p.dir
47
+ end
48
+
49
+ def test_url_respects_permalink
50
+ p = Post.allocate
51
+ p.process("2008-12-03-permalinked-post.textile")
52
+ p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-12-03-permalinked-post.textile")
53
+
54
+ assert_equal "my_category/permalinked-post", p.url
55
+ end
56
+
57
+ def test_read_yaml
58
+ p = Post.allocate
59
+ p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-10-18-foo-bar.textile")
60
+
61
+ assert_equal({"title" => "Foo Bar", "layout" => "default"}, p.data)
62
+ assert_equal "\nh1. {{ page.title }}\n\nBest *post* ever", p.content
63
+ end
64
+
65
+ def test_transform
66
+ p = Post.allocate
67
+ p.process("2008-10-18-foo-bar.textile")
68
+ p.read_yaml(File.join(File.dirname(__FILE__), *%w[source _posts]), "2008-10-18-foo-bar.textile")
69
+ p.transform
70
+
71
+ assert_equal "<h1>{{ page.title }}</h1>\n<p>Best <strong>post</strong> ever</p>", p.content
72
+ end
73
+
74
+ def test_render
75
+ p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-10-18-foo-bar.textile")
76
+ layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
77
+ p.render(layouts, {"site" => {"posts" => []}})
78
+
79
+ assert_equal "<<< <h1>Foo Bar</h1>\n<p>Best <strong>post</strong> ever</p> >>>", p.output
80
+ end
81
+
82
+ def test_write
83
+ clear_dest
84
+
85
+ p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-10-18-foo-bar.textile")
86
+ layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
87
+ p.render(layouts, {"site" => {"posts" => []}})
88
+ p.write(dest_dir)
89
+ end
90
+
91
+ def test_data
92
+ p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-11-21-complex.textile")
93
+ layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
94
+ p.render(layouts, {"site" => {"posts" => []}})
95
+
96
+ assert_equal "<<< <p>url: /2008/11/21/complex.html<br />\ndate: #{Time.parse("2008-11-21")}<br />\nid: /2008/11/21/complex</p> >>>", p.output
97
+ end
98
+
99
+ def test_categories_and_topics
100
+ p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), 'foo', 'bar/2008-12-12-topical-post.textile')
101
+ assert_equal ['foo'], p.categories
102
+ assert_equal ['bar'], p.topics
103
+ end
104
+
105
+ def test_include
106
+ Jekyll.source = File.join(File.dirname(__FILE__), *%w[source])
107
+ p = Post.new(File.join(File.dirname(__FILE__), *%w[source]), '', "2008-12-13-include.markdown")
108
+ layouts = {"default" => Layout.new(File.join(File.dirname(__FILE__), *%w[source _layouts]), "simple.html")}
109
+ p.render(layouts, {"site" => {"posts" => []}})
110
+
111
+ assert_equal "<<< <hr />\n<p>Tom Preston-Werner github.com/mojombo</p>\n\n<p>This <em>is</em> cool</p> >>>", p.output
112
+ end
113
+ end
@@ -0,0 +1,33 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestSite < Test::Unit::TestCase
4
+ def setup
5
+ source = File.join(File.dirname(__FILE__), *%w[source])
6
+ @s = Site.new(source, dest_dir)
7
+ end
8
+
9
+ def test_site_init
10
+
11
+ end
12
+
13
+ def test_read_layouts
14
+ @s.read_layouts
15
+
16
+ assert_equal ["default", "simple"].sort, @s.layouts.keys.sort
17
+ end
18
+
19
+ def test_read_posts
20
+ @s.read_posts('')
21
+
22
+ assert_equal 4, @s.posts.size
23
+ end
24
+
25
+ def test_site_payload
26
+ clear_dest
27
+ @s.process
28
+
29
+ assert_equal 7, @s.posts.length
30
+ assert_equal ["category", "foo", "z_category"].sort, @s.categories.keys.sort
31
+ assert_equal 1, @s.categories['foo'].length
32
+ end
33
+ end
@@ -0,0 +1,31 @@
1
+ require File.dirname(__FILE__) + '/helper'
2
+
3
+ class TestTags < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @content = <<CONTENT
7
+ ---
8
+ layout: post
9
+ title: This is a test
10
+
11
+ ---
12
+ This document results in a markdown error with maruku
13
+ {% highlight ruby %}
14
+ puts "hi"
15
+
16
+ puts "bye"
17
+ {% endhighlight %}
18
+
19
+ CONTENT
20
+ end
21
+
22
+ def test_markdown_with_pygments_line_handling
23
+ Jekyll.pygments = true
24
+ Jekyll.content_type = :markdown
25
+
26
+ result = Liquid::Template.parse(@content).render({}, [Jekyll::Filters])
27
+ result = Jekyll.markdown_proc.call(result)
28
+ assert_no_match(/markdown\-html\-error/,result)
29
+ end
30
+
31
+ end
metadata ADDED
@@ -0,0 +1,205 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dysinger-jekyll
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ platform: ruby
6
+ authors:
7
+ - Tom Preston-Werner
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-02-03 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: RedCloth
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 4.0.4
23
+ version:
24
+ - !ruby/object:Gem::Dependency
25
+ name: liquid
26
+ version_requirement:
27
+ version_requirements: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: 1.9.0
32
+ version:
33
+ - !ruby/object:Gem::Dependency
34
+ name: classifier
35
+ version_requirement:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.1
41
+ version:
42
+ - !ruby/object:Gem::Dependency
43
+ name: maruku
44
+ version_requirement:
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: 0.5.9
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: 1.1.1
59
+ version:
60
+ - !ruby/object:Gem::Dependency
61
+ name: open4
62
+ version_requirement:
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: 0.9.6
68
+ version:
69
+ description: Jekyll is a simple, blog aware, static site generator.
70
+ email: tom@mojombo.com
71
+ executables:
72
+ - jekyll
73
+ extensions: []
74
+
75
+ extra_rdoc_files: []
76
+
77
+ files:
78
+ - History.txt
79
+ - README.textile
80
+ - VERSION.yml
81
+ - bin/jekyll
82
+ - lib/jekyll
83
+ - lib/jekyll/albino.rb
84
+ - lib/jekyll/converters
85
+ - lib/jekyll/converters/csv.rb
86
+ - lib/jekyll/converters/mephisto.rb
87
+ - lib/jekyll/converters/mt.rb
88
+ - lib/jekyll/converters/textpattern.rb
89
+ - lib/jekyll/converters/typo.rb
90
+ - lib/jekyll/converters/wordpress.rb
91
+ - lib/jekyll/convertible.rb
92
+ - lib/jekyll/core_ext.rb
93
+ - lib/jekyll/filters.rb
94
+ - lib/jekyll/layout.rb
95
+ - lib/jekyll/page.rb
96
+ - lib/jekyll/post.rb
97
+ - lib/jekyll/site.rb
98
+ - lib/jekyll/tags
99
+ - lib/jekyll/tags/highlight.rb
100
+ - lib/jekyll/tags/include.rb
101
+ - lib/jekyll.rb
102
+ - test/dest
103
+ - test/dest/2008
104
+ - test/dest/2008/10
105
+ - test/dest/2008/10/18
106
+ - test/dest/2008/10/18/foo-bar.html
107
+ - test/dest/2008/11
108
+ - test/dest/2008/11/21
109
+ - test/dest/2008/11/21/complex.html
110
+ - test/dest/2008/12
111
+ - test/dest/2008/12/13
112
+ - test/dest/2008/12/13/include.html
113
+ - test/dest/_posts
114
+ - test/dest/_posts/2008-10-18-foo-bar.html
115
+ - test/dest/_posts/2008-11-21-complex.html
116
+ - test/dest/_posts/2008-12-03-permalinked-post.html
117
+ - test/dest/_posts/2008-12-13-include.html
118
+ - test/dest/category
119
+ - test/dest/category/2008
120
+ - test/dest/category/2008/09
121
+ - test/dest/category/2008/09/23
122
+ - test/dest/category/2008/09/23/categories.html
123
+ - test/dest/category/_posts
124
+ - test/dest/category/_posts/2008-9-23-categories.html
125
+ - test/dest/css
126
+ - test/dest/css/screen.css
127
+ - test/dest/foo
128
+ - test/dest/foo/2008
129
+ - test/dest/foo/2008/12
130
+ - test/dest/foo/2008/12/12
131
+ - test/dest/foo/2008/12/12/topical-post.html
132
+ - test/dest/foo/_posts
133
+ - test/dest/foo/_posts/bar
134
+ - test/dest/foo/_posts/bar/2008-12-12-topical-post.html
135
+ - test/dest/index.html
136
+ - test/dest/my_category
137
+ - test/dest/my_category/permalinked-post
138
+ - test/dest/z_category
139
+ - test/dest/z_category/2008
140
+ - test/dest/z_category/2008/09
141
+ - test/dest/z_category/2008/09/23
142
+ - test/dest/z_category/2008/09/23/categories.html
143
+ - test/dest/z_category/_posts
144
+ - test/dest/z_category/_posts/2008-9-23-categories.html
145
+ - test/helper.rb
146
+ - test/source
147
+ - test/source/_includes
148
+ - test/source/_includes/sig.markdown
149
+ - test/source/_layouts
150
+ - test/source/_layouts/default.html
151
+ - test/source/_layouts/simple.html
152
+ - test/source/_posts
153
+ - test/source/_posts/2008-10-18-foo-bar.textile
154
+ - test/source/_posts/2008-11-21-complex.textile
155
+ - test/source/_posts/2008-12-03-permalinked-post.textile
156
+ - test/source/_posts/2008-12-13-include.markdown
157
+ - test/source/category
158
+ - test/source/category/_posts
159
+ - test/source/category/_posts/2008-9-23-categories.textile
160
+ - test/source/css
161
+ - test/source/css/screen.css
162
+ - test/source/foo
163
+ - test/source/foo/_posts
164
+ - test/source/foo/_posts/bar
165
+ - test/source/foo/_posts/bar/2008-12-12-topical-post.textile
166
+ - test/source/index.html
167
+ - test/source/z_category
168
+ - test/source/z_category/_posts
169
+ - test/source/z_category/_posts/2008-9-23-categories.textile
170
+ - test/suite.rb
171
+ - test/test_filters.rb
172
+ - test/test_generated_site.rb
173
+ - test/test_jekyll.rb
174
+ - test/test_post.rb
175
+ - test/test_site.rb
176
+ - test/test_tags.rb
177
+ has_rdoc: true
178
+ homepage: http://github.com/mojombo/jekyll
179
+ post_install_message:
180
+ rdoc_options:
181
+ - --inline-source
182
+ - --charset=UTF-8
183
+ require_paths:
184
+ - lib
185
+ required_ruby_version: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - ">="
188
+ - !ruby/object:Gem::Version
189
+ version: "0"
190
+ version:
191
+ required_rubygems_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: "0"
196
+ version:
197
+ requirements: []
198
+
199
+ rubyforge_project: jekyll
200
+ rubygems_version: 1.2.0
201
+ signing_key:
202
+ specification_version: 2
203
+ summary: Jekyll is a simple, blog aware, static site generator.
204
+ test_files: []
205
+