jekyll-reloaded 0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/Gemfile +2 -0
  2. data/History.txt +321 -0
  3. data/LICENSE +21 -0
  4. data/README.textile +41 -0
  5. data/Rakefile +161 -0
  6. data/bin/jekyll +289 -0
  7. data/cucumber.yml +1 -0
  8. data/features/create_sites.feature +112 -0
  9. data/features/embed_filters.feature +60 -0
  10. data/features/markdown.feature +30 -0
  11. data/features/pagination.feature +27 -0
  12. data/features/permalinks.feature +65 -0
  13. data/features/post_data.feature +153 -0
  14. data/features/site_configuration.feature +145 -0
  15. data/features/site_data.feature +82 -0
  16. data/features/step_definitions/jekyll_steps.rb +145 -0
  17. data/features/support/env.rb +19 -0
  18. data/jekyll.gemspec +146 -0
  19. data/lib/guard/jekyll.rb +57 -0
  20. data/lib/jekyll/converter.rb +50 -0
  21. data/lib/jekyll/converters/identity.rb +22 -0
  22. data/lib/jekyll/converters/markdown.rb +125 -0
  23. data/lib/jekyll/converters/textile.rb +50 -0
  24. data/lib/jekyll/convertible.rb +116 -0
  25. data/lib/jekyll/core_ext.rb +52 -0
  26. data/lib/jekyll/errors.rb +6 -0
  27. data/lib/jekyll/filters.rb +118 -0
  28. data/lib/jekyll/generator.rb +7 -0
  29. data/lib/jekyll/generators/pagination.rb +113 -0
  30. data/lib/jekyll/layout.rb +51 -0
  31. data/lib/jekyll/live_site.rb +216 -0
  32. data/lib/jekyll/migrators/csv.rb +26 -0
  33. data/lib/jekyll/migrators/drupal.rb +103 -0
  34. data/lib/jekyll/migrators/enki.rb +49 -0
  35. data/lib/jekyll/migrators/joomla.rb +53 -0
  36. data/lib/jekyll/migrators/marley.rb +52 -0
  37. data/lib/jekyll/migrators/mephisto.rb +84 -0
  38. data/lib/jekyll/migrators/mt.rb +86 -0
  39. data/lib/jekyll/migrators/posterous.rb +67 -0
  40. data/lib/jekyll/migrators/rss.rb +47 -0
  41. data/lib/jekyll/migrators/textpattern.rb +58 -0
  42. data/lib/jekyll/migrators/tumblr.rb +195 -0
  43. data/lib/jekyll/migrators/typo.rb +51 -0
  44. data/lib/jekyll/migrators/wordpress.rb +294 -0
  45. data/lib/jekyll/migrators/wordpressdotcom.rb +70 -0
  46. data/lib/jekyll/page.rb +160 -0
  47. data/lib/jekyll/plugin.rb +77 -0
  48. data/lib/jekyll/post.rb +262 -0
  49. data/lib/jekyll/site.rb +339 -0
  50. data/lib/jekyll/static_file.rb +77 -0
  51. data/lib/jekyll/tags/highlight.rb +118 -0
  52. data/lib/jekyll/tags/include.rb +37 -0
  53. data/lib/jekyll/tags/post_url.rb +38 -0
  54. data/lib/jekyll.rb +134 -0
  55. data/test/helper.rb +34 -0
  56. data/test/source/.htaccess +8 -0
  57. data/test/source/_includes/sig.markdown +3 -0
  58. data/test/source/_layouts/default.html +27 -0
  59. data/test/source/_layouts/simple.html +1 -0
  60. data/test/source/_posts/2008-02-02-not-published.textile +8 -0
  61. data/test/source/_posts/2008-02-02-published.textile +8 -0
  62. data/test/source/_posts/2008-10-18-foo-bar.textile +8 -0
  63. data/test/source/_posts/2008-11-21-complex.textile +8 -0
  64. data/test/source/_posts/2008-12-03-permalinked-post.textile +9 -0
  65. data/test/source/_posts/2008-12-13-include.markdown +8 -0
  66. data/test/source/_posts/2009-01-27-array-categories.textile +10 -0
  67. data/test/source/_posts/2009-01-27-categories.textile +7 -0
  68. data/test/source/_posts/2009-01-27-category.textile +7 -0
  69. data/test/source/_posts/2009-01-27-empty-categories.textile +7 -0
  70. data/test/source/_posts/2009-01-27-empty-category.textile +7 -0
  71. data/test/source/_posts/2009-03-12-hash-#1.markdown +6 -0
  72. data/test/source/_posts/2009-05-18-empty-tag.textile +6 -0
  73. data/test/source/_posts/2009-05-18-empty-tags.textile +6 -0
  74. data/test/source/_posts/2009-05-18-tag.textile +6 -0
  75. data/test/source/_posts/2009-05-18-tags.textile +9 -0
  76. data/test/source/_posts/2009-06-22-empty-yaml.textile +3 -0
  77. data/test/source/_posts/2009-06-22-no-yaml.textile +1 -0
  78. data/test/source/_posts/2010-01-08-triple-dash.markdown +5 -0
  79. data/test/source/_posts/2010-01-09-date-override.textile +7 -0
  80. data/test/source/_posts/2010-01-09-time-override.textile +7 -0
  81. data/test/source/_posts/2010-01-09-timezone-override.textile +7 -0
  82. data/test/source/_posts/2010-01-16-override-data.textile +4 -0
  83. data/test/source/_posts/2011-04-12-md-extension.md +7 -0
  84. data/test/source/_posts/2011-04-12-text-extension.text +0 -0
  85. data/test/source/about.html +6 -0
  86. data/test/source/category/_posts/2008-9-23-categories.textile +6 -0
  87. data/test/source/contacts.html +5 -0
  88. data/test/source/css/screen.css +76 -0
  89. data/test/source/deal.with.dots.html +7 -0
  90. data/test/source/foo/_posts/bar/2008-12-12-topical-post.textile +8 -0
  91. data/test/source/index.html +22 -0
  92. data/test/source/sitemap.xml +32 -0
  93. data/test/source/win/_posts/2009-05-24-yaml-linebreak.markdown +7 -0
  94. data/test/source/z_category/_posts/2008-9-23-categories.textile +6 -0
  95. data/test/suite.rb +11 -0
  96. data/test/test_configuration.rb +29 -0
  97. data/test/test_core_ext.rb +66 -0
  98. data/test/test_filters.rb +62 -0
  99. data/test/test_generated_site.rb +72 -0
  100. data/test/test_kramdown.rb +23 -0
  101. data/test/test_page.rb +117 -0
  102. data/test/test_pager.rb +113 -0
  103. data/test/test_post.rb +450 -0
  104. data/test/test_rdiscount.rb +18 -0
  105. data/test/test_redcarpet.rb +21 -0
  106. data/test/test_redcloth.rb +86 -0
  107. data/test/test_site.rb +220 -0
  108. data/test/test_tags.rb +201 -0
  109. metadata +332 -0
data/bin/jekyll ADDED
@@ -0,0 +1,289 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
4
+
5
+ help = <<HELP
6
+ Jekyll is a blog-aware, static site generator.
7
+
8
+ Basic Command Line Usage:
9
+ jekyll # . -> ./_site
10
+ jekyll <path to write generated site> # . -> <path>
11
+ jekyll <path to source> <path to write generated site> # <path> -> <path>
12
+ jekyll import <importer name> <options> # imports posts using named import script
13
+
14
+ Configuration is read from '<source>/_config.yml' but can be overriden
15
+ using the following options:
16
+
17
+ HELP
18
+
19
+ require 'optparse'
20
+ require 'jekyll'
21
+
22
+
23
+ exec = {}
24
+ options = {}
25
+ opts = OptionParser.new do |opts|
26
+ opts.banner = help
27
+
28
+ opts.on("--file [PATH]", "File to import from") do |import_file|
29
+ options['file'] = import_file
30
+ end
31
+
32
+ opts.on("--dbname [TEXT]", "DB to import from") do |import_dbname|
33
+ options['dbname'] = import_dbname
34
+ end
35
+
36
+ opts.on("--user [TEXT]", "Username to use when importing") do |import_user|
37
+ options['user'] = import_user
38
+ end
39
+
40
+ opts.on("--pass [TEXT]", "Password to use when importing") do |import_pass|
41
+ options['pass'] = import_pass
42
+ end
43
+
44
+ opts.on("--host [HOST ADDRESS]", "Host to import from") do |import_host|
45
+ options['host'] = import_host
46
+ end
47
+
48
+ opts.on("--site [SITE NAME]", "Site to import from") do |import_site|
49
+ options['site'] = import_site
50
+ end
51
+
52
+
53
+ opts.on("--[no-]safe", "Safe mode (default unsafe)") do |safe|
54
+ options['safe'] = safe
55
+ end
56
+
57
+ opts.on("--[no-]auto", "Auto-regenerate") do |auto|
58
+ options['auto'] = auto
59
+ end
60
+
61
+ opts.on("--server [PORT]", "Start web server (default port 4000)") do |port|
62
+ options['server'] = true
63
+ options['server_port'] = port unless port.nil?
64
+ end
65
+
66
+ opts.on("--no-server", "Do not start a web server") do |part|
67
+ options['server'] = false
68
+ end
69
+
70
+ opts.on("--base-url [BASE_URL]", "Serve website from a given base URL (default '/'") do |baseurl|
71
+ options['baseurl'] = baseurl
72
+ end
73
+
74
+ opts.on("--default-mimetype [MT]", "Mimetype to use when no file extension (if --server)") do |mt|
75
+ options['default-mimetype'] = mt
76
+ end
77
+
78
+ opts.on("--[no-]lsi", "Use LSI for better related posts") do |lsi|
79
+ options['lsi'] = lsi
80
+ end
81
+
82
+ opts.on("--[no-]pygments", "Use pygments to highlight code") do |pygments|
83
+ options['pygments'] = pygments
84
+ end
85
+
86
+ opts.on("--rdiscount", "Use rdiscount gem for Markdown") do
87
+ options['markdown'] = 'rdiscount'
88
+ end
89
+
90
+ opts.on("--redcarpet", "Use redcarpet gem for Markdown") do
91
+ options['markdown'] = 'redcarpet'
92
+ end
93
+
94
+ opts.on("--kramdown", "Use kramdown gem for Markdown") do
95
+ options['markdown'] = 'kramdown'
96
+ end
97
+
98
+ opts.on("--time [TIME]", "Time to generate the site for") do |time|
99
+ options['time'] = Time.parse(time)
100
+ end
101
+
102
+ opts.on("--[no-]future", "Render future dated posts") do |future|
103
+ options['future'] = future
104
+ end
105
+
106
+ opts.on("--permalink [TYPE]", "Use 'date' (default) for YYYY/MM/DD") do |style|
107
+ options['permalink'] = style unless style.nil?
108
+ end
109
+
110
+ opts.on("--paginate [POSTS_PER_PAGE]", "Paginate a blog's posts") do |per_page|
111
+ begin
112
+ options['paginate'] = per_page.to_i
113
+ raise ArgumentError if options['paginate'] == 0
114
+ rescue
115
+ puts 'you must specify a number of posts by page bigger than 0'
116
+ exit 0
117
+ end
118
+ end
119
+
120
+ opts.on("--limit_posts [MAX_POSTS]", "Limit the number of posts to publish") do |limit_posts|
121
+ begin
122
+ options['limit_posts'] = limit_posts.to_i
123
+ raise ArgumentError if options['limit_posts'] < 1
124
+ rescue
125
+ puts 'you must specify a number of posts by page bigger than 0'
126
+ exit 0
127
+ end
128
+ end
129
+
130
+ opts.on("--url [URL]", "Set custom site.url") do |url|
131
+ options['url'] = url
132
+ end
133
+
134
+ opts.on("--version", "Display current version") do
135
+ puts "Jekyll " + Jekyll::VERSION
136
+ exit 0
137
+ end
138
+ end
139
+
140
+ # Read command line options into `options` hash
141
+ opts.parse!
142
+
143
+
144
+ # Check for import stuff
145
+ if ARGV.size > 0
146
+ if ARGV[0] == 'import'
147
+ migrator = ARGV[1]
148
+
149
+ if migrator.nil?
150
+ puts "Invalid options. Run `jekyll --help` for assistance."
151
+ exit(1)
152
+ else
153
+ migrator = migrator.downcase
154
+ end
155
+
156
+ cmd_options = []
157
+ ['file', 'dbname', 'user', 'pass', 'host', 'site'].each do |p|
158
+ cmd_options << "\"#{options[p]}\"" unless options[p].nil?
159
+ end
160
+
161
+ # It's import time
162
+ puts "Importing..."
163
+
164
+ # Ideally, this shouldn't be necessary. Maybe parse the actual
165
+ # src files for the migrator name?
166
+ migrators = {
167
+ :posterous => 'Posterous',
168
+ :wordpressdotcom => 'WordpressDotCom',
169
+ :wordpress => 'WordPress',
170
+ :csv => 'CSV',
171
+ :drupal => 'Drupal',
172
+ :enki => 'Enki',
173
+ :mephisto => 'Mephisto',
174
+ :mt => 'MT',
175
+ :textpattern => 'TextPattern',
176
+ :tumblr => 'Tumblr',
177
+ :typo => 'Typo'
178
+ }
179
+
180
+ app_root = File.join(File.dirname(__FILE__), '..')
181
+
182
+ require "#{app_root}/lib/jekyll/migrators/#{migrator}"
183
+
184
+ if Jekyll.const_defined?(migrators[migrator.to_sym])
185
+ migrator_class = Jekyll.const_get(migrators[migrator.to_sym])
186
+ migrator_class.process(*cmd_options)
187
+ else
188
+ puts "Invalid migrator. Run `jekyll --help` for assistance."
189
+ exit(1)
190
+ end
191
+
192
+ exit(0)
193
+ end
194
+ end
195
+
196
+
197
+
198
+ # Get source and destination from command line
199
+ case ARGV.size
200
+ when 0
201
+ when 1
202
+ options['destination'] = ARGV[0]
203
+ when 2
204
+ options['source'] = ARGV[0]
205
+ options['destination'] = ARGV[1]
206
+ else
207
+ puts "Invalid options. Run `jekyll --help` for assistance."
208
+ exit(1)
209
+ end
210
+
211
+ options = Jekyll.configuration(options)
212
+
213
+ # Get source and destination directories (possibly set by config file)
214
+ source = options['source']
215
+ destination = options['destination']
216
+
217
+ # Files to watch
218
+ def globs(source)
219
+ Dir.chdir(source) do
220
+ dirs = Dir['*'].select { |x| File.directory?(x) }
221
+ dirs -= ['_site']
222
+ dirs = dirs.map { |x| "#{x}/**/*" }
223
+ dirs += ['*']
224
+ end
225
+ end
226
+
227
+ # Create the Site
228
+ site = Jekyll::Site.new(options)
229
+
230
+ # Run the directory watcher for auto-generation, if required
231
+ if options['auto']
232
+ require 'directory_watcher'
233
+
234
+ puts "Auto-regenerating enabled: #{source} -> #{destination}"
235
+
236
+ dw = DirectoryWatcher.new(source)
237
+ dw.interval = 1
238
+ dw.glob = globs(source)
239
+
240
+ dw.add_observer do |*args|
241
+ t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
242
+ puts "[#{t}] regeneration: #{args.size} files changed"
243
+ site.process
244
+ end
245
+
246
+ dw.start
247
+
248
+ unless options['server']
249
+ loop { sleep 1000 }
250
+ end
251
+ else
252
+ puts "Building site: #{source} -> #{destination}"
253
+ begin
254
+ site.process
255
+ rescue Jekyll::FatalException => e
256
+ puts
257
+ puts "ERROR: YOUR SITE COULD NOT BE BUILT:"
258
+ puts "------------------------------------"
259
+ puts e.message
260
+ exit(1)
261
+ end
262
+ puts "Successfully generated site: #{source} -> #{destination}"
263
+ end
264
+
265
+ # Run the server on the specified port, if required
266
+ if options['server']
267
+ require 'webrick'
268
+ include WEBrick
269
+
270
+ FileUtils.mkdir_p(destination)
271
+
272
+ mime_types = WEBrick::HTTPUtils::DefaultMimeTypes
273
+ mime_types.store 'js', 'application/javascript'
274
+ if options['default-mimetype']
275
+ mime_types.store(nil, options['default-mimetype'])
276
+ end
277
+
278
+ s = HTTPServer.new(
279
+ :Port => options['server_port'],
280
+ :MimeTypes => mime_types
281
+ )
282
+ s.mount(options['baseurl'], HTTPServlet::FileHandler, destination)
283
+ t = Thread.new {
284
+ s.start
285
+ }
286
+
287
+ trap("INT") { s.shutdown }
288
+ t.join()
289
+ end
data/cucumber.yml ADDED
@@ -0,0 +1 @@
1
+ default: --format progress
@@ -0,0 +1,112 @@
1
+ Feature: Create sites
2
+ As a hacker who likes to blog
3
+ I want to be able to make a static site
4
+ In order to share my awesome ideas with the interwebs
5
+
6
+ Scenario: Basic site
7
+ Given I have an "index.html" file that contains "Basic Site"
8
+ When I run jekyll
9
+ Then the _site directory should exist
10
+ And I should see "Basic Site" in "_site/index.html"
11
+
12
+ Scenario: Basic site with a post
13
+ Given I have a _posts directory
14
+ And I have the following post:
15
+ | title | date | content |
16
+ | Hackers | 3/27/2009 | My First Exploit |
17
+ When I run jekyll
18
+ Then the _site directory should exist
19
+ And I should see "My First Exploit" in "_site/2009/03/27/hackers.html"
20
+
21
+ Scenario: Basic site with layout and a page
22
+ Given I have a _layouts directory
23
+ And I have an "index.html" page with layout "default" that contains "Basic Site with Layout"
24
+ And I have a default layout that contains "Page Layout: {{ content }}"
25
+ When I run jekyll
26
+ Then the _site directory should exist
27
+ And I should see "Page Layout: Basic Site with Layout" in "_site/index.html"
28
+
29
+ Scenario: Basic site with layout and a post
30
+ Given I have a _layouts directory
31
+ And I have a _posts directory
32
+ And I have the following posts:
33
+ | title | date | layout | content |
34
+ | Wargames | 3/27/2009 | default | The only winning move is not to play. |
35
+ And I have a default layout that contains "Post Layout: {{ content }}"
36
+ When I run jekyll
37
+ Then the _site directory should exist
38
+ And I should see "Post Layout: <p>The only winning move is not to play.</p>" in "_site/2009/03/27/wargames.html"
39
+
40
+ Scenario: Basic site with layouts, pages, posts and files
41
+ Given I have a _layouts directory
42
+ And I have a page layout that contains "Page {{ page.title }}: {{ content }}"
43
+ And I have a post layout that contains "Post {{ page.title }}: {{ content }}"
44
+ And I have an "index.html" page with layout "page" that contains "Site contains {{ site.pages.size }} pages and {{ site.posts.size }} posts"
45
+ And I have a blog directory
46
+ And I have a "blog/index.html" page with layout "page" that contains "blog category index page"
47
+ And I have an "about.html" file that contains "No replacement {{ site.posts.size }}"
48
+ And I have an "another_file" file that contains ""
49
+ And I have a _posts directory
50
+ And I have the following posts:
51
+ | title | date | layout | content |
52
+ | entry1 | 3/27/2009 | post | content for entry1. |
53
+ | entry2 | 4/27/2009 | post | content for entry2. |
54
+ And I have a category/_posts directory
55
+ And I have the following posts in "category":
56
+ | title | date | layout | content |
57
+ | entry3 | 5/27/2009 | post | content for entry3. |
58
+ | entry4 | 6/27/2009 | post | content for entry4. |
59
+ When I run jekyll
60
+ Then the _site directory should exist
61
+ And I should see "Page : Site contains 2 pages and 4 posts" in "_site/index.html"
62
+ And I should see "No replacement \{\{ site.posts.size \}\}" in "_site/about.html"
63
+ And I should see "" in "_site/another_file"
64
+ And I should see "Page : blog category index page" in "_site/blog/index.html"
65
+ And I should see "Post entry1: <p>content for entry1.</p>" in "_site/2009/03/27/entry1.html"
66
+ And I should see "Post entry2: <p>content for entry2.</p>" in "_site/2009/04/27/entry2.html"
67
+ And I should see "Post entry3: <p>content for entry3.</p>" in "_site/category/2009/05/27/entry3.html"
68
+ And I should see "Post entry4: <p>content for entry4.</p>" in "_site/category/2009/06/27/entry4.html"
69
+
70
+ Scenario: Basic site with include tag
71
+ Given I have a _includes directory
72
+ And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
73
+ And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
74
+ When I run jekyll
75
+ Then the _site directory should exist
76
+ And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
77
+
78
+ Scenario: Basic site with subdir include tag
79
+ Given I have a _includes directory
80
+ And I have an "_includes/about.textile" file that contains "Generated by Jekyll"
81
+ And I have an info directory
82
+ And I have an "info/index.html" page that contains "Basic Site with subdir include tag: {% include about.textile %}"
83
+ When I run jekyll
84
+ Then the _site directory should exist
85
+ And I should see "Basic Site with subdir include tag: Generated by Jekyll" in "_site/info/index.html"
86
+
87
+ Scenario: Basic site with nested include tag
88
+ Given I have a _includes directory
89
+ And I have an "_includes/about.textile" file that contains "Generated by {% include jekyll.textile %}"
90
+ And I have an "_includes/jekyll.textile" file that contains "Jekyll"
91
+ And I have an "index.html" page that contains "Basic Site with include tag: {% include about.textile %}"
92
+ When I debug jekyll
93
+ Then the _site directory should exist
94
+ And I should see "Basic Site with include tag: Generated by Jekyll" in "_site/index.html"
95
+
96
+ Scenario: Basic site with internal post linking
97
+ Given I have an "index.html" page that contains "URL: {% post_url 2020-01-31-entry2 %}"
98
+ And I have a configuration file with "permalink" set to "pretty"
99
+ And I have a _posts directory
100
+ And I have the following posts:
101
+ | title | date | layout | content |
102
+ | entry1 | 12/31/2007 | post | content for entry1. |
103
+ | entry2 | 01/31/2020 | post | content for entry2. |
104
+ When I run jekyll
105
+ Then the _site directory should exist
106
+ And I should see "URL: /2020/01/31/entry2/" in "_site/index.html"
107
+
108
+ Scenario: Basic site with whitelisted dotfile
109
+ Given I have an ".htaccess" file that contains "SomeDirective"
110
+ When I run jekyll
111
+ Then the _site directory should exist
112
+ And I should see "SomeDirective" in "_site/.htaccess"
@@ -0,0 +1,60 @@
1
+ Feature: Embed filters
2
+ As a hacker who likes to blog
3
+ I want to be able to transform text inside a post or page
4
+ In order to perform cool stuff in my posts
5
+
6
+ Scenario: Convert date to XML schema
7
+ Given I have a _posts directory
8
+ And I have a _layouts directory
9
+ And I have the following post:
10
+ | title | date | layout | content |
11
+ | Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
12
+ And I have a default layout that contains "{{ site.time | date_to_xmlschema }}"
13
+ When I run jekyll
14
+ Then the _site directory should exist
15
+ And I should see today's date in "_site/2009/03/27/star-wars.html"
16
+
17
+ Scenario: Escape text for XML
18
+ Given I have a _posts directory
19
+ And I have a _layouts directory
20
+ And I have the following post:
21
+ | title | date | layout | content |
22
+ | Star & Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
23
+ And I have a default layout that contains "{{ page.title | xml_escape }}"
24
+ When I run jekyll
25
+ Then the _site directory should exist
26
+ And I should see "Star &amp; Wars" in "_site/2009/03/27/star-wars.html"
27
+
28
+ Scenario: Calculate number of words
29
+ Given I have a _posts directory
30
+ And I have a _layouts directory
31
+ And I have the following post:
32
+ | title | date | layout | content |
33
+ | Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
34
+ And I have a default layout that contains "{{ content | xml_escape }}"
35
+ When I run jekyll
36
+ Then the _site directory should exist
37
+ And I should see "7" in "_site/2009/03/27/star-wars.html"
38
+
39
+ Scenario: Convert an array into a sentence
40
+ Given I have a _posts directory
41
+ And I have a _layouts directory
42
+ And I have the following post:
43
+ | title | date | layout | tags | content |
44
+ | Star Wars | 3/27/2009 | default | [scifi, movies, force] | These aren't the droids you're looking for. |
45
+ And I have a default layout that contains "{{ page.tags | array_to_sentence_string }}"
46
+ When I run jekyll
47
+ Then the _site directory should exist
48
+ And I should see "scifi, movies, and force" in "_site/2009/03/27/star-wars.html"
49
+
50
+ Scenario: Textilize a given string
51
+ Given I have a _posts directory
52
+ And I have a _layouts directory
53
+ And I have the following post:
54
+ | title | date | layout | content |
55
+ | Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. |
56
+ And I have a default layout that contains "By {{ '_Obi-wan_' | textilize }}"
57
+ When I run jekyll
58
+ Then the _site directory should exist
59
+ And I should see "By <p><em>Obi-wan</em></p>" in "_site/2009/03/27/star-wars.html"
60
+
@@ -0,0 +1,30 @@
1
+ Feature: Markdown
2
+ As a hacker who likes to blog
3
+ I want to be able to make a static site
4
+ In order to share my awesome ideas with the interwebs
5
+
6
+ Scenario: Markdown in list on index
7
+ Given I have a configuration file with "paginate" set to "5"
8
+ And I have an "index.html" page that contains "Index - {% for post in site.posts %} {{ post.content }} {% endfor %}"
9
+ And I have a _posts directory
10
+ And I have the following post:
11
+ | title | date | content | type |
12
+ | Hackers | 3/27/2009 | # My Title | markdown |
13
+ When I run jekyll
14
+ Then the _site directory should exist
15
+ And I should see "Index" in "_site/index.html"
16
+ And I should see "<h1 id='my_title'>My Title</h1>" in "_site/2009/03/27/hackers.html"
17
+ And I should see "<h1 id='my_title'>My Title</h1>" in "_site/index.html"
18
+
19
+ Scenario: Markdown in pagination on index
20
+ Given I have a configuration file with "paginate" set to "5"
21
+ And I have an "index.html" page that contains "Index - {% for post in paginator.posts %} {{ post.content }} {% endfor %}"
22
+ And I have a _posts directory
23
+ And I have the following post:
24
+ | title | date | content | type |
25
+ | Hackers | 3/27/2009 | # My Title | markdown |
26
+ When I run jekyll
27
+ Then the _site directory should exist
28
+ And I should see "Index" in "_site/index.html"
29
+ And I should see "<h1 id='my_title'>My Title</h1>" in "_site/index.html"
30
+
@@ -0,0 +1,27 @@
1
+ Feature: Site pagination
2
+ In order to paginate my blog
3
+ As a blog's user
4
+ I want divide the posts in several pages
5
+
6
+ Scenario Outline: Paginate with N posts per page
7
+ Given I have a configuration file with "paginate" set to "<num>"
8
+ And I have a _layouts directory
9
+ And I have an "index.html" page that contains "{{ paginator.posts.size }}"
10
+ And I have a _posts directory
11
+ And I have the following post:
12
+ | title | date | layout | content |
13
+ | Wargames | 3/27/2009 | default | The only winning move is not to play. |
14
+ | Wargames2 | 4/27/2009 | default | The only winning move is not to play2. |
15
+ | Wargames3 | 5/27/2009 | default | The only winning move is not to play3. |
16
+ | Wargames4 | 6/27/2009 | default | The only winning move is not to play4. |
17
+ When I run jekyll
18
+ Then the _site/page<exist> directory should exist
19
+ And the "_site/page<exist>/index.html" file should exist
20
+ And I should see "<posts>" in "_site/page<exist>/index.html"
21
+ And the "_site/page<not_exist>/index.html" file should not exist
22
+
23
+ Examples:
24
+ | num | exist | posts | not_exist |
25
+ | 1 | 4 | 1 | 5 |
26
+ | 2 | 2 | 2 | 3 |
27
+ | 3 | 2 | 1 | 3 |
@@ -0,0 +1,65 @@
1
+ Feature: Fancy permalinks
2
+ As a hacker who likes to blog
3
+ I want to be able to set permalinks
4
+ In order to make my blog URLs awesome
5
+
6
+ Scenario: Use none permalink schema
7
+ Given I have a _posts directory
8
+ And I have the following post:
9
+ | title | date | content |
10
+ | None Permalink Schema | 3/27/2009 | Totally nothing. |
11
+ And I have a configuration file with "permalink" set to "none"
12
+ When I run jekyll
13
+ Then the _site directory should exist
14
+ And I should see "Totally nothing." in "_site/none-permalink-schema.html"
15
+
16
+ Scenario: Use pretty permalink schema
17
+ Given I have a _posts directory
18
+ And I have the following post:
19
+ | title | date | content |
20
+ | Pretty Permalink Schema | 3/27/2009 | Totally wordpress. |
21
+ And I have a configuration file with "permalink" set to "pretty"
22
+ When I run jekyll
23
+ Then the _site directory should exist
24
+ And I should see "Totally wordpress." in "_site/2009/03/27/pretty-permalink-schema/index.html"
25
+
26
+ Scenario: Use pretty permalink schema for pages
27
+ Given I have an "index.html" page that contains "Totally index"
28
+ And I have an "awesome.html" page that contains "Totally awesome"
29
+ And I have an "sitemap.xml" page that contains "Totally uhm, sitemap"
30
+ And I have a configuration file with "permalink" set to "pretty"
31
+ When I run jekyll
32
+ Then the _site directory should exist
33
+ And I should see "Totally index" in "_site/index.html"
34
+ And I should see "Totally awesome" in "_site/awesome/index.html"
35
+ And I should see "Totally uhm, sitemap" in "_site/sitemap.xml"
36
+
37
+ Scenario: Use custom permalink schema with prefix
38
+ Given I have a _posts directory
39
+ And I have the following post:
40
+ | title | category | date | content |
41
+ | Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
42
+ And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title"
43
+ When I run jekyll
44
+ Then the _site directory should exist
45
+ And I should see "Totally custom." in "_site/blog/2009/03/27/custom-permalink-schema/index.html"
46
+
47
+ Scenario: Use custom permalink schema with category
48
+ Given I have a _posts directory
49
+ And I have the following post:
50
+ | title | category | date | content |
51
+ | Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
52
+ And I have a configuration file with "permalink" set to "/:categories/:title.html"
53
+ When I run jekyll
54
+ Then the _site directory should exist
55
+ And I should see "Totally custom." in "_site/stuff/custom-permalink-schema.html"
56
+
57
+ Scenario: Use custom permalink schema with squished date
58
+ Given I have a _posts directory
59
+ And I have the following post:
60
+ | title | category | date | content |
61
+ | Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. |
62
+ And I have a configuration file with "permalink" set to "/:month-:day-:year/:title.html"
63
+ When I run jekyll
64
+ Then the _site directory should exist
65
+ And I should see "Totally custom." in "_site/03-27-2009/custom-permalink-schema.html"