jekyll 1.5.1 → 2.0.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of jekyll might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CONTRIBUTING.markdown +6 -6
- data/History.markdown +99 -23
- data/README.markdown +7 -3
- data/Rakefile +5 -5
- data/bin/jekyll +101 -116
- data/features/embed_filters.feature +13 -0
- data/features/include_tag.feature +11 -0
- data/features/markdown.feature +3 -3
- data/features/site_configuration.feature +34 -3
- data/features/step_definitions/jekyll_steps.rb +47 -34
- data/features/support/env.rb +25 -28
- data/jekyll.gemspec +38 -18
- data/lib/jekyll.rb +7 -15
- data/lib/jekyll/commands/build.rb +2 -0
- data/lib/jekyll/commands/serve.rb +11 -1
- data/lib/jekyll/configuration.rb +22 -6
- data/lib/jekyll/converter.rb +16 -16
- data/lib/jekyll/converters/markdown.rb +30 -15
- data/lib/jekyll/converters/markdown/maruku_parser.rb +4 -5
- data/lib/jekyll/converters/markdown/redcarpet_parser.rb +34 -3
- data/lib/jekyll/converters/sass.rb +58 -0
- data/lib/jekyll/converters/textile.rb +2 -2
- data/lib/jekyll/convertible.rb +25 -6
- data/lib/jekyll/core_ext.rb +0 -35
- data/lib/jekyll/deprecator.rb +2 -2
- data/lib/jekyll/entry_filter.rb +61 -25
- data/lib/jekyll/excerpt.rb +8 -6
- data/lib/jekyll/filters.rb +46 -2
- data/lib/jekyll/layout_reader.rb +40 -0
- data/lib/jekyll/mime.types +19 -9
- data/lib/jekyll/page.rb +6 -4
- data/lib/jekyll/post.rb +11 -18
- data/lib/jekyll/site.rb +34 -32
- data/lib/jekyll/tags/highlight.rb +26 -4
- data/lib/jekyll/tags/include.rb +29 -17
- data/lib/jekyll/tags/post_url.rb +10 -1
- data/lib/jekyll/url.rb +0 -2
- data/lib/site_template/_config.yml +1 -1
- data/lib/site_template/_posts/0000-00-00-welcome-to-jekyll.markdown.erb +1 -1
- data/lib/site_template/css/main.css +8 -1
- data/script/bootstrap +2 -0
- data/script/branding +11 -0
- data/script/cibuild +5 -0
- data/script/rebund +140 -0
- data/site/_config.yml +2 -2
- data/site/_data/docs.yml +44 -0
- data/site/{css → _includes/css}/gridism.css +0 -0
- data/site/_includes/css/normalize.css +1 -0
- data/site/{css → _includes/css}/pygments.css +2 -0
- data/site/{css → _includes/css}/style.css +10 -0
- data/site/_includes/docs_contents.html +4 -12
- data/site/_includes/docs_contents_mobile.html +4 -17
- data/site/_includes/docs_option.html +1 -1
- data/site/_includes/docs_ul.html +2 -2
- data/site/_includes/footer.html +1 -1
- data/site/_includes/top.html +1 -4
- data/site/_layouts/news_item.html +2 -2
- data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +4 -4
- data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +1 -1
- data/site/_posts/2013-10-28-jekyll-1-3-0-rc1-released.markdown +1 -1
- data/site/_posts/2013-12-09-jekyll-1-4-1-released.markdown +20 -0
- data/site/_posts/2014-01-13-jekyll-1-4-3-released.markdown +1 -2
- data/site/css/screen.css +27 -0
- data/site/docs/assets.md +46 -0
- data/site/docs/configuration.md +18 -4
- data/site/docs/contributing.md +2 -2
- data/site/docs/datafiles.md +6 -6
- data/site/docs/deployment-methods.md +5 -0
- data/site/docs/extras.md +38 -2
- data/site/docs/frontmatter.md +2 -1
- data/site/docs/history.md +0 -22
- data/site/docs/installation.md +7 -7
- data/site/docs/migrations.md +1 -1
- data/site/docs/plugins.md +11 -2
- data/site/docs/posts.md +25 -4
- data/site/docs/sites.md +1 -1
- data/site/docs/structure.md +1 -1
- data/site/docs/templates.md +13 -8
- data/site/docs/troubleshooting.md +8 -5
- data/site/docs/usage.md +11 -0
- data/site/docs/variables.md +18 -0
- data/site/docs/windows.md +44 -0
- data/test/helper.rb +5 -8
- data/test/source/_includes/include.html +1 -0
- data/test/source/_includes/sig.markdown +2 -2
- data/test/source/_posts/2013-12-17-include-variable-filters.markdown +21 -0
- data/test/source/_posts/2013-12-20-properties.text +11 -0
- data/test/source/_sass/_grid.scss +1 -0
- data/test/source/css/main.scss +4 -0
- data/test/source/js/coffeescript.coffee +10 -0
- data/test/source/properties.html +8 -0
- data/test/source/unpublished.html +7 -0
- data/test/test_coffeescript.rb +49 -0
- data/test/test_configuration.rb +29 -18
- data/test/test_convertible.rb +7 -9
- data/test/test_core_ext.rb +0 -22
- data/test/test_entry_filter.rb +36 -2
- data/test/test_excerpt.rb +43 -1
- data/test/test_filters.rb +44 -5
- data/test/test_generated_site.rb +5 -1
- data/test/test_layout_reader.rb +17 -0
- data/test/test_page.rb +28 -10
- data/test/test_post.rb +32 -15
- data/test/test_redcarpet.rb +19 -3
- data/test/test_sass.rb +122 -0
- data/test/test_site.rb +56 -7
- data/test/test_tags.rb +102 -51
- metadata +154 -80
- data/site/_posts/2014-03-24-jekyll-1-5-0-released.markdown +0 -19
- data/site/_posts/2014-03-27-jekyll-1-5-1-released.markdown +0 -26
- data/site/css/normalize.css +0 -1
- data/test/source/_posts/2014-01-06-permalink-traversal.md +0 -5
- data/test/source/exploit.md +0 -5
- data/test/test_path_sanitization.rb +0 -18
data/test/test_sass.rb
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestSass < Test::Unit::TestCase
|
4
|
+
def site_configuration(overrides = {})
|
5
|
+
Jekyll::Configuration::DEFAULTS.deep_merge(overrides).deep_merge({
|
6
|
+
"source" => source_dir,
|
7
|
+
"destination" => dest_dir
|
8
|
+
})
|
9
|
+
end
|
10
|
+
|
11
|
+
def converter(overrides = {})
|
12
|
+
Jekyll::Sass.new(site_configuration({"sass" => overrides}))
|
13
|
+
end
|
14
|
+
|
15
|
+
def sass_content
|
16
|
+
<<-SASS
|
17
|
+
$font-stack: Helvetica, sans-serif
|
18
|
+
body
|
19
|
+
font-family: $font-stack
|
20
|
+
font-color: fuschia
|
21
|
+
SASS
|
22
|
+
end
|
23
|
+
|
24
|
+
def scss_content
|
25
|
+
<<-SCSS
|
26
|
+
$font-stack: Helvetica, sans-serif;
|
27
|
+
body {
|
28
|
+
font-family: $font-stack;
|
29
|
+
font-color: fuschia;
|
30
|
+
}
|
31
|
+
SCSS
|
32
|
+
end
|
33
|
+
|
34
|
+
def css_output
|
35
|
+
<<-CSS
|
36
|
+
body {\n font-family: Helvetica, sans-serif;\n font-color: fuschia; }
|
37
|
+
CSS
|
38
|
+
end
|
39
|
+
|
40
|
+
context "matching file extensions" do
|
41
|
+
should "match .scss files" do
|
42
|
+
assert converter.matches(".scss")
|
43
|
+
end
|
44
|
+
|
45
|
+
should "match .sass files" do
|
46
|
+
assert converter.matches(".sass")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context "determining the output file extension" do
|
51
|
+
should "always outputs the .css file extension" do
|
52
|
+
assert_equal ".css", converter.output_ext(".always-css")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "when building configurations" do
|
57
|
+
should "not allow caching in safe mode" do
|
58
|
+
verter = converter
|
59
|
+
verter.instance_variable_get(:@config)["safe"] = true
|
60
|
+
assert_equal false, verter.sass_configs[:cache]
|
61
|
+
end
|
62
|
+
|
63
|
+
should "allow caching in unsafe mode" do
|
64
|
+
assert_equal true, converter.sass_configs[:cache]
|
65
|
+
end
|
66
|
+
|
67
|
+
should "set the load paths to the _sass dir relative to site source" do
|
68
|
+
assert_equal [source_dir("_sass")], converter.sass_configs[:load_paths]
|
69
|
+
end
|
70
|
+
|
71
|
+
should "allow the user to specify a different sass dir" do
|
72
|
+
assert_equal [source_dir("_scss")], converter({"sass_dir" => "_scss"}).sass_configs[:load_paths]
|
73
|
+
end
|
74
|
+
|
75
|
+
should "set syntax :scss when SCSS content" do
|
76
|
+
assert_equal :scss, converter.sass_configs(scss_content)[:syntax]
|
77
|
+
end
|
78
|
+
|
79
|
+
should "set syntax :sass when Sass content" do
|
80
|
+
assert_equal :sass, converter.sass_configs(sass_content)[:syntax]
|
81
|
+
end
|
82
|
+
|
83
|
+
should "default to :sass syntax when content is empty" do
|
84
|
+
assert_equal :sass, converter.sass_configs[:syntax]
|
85
|
+
end
|
86
|
+
|
87
|
+
should "not allow sass_dirs outside of site source" do
|
88
|
+
assert_equal source_dir("etc/passwd"), converter({"sass_dir" => "/etc/passwd"}).sass_dir_relative_to_site_source
|
89
|
+
end
|
90
|
+
|
91
|
+
should "override user-set syntax based on content" do
|
92
|
+
assert_equal :sass, converter({"syntax" => :scss}).sass_configs(sass_content)[:syntax]
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context "converting sass" do
|
97
|
+
should "produce CSS" do
|
98
|
+
assert_equal css_output, converter.convert(sass_content)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context "converting SCSS" do
|
103
|
+
should "produce CSS" do
|
104
|
+
assert_equal css_output, converter.convert(scss_content)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
context "importing partials" do
|
109
|
+
setup do
|
110
|
+
@site = Jekyll::Site.new(Jekyll.configuration({
|
111
|
+
"source" => source_dir,
|
112
|
+
"destination" => dest_dir
|
113
|
+
}))
|
114
|
+
@site.process
|
115
|
+
@test_css_file = dest_dir("css/main.css")
|
116
|
+
end
|
117
|
+
|
118
|
+
should "import SCSS partial" do
|
119
|
+
assert_equal ".half {\n width: 50%; }\n", File.read(@test_css_file)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
data/test/test_site.rb
CHANGED
@@ -154,9 +154,12 @@ class TestSite < Test::Unit::TestCase
|
|
154
154
|
assert_equal @site.generators.sort_by(&:class).map{|g|g.class.priority}, @site.generators.map{|g|g.class.priority}
|
155
155
|
end
|
156
156
|
|
157
|
-
should "
|
158
|
-
|
159
|
-
|
157
|
+
should "sort pages alphabetically" do
|
158
|
+
stub.proxy(Dir).entries { |entries| entries.reverse }
|
159
|
+
@site.process
|
160
|
+
# files in symlinked directories may appear twice
|
161
|
+
sorted_pages = %w(.htaccess about.html bar.html coffeescript.coffee contacts.html deal.with.dots.html foo.md index.html index.html main.scss main.scss properties.html sitemap.xml symlinked-file)
|
162
|
+
assert_equal sorted_pages, @site.pages.map(&:name)
|
160
163
|
end
|
161
164
|
|
162
165
|
should "read posts" do
|
@@ -176,7 +179,7 @@ class TestSite < Test::Unit::TestCase
|
|
176
179
|
|
177
180
|
assert_equal posts.size - @num_invalid_posts, @site.posts.size
|
178
181
|
assert_equal categories, @site.categories.keys.sort
|
179
|
-
assert_equal
|
182
|
+
assert_equal 5, @site.categories['foo'].size
|
180
183
|
end
|
181
184
|
|
182
185
|
context 'error handling' do
|
@@ -255,6 +258,52 @@ class TestSite < Test::Unit::TestCase
|
|
255
258
|
end
|
256
259
|
end
|
257
260
|
|
261
|
+
context 'using a non-default markdown processor in the configuration' do
|
262
|
+
should 'use the non-default markdown processor' do
|
263
|
+
class Jekyll::Converters::Markdown::CustomMarkdown
|
264
|
+
def initialize(*args)
|
265
|
+
@args = args
|
266
|
+
end
|
267
|
+
|
268
|
+
def convert(*args)
|
269
|
+
""
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
custom_processor = "CustomMarkdown"
|
274
|
+
s = Site.new(Jekyll.configuration.merge({ 'markdown' => custom_processor }))
|
275
|
+
assert_nothing_raised do
|
276
|
+
s.process
|
277
|
+
end
|
278
|
+
|
279
|
+
# Do some cleanup, we don't like straggling stuff's.
|
280
|
+
Jekyll::Converters::Markdown.send(:remove_const, :CustomMarkdown)
|
281
|
+
end
|
282
|
+
|
283
|
+
should 'ignore, if there are any bad characters in the class name' do
|
284
|
+
module Jekyll::Converters::Markdown::Custom
|
285
|
+
class Markdown
|
286
|
+
def initialize(*args)
|
287
|
+
@args = args
|
288
|
+
end
|
289
|
+
|
290
|
+
def convert(*args)
|
291
|
+
""
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
bad_processor = "Custom::Markdown"
|
297
|
+
s = Site.new(Jekyll.configuration.merge({ 'markdown' => bad_processor }))
|
298
|
+
assert_raise Jekyll::FatalException do
|
299
|
+
s.process
|
300
|
+
end
|
301
|
+
|
302
|
+
# Do some cleanup, we don't like straggling stuff's.
|
303
|
+
Jekyll::Converters::Markdown.send(:remove_const, :Custom)
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
258
307
|
context 'with an invalid markdown processor in the configuration' do
|
259
308
|
should 'not throw an error at initialization time' do
|
260
309
|
bad_processor = 'not a processor name'
|
@@ -277,7 +326,7 @@ class TestSite < Test::Unit::TestCase
|
|
277
326
|
site = Site.new(Jekyll.configuration)
|
278
327
|
site.process
|
279
328
|
|
280
|
-
file_content =
|
329
|
+
file_content = SafeYAML.load_file(File.join(source_dir, '_data', 'members.yaml'))
|
281
330
|
|
282
331
|
assert_equal site.data['members'], file_content
|
283
332
|
assert_equal site.site_payload['site']['data']['members'], file_content
|
@@ -287,7 +336,7 @@ class TestSite < Test::Unit::TestCase
|
|
287
336
|
site = Site.new(Jekyll.configuration)
|
288
337
|
site.process
|
289
338
|
|
290
|
-
file_content =
|
339
|
+
file_content = SafeYAML.load_file(File.join(source_dir, '_data', 'languages.yml'))
|
291
340
|
|
292
341
|
assert_equal site.data['languages'], file_content
|
293
342
|
assert_equal site.site_payload['site']['data']['languages'], file_content
|
@@ -297,7 +346,7 @@ class TestSite < Test::Unit::TestCase
|
|
297
346
|
site = Site.new(Jekyll.configuration.merge({'safe' => false}))
|
298
347
|
site.process
|
299
348
|
|
300
|
-
file_content =
|
349
|
+
file_content = SafeYAML.load_file(File.join(source_dir, '_data', 'products.yml'))
|
301
350
|
|
302
351
|
assert_equal site.data['products'], file_content
|
303
352
|
assert_equal site.site_payload['site']['data']['products'], file_content
|
data/test/test_tags.rb
CHANGED
@@ -6,7 +6,7 @@ class TestTags < Test::Unit::TestCase
|
|
6
6
|
|
7
7
|
def create_post(content, override = {}, converter_class = Jekyll::Converters::Markdown)
|
8
8
|
stub(Jekyll).configuration do
|
9
|
-
Jekyll::Configuration::DEFAULTS.deep_merge({'
|
9
|
+
Jekyll::Configuration::DEFAULTS.deep_merge({'highlighter' => 'pygments'}).deep_merge(override)
|
10
10
|
end
|
11
11
|
site = Site.new(Jekyll.configuration)
|
12
12
|
|
@@ -16,8 +16,8 @@ class TestTags < Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
|
18
18
|
@converter = site.converters.find { |c| c.class == converter_class }
|
19
|
-
payload = { "
|
20
|
-
"
|
19
|
+
payload = { "highlighter_prefix" => @converter.highlighter_prefix,
|
20
|
+
"highlighter_suffix" => @converter.highlighter_suffix }
|
21
21
|
|
22
22
|
@result = Liquid::Template.parse(content).render!(payload, info)
|
23
23
|
@result = @converter.convert(@result)
|
@@ -54,7 +54,7 @@ CONTENT
|
|
54
54
|
end
|
55
55
|
|
56
56
|
context "initialized tag" do
|
57
|
-
should "
|
57
|
+
should "set the correct options" do
|
58
58
|
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby ', ["test", "{% endhighlight %}", "\n"])
|
59
59
|
assert_equal({}, tag.instance_variable_get(:@options))
|
60
60
|
|
@@ -85,11 +85,11 @@ CONTENT
|
|
85
85
|
end
|
86
86
|
|
87
87
|
should "render markdown with pygments" do
|
88
|
-
assert_match %{<pre><code class=
|
88
|
+
assert_match %{<pre><code class="text">test\n</code></pre>}, @result
|
89
89
|
end
|
90
90
|
|
91
91
|
should "render markdown with pygments with line numbers" do
|
92
|
-
assert_match %{<pre><code class=
|
92
|
+
assert_match %{<pre><code class="text"><span class="lineno">1</span> test\n</code></pre>}, @result
|
93
93
|
end
|
94
94
|
end
|
95
95
|
|
@@ -99,7 +99,7 @@ CONTENT
|
|
99
99
|
end
|
100
100
|
|
101
101
|
should "not embed the file" do
|
102
|
-
assert_match %{<pre><code class=
|
102
|
+
assert_match %{<pre><code class="text">./jekyll.gemspec\n</code></pre>}, @result
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -109,7 +109,7 @@ CONTENT
|
|
109
109
|
end
|
110
110
|
|
111
111
|
should "render markdown with pygments line handling" do
|
112
|
-
assert_match %{<pre><code class=
|
112
|
+
assert_match %{<pre><code class="text">Æ\n</code></pre>}, @result
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -237,6 +237,22 @@ CONTENT
|
|
237
237
|
end
|
238
238
|
end
|
239
239
|
|
240
|
+
context "simple page with invalid post name linking" do
|
241
|
+
should "cause an error" do
|
242
|
+
content = <<CONTENT
|
243
|
+
---
|
244
|
+
title: Invalid post name linking
|
245
|
+
---
|
246
|
+
|
247
|
+
{% post_url abc2008-11-21-complex %}
|
248
|
+
CONTENT
|
249
|
+
|
250
|
+
assert_raise ArgumentError do
|
251
|
+
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
240
256
|
context "gist tag" do
|
241
257
|
context "simple" do
|
242
258
|
setup do
|
@@ -252,7 +268,7 @@ CONTENT
|
|
252
268
|
end
|
253
269
|
|
254
270
|
should "write script tag" do
|
255
|
-
assert_match "<script src
|
271
|
+
assert_match "<script src=\"https://gist.github.com/#{@gist}.js\">\s</script>", @result
|
256
272
|
end
|
257
273
|
end
|
258
274
|
|
@@ -272,7 +288,7 @@ CONTENT
|
|
272
288
|
end
|
273
289
|
|
274
290
|
should "write script tag with specific file in gist" do
|
275
|
-
assert_match "<script src
|
291
|
+
assert_match "<script src=\"https://gist.github.com/#{@gist}.js?file=#{@filename}\">\s</script>", @result
|
276
292
|
end
|
277
293
|
end
|
278
294
|
|
@@ -308,7 +324,7 @@ CONTENT
|
|
308
324
|
end
|
309
325
|
|
310
326
|
should "write script tag with specific file in gist" do
|
311
|
-
assert_match "<script src
|
327
|
+
assert_match "<script src=\"https://gist.github.com/#{@gist}.js?file=#{@filename}\">\s</script>", @result
|
312
328
|
end
|
313
329
|
end
|
314
330
|
|
@@ -347,41 +363,6 @@ CONTENT
|
|
347
363
|
end
|
348
364
|
|
349
365
|
context "include tag with parameters" do
|
350
|
-
|
351
|
-
context "with symlink'd include" do
|
352
|
-
|
353
|
-
should "not allow symlink includes" do
|
354
|
-
File.open("/tmp/pages-test", 'w') { |file| file.write("SYMLINK TEST") }
|
355
|
-
assert_raise IOError do
|
356
|
-
content = <<CONTENT
|
357
|
-
---
|
358
|
-
title: Include symlink
|
359
|
-
---
|
360
|
-
|
361
|
-
{% include tmp/pages-test %}
|
362
|
-
|
363
|
-
CONTENT
|
364
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
|
365
|
-
end
|
366
|
-
assert_no_match /SYMLINK TEST/, @result
|
367
|
-
end
|
368
|
-
|
369
|
-
should "not expose the existence of symlinked files" do
|
370
|
-
ex = assert_raise IOError do
|
371
|
-
content = <<CONTENT
|
372
|
-
---
|
373
|
-
title: Include symlink
|
374
|
-
---
|
375
|
-
|
376
|
-
{% include tmp/pages-test-does-not-exist %}
|
377
|
-
|
378
|
-
CONTENT
|
379
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true, 'safe' => true })
|
380
|
-
end
|
381
|
-
assert_match /should exist and should not be a symlink/, ex.message
|
382
|
-
end
|
383
|
-
end
|
384
|
-
|
385
366
|
context "with one parameter" do
|
386
367
|
setup do
|
387
368
|
content = <<CONTENT
|
@@ -397,11 +378,11 @@ CONTENT
|
|
397
378
|
end
|
398
379
|
|
399
380
|
should "correctly output include variable" do
|
400
|
-
assert_match "<span id
|
381
|
+
assert_match "<span id=\"include-param\">value</span>", @result.strip
|
401
382
|
end
|
402
383
|
|
403
384
|
should "ignore parameters if unused" do
|
404
|
-
assert_match "<hr />\n<p>Tom Preston-Werner
|
385
|
+
assert_match "<hr />\n<p>Tom Preston-Werner\ngithub.com/mojombo</p>\n", @result
|
405
386
|
end
|
406
387
|
end
|
407
388
|
|
@@ -449,7 +430,7 @@ CONTENT
|
|
449
430
|
end
|
450
431
|
|
451
432
|
should "not include previously used parameters" do
|
452
|
-
assert_match "<span id
|
433
|
+
assert_match "<span id=\"include-param\"></span>", @result
|
453
434
|
end
|
454
435
|
end
|
455
436
|
|
@@ -466,7 +447,7 @@ CONTENT
|
|
466
447
|
end
|
467
448
|
|
468
449
|
should "include file with empty parameters" do
|
469
|
-
assert_match "<span id
|
450
|
+
assert_match "<span id=\"include-param\"></span>", @result
|
470
451
|
end
|
471
452
|
end
|
472
453
|
|
@@ -483,7 +464,77 @@ CONTENT
|
|
483
464
|
end
|
484
465
|
|
485
466
|
should "include file with empty parameters within if statement" do
|
486
|
-
assert_match "<span id
|
467
|
+
assert_match "<span id=\"include-param\"></span>", @result
|
468
|
+
end
|
469
|
+
end
|
470
|
+
|
471
|
+
context "with fenced code blocks with backticks" do
|
472
|
+
|
473
|
+
setup do
|
474
|
+
content = <<CONTENT
|
475
|
+
```ruby
|
476
|
+
puts "Hello world"
|
477
|
+
```
|
478
|
+
CONTENT
|
479
|
+
create_post(content, {
|
480
|
+
'markdown' => 'maruku',
|
481
|
+
'maruku' => {'fenced_code_blocks' => true}}
|
482
|
+
)
|
483
|
+
end
|
484
|
+
|
485
|
+
# todo: if #112 is merged into maruku, update to remove the newlines inside code block
|
486
|
+
should "render fenced code blocks" do
|
487
|
+
assert_match %r{<pre class=\"ruby\"><code class=\"ruby\">\nputs "Hello world"\n</code></pre>}, @result.strip
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
context "include missing file" do
|
492
|
+
setup do
|
493
|
+
@content = <<CONTENT
|
494
|
+
---
|
495
|
+
title: missing file
|
496
|
+
---
|
497
|
+
|
498
|
+
{% include missing.html %}
|
499
|
+
CONTENT
|
500
|
+
end
|
501
|
+
|
502
|
+
should "raise error relative to source directory" do
|
503
|
+
exception = assert_raise IOError do
|
504
|
+
create_post(@content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
505
|
+
end
|
506
|
+
assert_equal 'Included file \'_includes/missing.html\' not found', exception.message
|
507
|
+
end
|
508
|
+
end
|
509
|
+
|
510
|
+
context "include tag with variable and liquid filters" do
|
511
|
+
setup do
|
512
|
+
stub(Jekyll).configuration do
|
513
|
+
Jekyll::Configuration::DEFAULTS.deep_merge({'pygments' => true}).deep_merge({'source' => source_dir, 'destination' => dest_dir})
|
514
|
+
end
|
515
|
+
|
516
|
+
site = Site.new(Jekyll.configuration)
|
517
|
+
post = Post.new(site, source_dir, '', "2013-12-17-include-variable-filters.markdown")
|
518
|
+
layouts = { "default" => Layout.new(site, source_dir('_layouts'), "simple.html")}
|
519
|
+
post.render(layouts, {"site" => {"posts" => []}})
|
520
|
+
@content = post.content
|
521
|
+
end
|
522
|
+
|
523
|
+
should "include file as variable with liquid filters" do
|
524
|
+
assert_match %r{1 included}, @content
|
525
|
+
assert_match %r{2 included}, @content
|
526
|
+
assert_match %r{3 included}, @content
|
527
|
+
end
|
528
|
+
|
529
|
+
should "include file as variable and liquid filters with arbitrary whitespace" do
|
530
|
+
assert_match %r{4 included}, @content
|
531
|
+
assert_match %r{5 included}, @content
|
532
|
+
assert_match %r{6 included}, @content
|
533
|
+
end
|
534
|
+
|
535
|
+
should "include file as variable and filters with additional parameters" do
|
536
|
+
assert_match '<li>var1 = foo</li>', @content
|
537
|
+
assert_match '<li>var2 = bar</li>', @content
|
487
538
|
end
|
488
539
|
end
|
489
540
|
end
|