jekyll 2.0.3 → 2.1.0
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/.travis.yml +2 -2
- data/CONTRIBUTING.markdown +2 -2
- data/History.markdown +86 -0
- data/README.markdown +5 -30
- data/Rakefile +4 -9
- data/docs/jp/CONTRIBUTING.jp.markdown +2 -2
- data/docs/jp/README.jp.markdown +1 -2
- data/features/collections.feature +40 -3
- data/features/data.feature +41 -1
- data/features/frontmatter_defaults.feature +57 -0
- data/features/post_data.feature +12 -0
- data/features/rendering.feature +34 -0
- data/features/step_definitions/jekyll_steps.rb +5 -1
- data/features/support/env.rb +0 -3
- data/jekyll.gemspec +6 -5
- data/lib/jekyll.rb +18 -1
- data/lib/jekyll/cleaner.rb +22 -2
- data/lib/jekyll/collection.rb +9 -2
- data/lib/jekyll/command.rb +20 -10
- data/lib/jekyll/commands/build.rb +10 -47
- data/lib/jekyll/commands/serve.rb +1 -0
- data/lib/jekyll/configuration.rb +13 -1
- data/lib/jekyll/converters/markdown/redcarpet_parser.rb +9 -2
- data/lib/jekyll/convertible.rb +31 -2
- data/lib/jekyll/deprecator.rb +1 -1
- data/lib/jekyll/document.rb +21 -3
- data/lib/jekyll/excerpt.rb +1 -1
- data/lib/jekyll/filters.rb +16 -12
- data/lib/jekyll/frontmatter_defaults.rb +3 -3
- data/lib/jekyll/log_adapter.rb +102 -0
- data/lib/jekyll/post.rb +5 -5
- data/lib/jekyll/renderer.rb +9 -5
- data/lib/jekyll/site.rb +38 -18
- data/lib/jekyll/static_file.rb +1 -0
- data/lib/jekyll/stevenson.rb +54 -98
- data/lib/jekyll/tags/highlight.rb +13 -5
- data/lib/jekyll/url.rb +2 -2
- data/lib/jekyll/utils.rb +15 -7
- data/lib/jekyll/version.rb +1 -1
- data/lib/site_template/_config.yml +2 -0
- data/lib/site_template/_includes/footer.html +8 -8
- data/lib/site_template/_includes/header.html +1 -1
- data/lib/site_template/css/main.css +7 -2
- data/lib/site_template/feed.xml +10 -1
- data/site/_config.yml +1 -0
- data/site/_data/docs.yml +1 -0
- data/site/_includes/anchor_links.html +28 -23
- data/site/_includes/css/font-awesome.css +3 -3
- data/site/_includes/css/style.css +4 -0
- data/site/_includes/news_contents.html +11 -1
- data/site/_includes/top.html +0 -1
- data/site/_layouts/default.html +1 -0
- data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +1 -1
- data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +1 -1
- data/site/_posts/2014-06-04-jekyll-stickers-1-dollar-stickermule.markdown +19 -0
- data/site/_posts/2014-06-28-jekyll-turns-21-i-mean-2-1-0.markdown +27 -0
- data/site/docs/collections.md +59 -1
- data/site/docs/configuration.md +91 -21
- data/site/docs/continuous-integration.md +177 -0
- data/site/docs/contributing.md +2 -2
- data/site/docs/datafiles.md +47 -3
- data/site/docs/deployment-methods.md +3 -3
- data/site/docs/extras.md +3 -5
- data/site/docs/history.md +86 -0
- data/site/docs/installation.md +3 -1
- data/site/docs/pagination.md +2 -1
- data/site/docs/permalinks.md +4 -4
- data/site/docs/plugins.md +6 -0
- data/site/docs/quickstart.md +0 -6
- data/site/docs/resources.md +1 -1
- data/site/docs/templates.md +1 -1
- data/site/docs/troubleshooting.md +1 -1
- data/site/docs/windows.md +2 -2
- data/site/fonts/FontAwesome.otf +0 -0
- data/site/fonts/fontawesome-webfont.eot +0 -0
- data/site/fonts/fontawesome-webfont.svg +469 -379
- data/site/fonts/fontawesome-webfont.ttf +0 -0
- data/site/fonts/fontawesome-webfont.woff +0 -0
- data/site/img/jekyll-sticker.jpg +0 -0
- data/test/helper.rb +0 -3
- data/test/source/_data/categories/dairy.yaml +6 -0
- data/test/source/_data/members.json +12 -0
- data/test/source/_methods/site/initialize.md +1 -2
- data/test/source/_posts/2009-01-27-no-category.textile +6 -0
- data/test/source/_slides/example-slide-1.html +4 -0
- data/test/source/_slides/example-slide-2.html +7 -0
- data/test/source/_with.dots/all.dots/2.4.0.md +5 -0
- data/test/source/_with.dots/file.with.dots.md +0 -0
- data/test/source/environment.html +5 -0
- data/test/test_cleaner.rb +77 -0
- data/test/test_collections.rb +52 -3
- data/test/test_command.rb +25 -28
- data/test/test_configuration.rb +10 -1
- data/test/test_document.rb +123 -0
- data/test/test_excerpt.rb +11 -0
- data/test/test_filters.rb +28 -2
- data/test/test_generated_site.rb +1 -1
- data/test/test_log_adapter.rb +59 -0
- data/test/test_post.rb +77 -0
- data/test/test_site.rb +51 -0
- data/test/test_tags.rb +11 -114
- data/test/test_utils.rb +2 -2
- metadata +76 -39
- data/lib/jekyll/generators/pagination.rb +0 -217
- data/lib/jekyll/tags/gist.rb +0 -47
- data/test/test_pager.rb +0 -118
data/test/test_excerpt.rb
CHANGED
@@ -86,6 +86,17 @@ class TestExcerpt < Test::Unit::TestCase
|
|
86
86
|
assert_equal %w[first second third jekyllrb.com], @excerpt.to_liquid["tags"]
|
87
87
|
assert_equal "_posts/2013-07-22-post-excerpt-with-layout.markdown", @excerpt.to_liquid["path"]
|
88
88
|
end
|
89
|
+
|
90
|
+
should "consider inheritance" do
|
91
|
+
klass = Class.new(Jekyll::Post)
|
92
|
+
assert_gets_called = false
|
93
|
+
klass.send(:define_method, :assert_gets_called) { assert_gets_called = true }
|
94
|
+
klass.const_set(:EXCERPT_ATTRIBUTES_FOR_LIQUID, Jekyll::Post::EXCERPT_ATTRIBUTES_FOR_LIQUID + ['assert_gets_called'])
|
95
|
+
post = klass.new(@site, source_dir, '', "2008-02-02-published.textile")
|
96
|
+
Jekyll::Excerpt.new(post).to_liquid
|
97
|
+
|
98
|
+
assert assert_gets_called, 'assert_gets_called did not get called on post.'
|
99
|
+
end
|
89
100
|
end
|
90
101
|
|
91
102
|
context "#content" do
|
data/test/test_filters.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
1
3
|
require 'helper'
|
2
4
|
|
3
5
|
class TestFilters < Test::Unit::TestCase
|
@@ -13,9 +15,10 @@ class TestFilters < Test::Unit::TestCase
|
|
13
15
|
|
14
16
|
context "filters" do
|
15
17
|
setup do
|
16
|
-
@filter = JekyllFilter.new({"source" => source_dir, "destination" => dest_dir})
|
18
|
+
@filter = JekyllFilter.new({"source" => source_dir, "destination" => dest_dir, "timezone" => "UTC"})
|
17
19
|
@sample_time = Time.utc(2013, 03, 27, 11, 22, 33)
|
18
20
|
@time_as_string = "September 11, 2001 12:46:30 -0000"
|
21
|
+
@time_as_numeric = 1399680607
|
19
22
|
@array_of_objects = [
|
20
23
|
{ "color" => "red", "size" => "large" },
|
21
24
|
{ "color" => "red", "size" => "medium" },
|
@@ -86,6 +89,24 @@ class TestFilters < Test::Unit::TestCase
|
|
86
89
|
assert_equal "Tue, 11 Sep 2001 12:46:30 -0000", @filter.date_to_rfc822(@time_as_string)
|
87
90
|
end
|
88
91
|
end
|
92
|
+
|
93
|
+
context "with a Numeric object" do
|
94
|
+
should "format a date with short format" do
|
95
|
+
assert_equal "10 May 2014", @filter.date_to_string(@time_as_numeric)
|
96
|
+
end
|
97
|
+
|
98
|
+
should "format a date with long format" do
|
99
|
+
assert_equal "10 May 2014", @filter.date_to_long_string(@time_as_numeric)
|
100
|
+
end
|
101
|
+
|
102
|
+
should "format a time with xmlschema" do
|
103
|
+
assert_match /2014-05-10T00:10:07/, @filter.date_to_xmlschema(@time_as_numeric)
|
104
|
+
end
|
105
|
+
|
106
|
+
should "format a time according to RFC-822" do
|
107
|
+
assert_equal "Sat, 10 May 2014 00:10:07 +0000", @filter.date_to_rfc822(@time_as_numeric)
|
108
|
+
end
|
109
|
+
end
|
89
110
|
end
|
90
111
|
|
91
112
|
should "escape xml with ampersands" do
|
@@ -135,7 +156,7 @@ class TestFilters < Test::Unit::TestCase
|
|
135
156
|
assert_equal 2, g["items"].size
|
136
157
|
when ""
|
137
158
|
assert g["items"].is_a?(Array), "The list of grouped items for '' is not an Array."
|
138
|
-
assert_equal
|
159
|
+
assert_equal 11, g["items"].size
|
139
160
|
end
|
140
161
|
end
|
141
162
|
end
|
@@ -161,6 +182,11 @@ class TestFilters < Test::Unit::TestCase
|
|
161
182
|
assert_equal [{"a" => "10"}, {"a" => "2"}], @filter.sort([{"a" => "10"}, {"a" => "2"}], "a")
|
162
183
|
assert_equal ["FOO", "Foo", "foo"], @filter.sort(["foo", "Foo", "FOO"])
|
163
184
|
assert_equal ["_foo", "foo", "foo_"], @filter.sort(["foo_", "_foo", "foo"])
|
185
|
+
# Cyrillic
|
186
|
+
assert_equal ["ВУЗ", "Вуз", "вуз"], @filter.sort(["Вуз", "вуз", "ВУЗ"])
|
187
|
+
assert_equal ["_вуз", "вуз", "вуз_"], @filter.sort(["вуз_", "_вуз", "вуз"])
|
188
|
+
# Hebrew
|
189
|
+
assert_equal ["אלף", "בית"], @filter.sort(["בית", "אלף"])
|
164
190
|
end
|
165
191
|
should "return sorted by property array" do
|
166
192
|
assert_equal [{"a" => 1}, {"a" => 2}, {"a" => 3}, {"a" => 4}],
|
data/test/test_generated_site.rb
CHANGED
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestLogAdapter < Test::Unit::TestCase
|
4
|
+
class LoggerDouble
|
5
|
+
attr_accessor :level
|
6
|
+
end
|
7
|
+
|
8
|
+
context "#log_level=" do
|
9
|
+
should "set the writers logging level" do
|
10
|
+
subject = Jekyll::LogAdapter.new(LoggerDouble.new)
|
11
|
+
subject.log_level = :error
|
12
|
+
assert_equal Jekyll::LogAdapter::LOG_LEVELS[:error], subject.writer.level
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
context "#debug" do
|
17
|
+
should "call #debug on writer return true" do
|
18
|
+
writer = LoggerDouble.new
|
19
|
+
logger = Jekyll::LogAdapter.new(writer)
|
20
|
+
stub(writer).debug('topic '.rjust(20) + 'log message') { true }
|
21
|
+
assert logger.debug('topic', 'log message')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "#info" do
|
26
|
+
should "call #info on writer return true" do
|
27
|
+
writer = LoggerDouble.new
|
28
|
+
logger = Jekyll::LogAdapter.new(writer)
|
29
|
+
stub(writer).info('topic '.rjust(20) + 'log message') { true }
|
30
|
+
assert logger.info('topic', 'log message')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "#warn" do
|
35
|
+
should "call #warn on writer return true" do
|
36
|
+
writer = LoggerDouble.new
|
37
|
+
logger = Jekyll::LogAdapter.new(writer)
|
38
|
+
stub(writer).warn('topic '.rjust(20) + 'log message') { true }
|
39
|
+
assert logger.warn('topic', 'log message')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "#error" do
|
44
|
+
should "call #error on writer return true" do
|
45
|
+
writer = LoggerDouble.new
|
46
|
+
logger = Jekyll::LogAdapter.new(writer)
|
47
|
+
stub(writer).error('topic '.rjust(20) + 'log message') { true }
|
48
|
+
assert logger.error('topic', 'log message')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context "#abort_with" do
|
53
|
+
should "call #error and abort" do
|
54
|
+
logger = Jekyll::LogAdapter.new(LoggerDouble.new)
|
55
|
+
stub(logger).error('topic', 'log message') { true }
|
56
|
+
assert_raise(SystemExit) { logger.abort_with('topic', 'log message') }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
data/test/test_post.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'helper'
|
2
4
|
|
3
5
|
class TestPost < Test::Unit::TestCase
|
@@ -100,6 +102,14 @@ class TestPost < Test::Unit::TestCase
|
|
100
102
|
assert_equal "/2014/03/22/escape-+ %20[]", @post.id
|
101
103
|
end
|
102
104
|
|
105
|
+
should "return a UTF-8 escaped string" do
|
106
|
+
assert_equal Encoding::UTF_8, URL.escape_path("/rails笔记/2014/04/20/escaped/").encoding
|
107
|
+
end
|
108
|
+
|
109
|
+
should "return a UTF-8 unescaped string" do
|
110
|
+
assert_equal Encoding::UTF_8, URL.unescape_path("/rails%E7%AC%94%E8%AE%B0/2014/04/20/escaped/".encode(Encoding::ASCII)).encoding
|
111
|
+
end
|
112
|
+
|
103
113
|
should "respect permalink in yaml front matter" do
|
104
114
|
file = "2008-12-03-permalinked-post.textile"
|
105
115
|
@post.process(file)
|
@@ -450,6 +460,17 @@ class TestPost < Test::Unit::TestCase
|
|
450
460
|
assert_equal Time, post.to_liquid["date"].class
|
451
461
|
end
|
452
462
|
|
463
|
+
should "to_liquid should consider inheritance" do
|
464
|
+
klass = Class.new(Jekyll::Post)
|
465
|
+
assert_gets_called = false
|
466
|
+
klass.send(:define_method, :assert_gets_called) { assert_gets_called = true }
|
467
|
+
klass.const_set(:EXCERPT_ATTRIBUTES_FOR_LIQUID, Jekyll::Post::EXCERPT_ATTRIBUTES_FOR_LIQUID + ['assert_gets_called'])
|
468
|
+
post = klass.new(@site, source_dir, '', "2008-02-02-published.textile")
|
469
|
+
do_render(post)
|
470
|
+
|
471
|
+
assert assert_gets_called, 'assert_gets_called did not get called on post.'
|
472
|
+
end
|
473
|
+
|
453
474
|
should "recognize category in yaml" do
|
454
475
|
post = setup_post("2009-01-27-category.textile")
|
455
476
|
assert post.categories.include?('foo')
|
@@ -646,4 +667,60 @@ class TestPost < Test::Unit::TestCase
|
|
646
667
|
|
647
668
|
end
|
648
669
|
|
670
|
+
context "site config with category" do
|
671
|
+
setup do
|
672
|
+
config = Jekyll::Configuration::DEFAULTS.merge({
|
673
|
+
'defaults' => [
|
674
|
+
'scope' => {
|
675
|
+
'path' => ''
|
676
|
+
},
|
677
|
+
'values' => {
|
678
|
+
'category' => 'article'
|
679
|
+
}
|
680
|
+
]
|
681
|
+
})
|
682
|
+
@site = Site.new(config)
|
683
|
+
end
|
684
|
+
|
685
|
+
should "return category if post does not specify category" do
|
686
|
+
post = setup_post("2009-01-27-no-category.textile")
|
687
|
+
assert post.categories.include?('article'), "Expected post.categories to include 'article' but did not."
|
688
|
+
end
|
689
|
+
|
690
|
+
should "override site category if set on post" do
|
691
|
+
post = setup_post("2009-01-27-category.textile")
|
692
|
+
assert post.categories.include?('foo'), "Expected post.categories to include 'foo' but did not."
|
693
|
+
assert !post.categories.include?('article'), "Did not expect post.categories to include 'article' but it did."
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
697
|
+
context "site config with categories" do
|
698
|
+
setup do
|
699
|
+
config = Jekyll::Configuration::DEFAULTS.merge({
|
700
|
+
'defaults' => [
|
701
|
+
'scope' => {
|
702
|
+
'path' => ''
|
703
|
+
},
|
704
|
+
'values' => {
|
705
|
+
'categories' => ['article']
|
706
|
+
}
|
707
|
+
]
|
708
|
+
})
|
709
|
+
@site = Site.new(config)
|
710
|
+
end
|
711
|
+
|
712
|
+
should "return categories if post does not specify categories" do
|
713
|
+
post = setup_post("2009-01-27-no-category.textile")
|
714
|
+
assert post.categories.include?('article'), "Expected post.categories to include 'article' but did not."
|
715
|
+
end
|
716
|
+
|
717
|
+
should "override site categories if set on post" do
|
718
|
+
post = setup_post("2009-01-27-categories.textile")
|
719
|
+
['foo', 'bar', 'baz'].each do |category|
|
720
|
+
assert post.categories.include?(category), "Expected post.categories to include '#{category}' but did not."
|
721
|
+
end
|
722
|
+
assert !post.categories.include?('article'), "Did not expect post.categories to include 'article' but it did."
|
723
|
+
end
|
724
|
+
end
|
725
|
+
|
649
726
|
end
|
data/test/test_site.rb
CHANGED
@@ -166,6 +166,7 @@ class TestSite < Test::Unit::TestCase
|
|
166
166
|
coffeescript.coffee
|
167
167
|
contacts.html
|
168
168
|
deal.with.dots.html
|
169
|
+
environment.html
|
169
170
|
exploit.md
|
170
171
|
foo.md
|
171
172
|
index.html
|
@@ -378,6 +379,26 @@ class TestSite < Test::Unit::TestCase
|
|
378
379
|
assert_equal site.site_payload['site']['data']['languages'], file_content
|
379
380
|
end
|
380
381
|
|
382
|
+
should 'auto load json files' do
|
383
|
+
site = Site.new(Jekyll.configuration)
|
384
|
+
site.process
|
385
|
+
|
386
|
+
file_content = SafeYAML.load_file(File.join(source_dir, '_data', 'members.json'))
|
387
|
+
|
388
|
+
assert_equal site.data['members'], file_content
|
389
|
+
assert_equal site.site_payload['site']['data']['members'], file_content
|
390
|
+
end
|
391
|
+
|
392
|
+
should 'auto load yaml files in subdirectory' do
|
393
|
+
site = Site.new(Jekyll.configuration)
|
394
|
+
site.process
|
395
|
+
|
396
|
+
file_content = SafeYAML.load_file(File.join(source_dir, '_data', 'categories', 'dairy.yaml'))
|
397
|
+
|
398
|
+
assert_equal site.data['categories']['dairy'], file_content
|
399
|
+
assert_equal site.site_payload['site']['data']['categories']['dairy'], file_content
|
400
|
+
end
|
401
|
+
|
381
402
|
should "load symlink files in unsafe mode" do
|
382
403
|
site = Site.new(Jekyll.configuration.merge({'safe' => false}))
|
383
404
|
site.process
|
@@ -397,5 +418,35 @@ class TestSite < Test::Unit::TestCase
|
|
397
418
|
end
|
398
419
|
|
399
420
|
end
|
421
|
+
|
422
|
+
context "manipulating the Jekyll environment" do
|
423
|
+
setup do
|
424
|
+
@site = Site.new(site_configuration)
|
425
|
+
@site.process
|
426
|
+
@page = @site.pages.find { |p| p.name == "environment.html" }
|
427
|
+
end
|
428
|
+
|
429
|
+
should "default to 'development'" do
|
430
|
+
assert_equal "development", @page.content.strip
|
431
|
+
end
|
432
|
+
|
433
|
+
context "in production" do
|
434
|
+
setup do
|
435
|
+
ENV["JEKYLL_ENV"] = "production"
|
436
|
+
@site = Site.new(site_configuration)
|
437
|
+
@site.process
|
438
|
+
@page = @site.pages.find { |p| p.name == "environment.html" }
|
439
|
+
end
|
440
|
+
|
441
|
+
teardown do
|
442
|
+
ENV.delete("JEKYLL_ENV")
|
443
|
+
end
|
444
|
+
|
445
|
+
should "be overridden by JEKYLL_ENV" do
|
446
|
+
assert_equal "production", @page.content.strip
|
447
|
+
end
|
448
|
+
end
|
449
|
+
end
|
450
|
+
|
400
451
|
end
|
401
452
|
end
|
data/test/test_tags.rb
CHANGED
@@ -75,7 +75,13 @@ CONTENT
|
|
75
75
|
|
76
76
|
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl', ["test", "{% endhighlight %}", "\n"])
|
77
77
|
assert_equal({ :cssclass => 'hl', :linenos => 'table' }, tag.instance_variable_get(:@options))
|
78
|
-
|
78
|
+
|
79
|
+
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl hl_linenos=3', ["test", "{% endhighlight %}", "\n"])
|
80
|
+
assert_equal({ :cssclass => 'hl', :linenos => 'table', :hl_linenos => '3' }, tag.instance_variable_get(:@options))
|
81
|
+
|
82
|
+
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl hl_linenos="3 5 6"', ["test", "{% endhighlight %}", "\n"])
|
83
|
+
assert_equal({ :cssclass => 'hl', :linenos => 'table', :hl_linenos => ['3', '5', '6'] }, tag.instance_variable_get(:@options))
|
84
|
+
|
79
85
|
tag = Jekyll::Tags::HighlightBlock.new('highlight', 'Ruby ', ["test", "{% endhighlight %}", "\n"])
|
80
86
|
assert_equal "ruby", tag.instance_variable_get(:@lang), "lexers should be case insensitive"
|
81
87
|
end
|
@@ -91,11 +97,11 @@ CONTENT
|
|
91
97
|
end
|
92
98
|
|
93
99
|
should "render markdown with pygments" do
|
94
|
-
assert_match %{<pre><code class="text">test</code></pre>}, @result
|
100
|
+
assert_match %{<pre><code class="language-text" data-lang="text">test</code></pre>}, @result
|
95
101
|
end
|
96
102
|
|
97
103
|
should "render markdown with pygments with line numbers" do
|
98
|
-
assert_match %{<pre><code class="text"><span class="lineno">1</span> test</code></pre>}, @result
|
104
|
+
assert_match %{<pre><code class="language-text" data-lang="text"><span class="lineno">1</span> test</code></pre>}, @result
|
99
105
|
end
|
100
106
|
end
|
101
107
|
|
@@ -105,7 +111,7 @@ CONTENT
|
|
105
111
|
end
|
106
112
|
|
107
113
|
should "not embed the file" do
|
108
|
-
assert_match %{<pre><code class="text">./jekyll.gemspec</code></pre>}, @result
|
114
|
+
assert_match %{<pre><code class="language-text" data-lang="text">./jekyll.gemspec</code></pre>}, @result
|
109
115
|
end
|
110
116
|
end
|
111
117
|
|
@@ -115,7 +121,7 @@ CONTENT
|
|
115
121
|
end
|
116
122
|
|
117
123
|
should "render markdown with pygments line handling" do
|
118
|
-
assert_match %{<pre><code class="text">Æ</code></pre>}, @result
|
124
|
+
assert_match %{<pre><code class="language-text" data-lang="text">Æ</code></pre>}, @result
|
119
125
|
end
|
120
126
|
end
|
121
127
|
|
@@ -259,115 +265,6 @@ CONTENT
|
|
259
265
|
end
|
260
266
|
end
|
261
267
|
|
262
|
-
context "gist tag" do
|
263
|
-
context "simple" do
|
264
|
-
setup do
|
265
|
-
@gist = 358471
|
266
|
-
content = <<CONTENT
|
267
|
-
---
|
268
|
-
title: My Cool Gist
|
269
|
-
---
|
270
|
-
|
271
|
-
{% gist #{@gist} %}
|
272
|
-
CONTENT
|
273
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
274
|
-
end
|
275
|
-
|
276
|
-
should "write script tag" do
|
277
|
-
assert_match "<script src=\"https://gist.github.com/#{@gist}.js\">\s</script>", @result
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
context "for private gist" do
|
282
|
-
context "when valid" do
|
283
|
-
setup do
|
284
|
-
@gist = "mattr-/24081a1d93d2898ecf0f"
|
285
|
-
@filename = "myfile.ext"
|
286
|
-
content = <<CONTENT
|
287
|
-
---
|
288
|
-
title: My Cool Gist
|
289
|
-
---
|
290
|
-
|
291
|
-
{% gist #{@gist} #{@filename} %}
|
292
|
-
CONTENT
|
293
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
294
|
-
end
|
295
|
-
|
296
|
-
should "write script tag with specific file in gist" do
|
297
|
-
assert_match "<script src=\"https://gist.github.com/#{@gist}.js?file=#{@filename}\">\s</script>", @result
|
298
|
-
end
|
299
|
-
end
|
300
|
-
|
301
|
-
should "raise ArgumentError when invalid" do
|
302
|
-
@gist = "mattr-24081a1d93d2898ecf0f"
|
303
|
-
@filename = "myfile.ext"
|
304
|
-
content = <<CONTENT
|
305
|
-
---
|
306
|
-
title: My Cool Gist
|
307
|
-
---
|
308
|
-
|
309
|
-
{% gist #{@gist} #{@filename} %}
|
310
|
-
CONTENT
|
311
|
-
|
312
|
-
assert_raise ArgumentError do
|
313
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
314
|
-
end
|
315
|
-
end
|
316
|
-
end
|
317
|
-
|
318
|
-
context "with specific file" do
|
319
|
-
setup do
|
320
|
-
@gist = 358471
|
321
|
-
@filename = 'somefile.rb'
|
322
|
-
content = <<CONTENT
|
323
|
-
---
|
324
|
-
title: My Cool Gist
|
325
|
-
---
|
326
|
-
|
327
|
-
{% gist #{@gist} #{@filename} %}
|
328
|
-
CONTENT
|
329
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
330
|
-
end
|
331
|
-
|
332
|
-
should "write script tag with specific file in gist" do
|
333
|
-
assert_match "<script src=\"https://gist.github.com/#{@gist}.js?file=#{@filename}\">\s</script>", @result
|
334
|
-
end
|
335
|
-
end
|
336
|
-
|
337
|
-
context "with blank gist id" do
|
338
|
-
should "raise ArgumentError" do
|
339
|
-
content = <<CONTENT
|
340
|
-
---
|
341
|
-
title: My Cool Gist
|
342
|
-
---
|
343
|
-
|
344
|
-
{% gist %}
|
345
|
-
CONTENT
|
346
|
-
|
347
|
-
assert_raise ArgumentError do
|
348
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
349
|
-
end
|
350
|
-
end
|
351
|
-
end
|
352
|
-
|
353
|
-
context "with invalid gist id" do
|
354
|
-
should "raise ArgumentError" do
|
355
|
-
invalid_gist = 'invalid'
|
356
|
-
content = <<CONTENT
|
357
|
-
---
|
358
|
-
title: My Cool Gist
|
359
|
-
---
|
360
|
-
|
361
|
-
{% gist #{invalid_gist} %}
|
362
|
-
CONTENT
|
363
|
-
|
364
|
-
assert_raise ArgumentError do
|
365
|
-
create_post(content, {'permalink' => 'pretty', 'source' => source_dir, 'destination' => dest_dir, 'read_posts' => true})
|
366
|
-
end
|
367
|
-
end
|
368
|
-
end
|
369
|
-
end
|
370
|
-
|
371
268
|
context "include tag with parameters" do
|
372
269
|
|
373
270
|
context "with symlink'd include" do
|