jekyll 2.0.0.alpha.3 → 2.0.0.rc1

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.

Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.markdown +1 -1
  3. data/History.markdown +10 -0
  4. data/features/collections.feature +49 -15
  5. data/features/create_sites.feature +16 -16
  6. data/features/data.feature +4 -4
  7. data/features/drafts.feature +4 -4
  8. data/features/embed_filters.feature +6 -6
  9. data/features/frontmatter_defaults.feature +79 -0
  10. data/features/include_tag.feature +4 -4
  11. data/features/markdown.feature +4 -4
  12. data/features/pagination.feature +3 -3
  13. data/features/permalinks.feature +8 -8
  14. data/features/post_data.feature +18 -18
  15. data/features/post_excerpts.feature +3 -3
  16. data/features/site_configuration.feature +21 -21
  17. data/features/site_data.feature +11 -11
  18. data/features/step_definitions/jekyll_steps.rb +5 -18
  19. data/features/support/env.rb +2 -15
  20. data/lib/jekyll.rb +2 -0
  21. data/lib/jekyll/collection.rb +30 -4
  22. data/lib/jekyll/configuration.rb +2 -1
  23. data/lib/jekyll/convertible.rb +15 -1
  24. data/lib/jekyll/document.rb +11 -7
  25. data/lib/jekyll/filters.rb +1 -1
  26. data/lib/jekyll/frontmatter_defaults.rb +148 -0
  27. data/lib/jekyll/liquid_extensions.rb +22 -0
  28. data/lib/jekyll/page.rb +5 -0
  29. data/lib/jekyll/post.rb +12 -0
  30. data/lib/jekyll/site.rb +42 -27
  31. data/lib/jekyll/version.rb +1 -1
  32. data/script/test +11 -0
  33. data/site/docs/collections.md +78 -5
  34. data/site/docs/configuration.md +49 -0
  35. data/site/docs/frontmatter.md +10 -0
  36. data/site/docs/plugins.md +1 -0
  37. data/site/docs/posts.md +9 -0
  38. data/site/docs/sites.md +2 -2
  39. data/site/docs/templates.md +1 -1
  40. data/test/test_collections.rb +50 -4
  41. data/test/test_filters.rb +4 -0
  42. data/test/test_liquid_extensions.rb +31 -0
  43. data/test/test_utils.rb +1 -0
  44. metadata +9 -2
@@ -209,7 +209,7 @@ root of your source directory. This will embed the contents of
209
209
 
210
210
  The name of the file you wish to embed can be literal (as in the example above),
211
211
  or you can use a variable, using liquid-like variable syntax as in
212
- <code>{% raw %}{% include {{ my_variable }} %}{% endraw %}</code>.
212
+ <code>{% raw %}{% include {{my_variable}} %}{% endraw %}</code>.
213
213
 
214
214
  </p>
215
215
  </div>
@@ -49,6 +49,35 @@ class TestCollections < Test::Unit::TestCase
49
49
  should "know the full path to itself on the filesystem" do
50
50
  assert_equal @collection.directory, source_dir("_methods")
51
51
  end
52
+
53
+ context "when turned into Liquid" do
54
+ should "have a label attribute" do
55
+ assert_equal @collection.to_liquid["label"], "methods"
56
+ end
57
+
58
+ should "have a docs attribute" do
59
+ assert_equal @collection.to_liquid["docs"], Array.new
60
+ end
61
+
62
+ should "have a directory attribute" do
63
+ assert_equal @collection.to_liquid["directory"], source_dir("_methods")
64
+ end
65
+
66
+ should "have a relative_directory attribute" do
67
+ assert_equal @collection.to_liquid["relative_directory"], "_methods"
68
+ end
69
+
70
+ should "have a written attribute" do
71
+ assert_equal @collection.to_liquid["written"], false
72
+ end
73
+ end
74
+
75
+ should "know whether it should be written or not" do
76
+ assert_equal @collection.write?, false
77
+ @collection.metadata['output'] = true
78
+ assert_equal @collection.write?, true
79
+ @collection.metadata.delete 'output'
80
+ end
52
81
  end
53
82
 
54
83
  context "with no collections specified" do
@@ -57,10 +86,8 @@ class TestCollections < Test::Unit::TestCase
57
86
  @site.process
58
87
  end
59
88
 
60
- should "not contain any collections other than the default ones" do
61
- collections = @site.collections.dup
62
- assert collections.delete("data").is_a?(Jekyll::Collection)
63
- assert_equal Hash.new, collections
89
+ should "not contain any collections" do
90
+ assert_equal Hash.new, @site.collections
64
91
  end
65
92
  end
66
93
 
@@ -107,6 +134,25 @@ class TestCollections < Test::Unit::TestCase
107
134
  end
108
135
  end
109
136
 
137
+ context "with a collection with metadata" do
138
+ setup do
139
+ @site = fixture_site({
140
+ "collections" => {
141
+ "methods" => {
142
+ "foo" => "bar",
143
+ "baz" => "whoo"
144
+ }
145
+ }
146
+ })
147
+ @site.process
148
+ @collection = @site.collections["methods"]
149
+ end
150
+
151
+ should "extract the configuration collection information as metadata" do
152
+ assert_equal @collection.metadata, {"foo" => "bar", "baz" => "whoo"}
153
+ end
154
+ end
155
+
110
156
  context "in safe mode" do
111
157
  setup do
112
158
  @site = fixture_site({
@@ -93,6 +93,10 @@ class TestFilters < Test::Unit::TestCase
93
93
  assert_equal "&lt;code&gt;command &amp;lt;filename&amp;gt;&lt;/code&gt;", @filter.xml_escape("<code>command &lt;filename&gt;</code>")
94
94
  end
95
95
 
96
+ should "not error when xml escaping nil" do
97
+ assert_equal "", @filter.xml_escape(nil)
98
+ end
99
+
96
100
  should "escape space as plus" do
97
101
  assert_equal "my+things", @filter.cgi_escape("my things")
98
102
  end
@@ -0,0 +1,31 @@
1
+ require 'helper'
2
+
3
+ class TestLiquidExtensions < Test::Unit::TestCase
4
+
5
+ context "looking up a variable in a Liquid context" do
6
+ class SayHi < Liquid::Tag
7
+ include Jekyll::LiquidExtensions
8
+
9
+ def initialize(tag_name, markup, tokens)
10
+ @markup = markup.strip
11
+ end
12
+
13
+ def render(context)
14
+ "hi #{lookup_variable(context, @markup)}"
15
+ end
16
+ end
17
+ Liquid::Template.register_tag('say_hi', SayHi)
18
+ setup do
19
+ @template = Liquid::Template.parse("{% say_hi page.name %}") # Parses and compiles the template
20
+ end
21
+
22
+ should "extract the var properly" do
23
+ assert_equal @template.render({'page' => {'name' => 'tobi'}}), 'hi tobi'
24
+ end
25
+
26
+ should "return the variable name if the value isn't there" do
27
+ assert_equal @template.render({'page' => {'title' => 'tobi'}}), 'hi page.name'
28
+ end
29
+ end
30
+
31
+ end
@@ -63,4 +63,5 @@ class TestUtils < Test::Unit::TestCase
63
63
  end
64
64
 
65
65
  end
66
+
66
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha.3
4
+ version: 2.0.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Preston-Werner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-15 00:00:00.000000000 Z
11
+ date: 2014-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: liquid
@@ -456,6 +456,7 @@ files:
456
456
  - features/data.feature
457
457
  - features/drafts.feature
458
458
  - features/embed_filters.feature
459
+ - features/frontmatter_defaults.feature
459
460
  - features/include_tag.feature
460
461
  - features/markdown.feature
461
462
  - features/pagination.feature
@@ -493,10 +494,12 @@ files:
493
494
  - lib/jekyll/errors.rb
494
495
  - lib/jekyll/excerpt.rb
495
496
  - lib/jekyll/filters.rb
497
+ - lib/jekyll/frontmatter_defaults.rb
496
498
  - lib/jekyll/generator.rb
497
499
  - lib/jekyll/generators/pagination.rb
498
500
  - lib/jekyll/layout.rb
499
501
  - lib/jekyll/layout_reader.rb
502
+ - lib/jekyll/liquid_extensions.rb
500
503
  - lib/jekyll/mime.types
501
504
  - lib/jekyll/page.rb
502
505
  - lib/jekyll/plugin.rb
@@ -534,6 +537,7 @@ files:
534
537
  - script/cibuild
535
538
  - script/console
536
539
  - script/rebund
540
+ - script/test
537
541
  - site/.gitignore
538
542
  - site/CNAME
539
543
  - site/README
@@ -727,6 +731,7 @@ files:
727
731
  - test/test_generated_site.rb
728
732
  - test/test_kramdown.rb
729
733
  - test/test_layout_reader.rb
734
+ - test/test_liquid_extensions.rb
730
735
  - test/test_new_command.rb
731
736
  - test/test_page.rb
732
737
  - test/test_pager.rb
@@ -772,6 +777,7 @@ test_files:
772
777
  - features/data.feature
773
778
  - features/drafts.feature
774
779
  - features/embed_filters.feature
780
+ - features/frontmatter_defaults.feature
775
781
  - features/include_tag.feature
776
782
  - features/markdown.feature
777
783
  - features/pagination.feature
@@ -885,6 +891,7 @@ test_files:
885
891
  - test/test_generated_site.rb
886
892
  - test/test_kramdown.rb
887
893
  - test/test_layout_reader.rb
894
+ - test/test_liquid_extensions.rb
888
895
  - test/test_new_command.rb
889
896
  - test/test_page.rb
890
897
  - test/test_pager.rb