nanoc 4.1.0rc1 → 4.1.0rc2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07f346456d3dba147e7b8d020d0df82c6f3c3311
4
- data.tar.gz: fb0e46393ce90cef93dc8cf1c6348789604489a7
3
+ metadata.gz: 023f1a7d6ab12c07227e7173bc85ad3595b292f2
4
+ data.tar.gz: c6c4d7bdf320ba8fa1c04085b4b2596dcded339d
5
5
  SHA512:
6
- metadata.gz: 28a7d829fdb9573c028611c9b668c487bb47c3d5a9cf75276848b6283f41b8289b23ec59205834ab88ad1e66d5de48821da7e4dfbe4a71762045aa18cbd9b682
7
- data.tar.gz: 47cf5252231f404b94a0ef840975bad6e5e051ee3733a455eb20c7c726bbf9a846c0b17433fe126a49f6df48b610b4644ec9f23f9930969f6cb47ec3959bed84
6
+ metadata.gz: 196b924475b05dc01d2b96f5c21749ac9d8b8034c93a94fa15abd10298c6e5330c2a4eff31fc687869b30be2fcb7fa64874c818a48a4ad51089001a82446125c
7
+ data.tar.gz: 000e3458409b477d50a5c3a7cd08c871f5f651639981cf73dd95aa622505cc0960747f882ac133a873a3278f2fd84b9c15824e4762c827af3c41824520f6ef70
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nanoc (4.1.0rc1)
4
+ nanoc (4.1.0rc2)
5
5
  cri (~> 2.3)
6
6
 
7
7
  GEM
data/NEWS.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.1.0rc2 (2015-12-13)
4
+
5
+ Fixes:
6
+
7
+ * Fixed children of the root item not having a parent (#769, #770)
8
+
9
+ Enhancements:
10
+
11
+ * Made `#path`, `#compiled_content` and `#reps` unavailable during pre-processing, compilation and routing, because they do not make sense in these contexts (#571, #767, #768)
12
+
3
13
  ## 4.1.0rc1 (2015-12-12)
4
14
 
5
15
  Fixes:
@@ -99,7 +99,7 @@ module Nanoc::Int
99
99
 
100
100
  digest.update(',identifier=')
101
101
  update(obj.identifier, digest)
102
- when Nanoc::ItemView, Nanoc::LayoutView, Nanoc::ConfigView, Nanoc::IdentifiableCollectionView
102
+ when Nanoc::ItemWithRepsView, Nanoc::ItemWithoutRepsView, Nanoc::LayoutView, Nanoc::ConfigView, Nanoc::IdentifiableCollectionView
103
103
  update(obj.unwrap, digest)
104
104
  else
105
105
  data = begin
@@ -158,10 +158,10 @@ module Nanoc::Int
158
158
 
159
159
  # TODO: Do not expose @site (necessary for captures store though…)
160
160
  content_or_filename_assigns.merge(
161
- item: Nanoc::ItemView.new(rep.item, view_context),
161
+ item: Nanoc::ItemWithRepsView.new(rep.item, view_context),
162
162
  rep: Nanoc::ItemRepView.new(rep, view_context),
163
163
  item_rep: Nanoc::ItemRepView.new(rep, view_context),
164
- items: Nanoc::ItemCollectionView.new(site.items, view_context),
164
+ items: Nanoc::ItemCollectionWithRepsView.new(site.items, view_context),
165
165
  layouts: Nanoc::LayoutCollectionView.new(site.layouts, view_context),
166
166
  config: Nanoc::ConfigView.new(site.config, view_context),
167
167
  site: Nanoc::SiteView.new(site, view_context),
@@ -184,7 +184,7 @@ module Nanoc
184
184
  # @return [void]
185
185
  def depend_on(items)
186
186
  orig_items = items
187
- items = items.map { |i| i.is_a?(Nanoc::ItemView) ? i.unwrap : i }
187
+ items = items.map { |i| i.is_a?(Nanoc::ItemWithRepsView) ? i.unwrap : i }
188
188
 
189
189
  # Notify
190
190
  items.each do |item|
@@ -0,0 +1,8 @@
1
+ module Nanoc
2
+ class ItemCollectionWithRepsView < ::Nanoc::IdentifiableCollectionView
3
+ # @api private
4
+ def view_class
5
+ Nanoc::ItemWithRepsView
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module Nanoc
2
+ class ItemCollectionWithoutRepsView < ::Nanoc::IdentifiableCollectionView
3
+ # @api private
4
+ def view_class
5
+ Nanoc::ItemWithoutRepsView
6
+ end
7
+ end
8
+ end
@@ -60,9 +60,9 @@ module Nanoc
60
60
 
61
61
  # Returns the item that this item rep belongs to.
62
62
  #
63
- # @return [Nanoc::ItemView]
63
+ # @return [Nanoc::ItemWithRepsView]
64
64
  def item
65
- Nanoc::ItemView.new(@item_rep.item, @context)
65
+ Nanoc::ItemWithRepsView.new(@item_rep.item, @context)
66
66
  end
67
67
 
68
68
  # @api private
@@ -0,0 +1,5 @@
1
+ module Nanoc
2
+ class ItemWithRepsView < ::Nanoc::ItemWithoutRepsView
3
+ include Nanoc::WithRepsViewMixin
4
+ end
5
+ end
@@ -0,0 +1,49 @@
1
+ module Nanoc
2
+ class ItemWithoutRepsView < ::Nanoc::View
3
+ include Nanoc::DocumentViewMixin
4
+
5
+ # Returns the children of this item. For items with identifiers that have
6
+ # extensions, returns an empty collection.
7
+ #
8
+ # @return [Enumerable<Nanoc::ItemWithRepsView>]
9
+ def children
10
+ unless unwrap.identifier.legacy?
11
+ raise Nanoc::Int::Errors::CannotGetParentOrChildrenOfNonLegacyItem.new(unwrap.identifier)
12
+ end
13
+
14
+ children_pattern = Nanoc::Int::Pattern.from(unwrap.identifier.to_s + '*/')
15
+ children = @context.items.select { |i| children_pattern.match?(i.identifier) }
16
+
17
+ children.map { |i| self.class.new(i, @context) }.freeze
18
+ end
19
+
20
+ # Returns the parent of this item, if one exists. For items with identifiers
21
+ # that have extensions, returns nil.
22
+ #
23
+ # @return [Nanoc::ItemWithRepsView] if the item has a parent
24
+ #
25
+ # @return [nil] if the item has no parent
26
+ def parent
27
+ unless unwrap.identifier.legacy?
28
+ raise Nanoc::Int::Errors::CannotGetParentOrChildrenOfNonLegacyItem.new(unwrap.identifier)
29
+ end
30
+
31
+ parent_identifier = '/' + unwrap.identifier.components[0..-2].join('/') + '/'
32
+ parent_identifier = '/' if parent_identifier == '//'
33
+
34
+ parent = @context.items[parent_identifier]
35
+
36
+ parent && self.class.new(parent, @context).freeze
37
+ end
38
+
39
+ # @return [Boolean] True if the item is binary, false otherwise
40
+ def binary?
41
+ unwrap.content.binary?
42
+ end
43
+
44
+ # @api private
45
+ def raw_filename
46
+ unwrap.content.filename
47
+ end
48
+ end
49
+ end
@@ -22,7 +22,7 @@ module Nanoc
22
22
  disallowed_value_classes = Set.new([
23
23
  Nanoc::Int::Item,
24
24
  Nanoc::Int::Layout,
25
- Nanoc::ItemView,
25
+ Nanoc::ItemWithRepsView,
26
26
  Nanoc::LayoutView,
27
27
  ])
28
28
  if disallowed_value_classes.include?(value.class)
@@ -1,7 +1,5 @@
1
1
  module Nanoc
2
- class ItemView < ::Nanoc::View
3
- include Nanoc::DocumentViewMixin
4
-
2
+ module WithRepsViewMixin
5
3
  # Returns the compiled content.
6
4
  #
7
5
  # @param [String] rep The name of the representation
@@ -35,53 +33,11 @@ module Nanoc
35
33
  reps.fetch(rep).path(snapshot: snapshot)
36
34
  end
37
35
 
38
- # Returns the children of this item. For items with identifiers that have
39
- # extensions, returns an empty collection.
40
- #
41
- # @return [Enumerable<Nanoc::ItemView>]
42
- def children
43
- unless unwrap.identifier.legacy?
44
- raise Nanoc::Int::Errors::CannotGetParentOrChildrenOfNonLegacyItem.new(unwrap.identifier)
45
- end
46
-
47
- children_pattern = Nanoc::Int::Pattern.from(unwrap.identifier.to_s + '*/')
48
- children = @context.items.select { |i| children_pattern.match?(i.identifier) }
49
-
50
- children.map { |i| Nanoc::ItemView.new(i, @context) }.freeze
51
- end
52
-
53
- # Returns the parent of this item, if one exists. For items with identifiers
54
- # that have extensions, returns nil.
55
- #
56
- # @return [Nanoc::ItemView] if the item has a parent
57
- #
58
- # @return [nil] if the item has no parent
59
- def parent
60
- unless unwrap.identifier.legacy?
61
- raise Nanoc::Int::Errors::CannotGetParentOrChildrenOfNonLegacyItem.new(unwrap.identifier)
62
- end
63
-
64
- parent_identifier = '/' + unwrap.identifier.components[0..-2].join('/') + '/'
65
- parent = @context.items[parent_identifier]
66
-
67
- parent && Nanoc::ItemView.new(parent, @context).freeze
68
- end
69
-
70
- # @return [Boolean] True if the item is binary, false otherwise
71
- def binary?
72
- unwrap.content.binary?
73
- end
74
-
75
36
  # Returns the representations of this item.
76
37
  #
77
38
  # @return [Nanoc::ItemRepCollectionView]
78
39
  def reps
79
40
  Nanoc::ItemRepCollectionView.new(@context.reps[unwrap], @context)
80
41
  end
81
-
82
- # @api private
83
- def raw_filename
84
- unwrap.content.filename
85
- end
86
42
  end
87
43
  end
@@ -1,5 +1,5 @@
1
1
  module Nanoc
2
- class MutableItemView < Nanoc::ItemView
2
+ class MutableItemView < Nanoc::ItemWithoutRepsView
3
3
  include Nanoc::MutableDocumentViewMixin
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Nanoc
2
- class PostCompileItemView < Nanoc::ItemView
2
+ class PostCompileItemView < Nanoc::ItemWithRepsView
3
3
  def modified
4
4
  reps.select { |rep| rep.unwrap.modified }
5
5
  end
@@ -1,13 +1,16 @@
1
1
  require_relative 'views/mixins/document_view_mixin'
2
2
  require_relative 'views/mixins/mutable_document_view_mixin'
3
+ require_relative 'views/mixins/with_reps_view_mixin'
3
4
 
4
5
  require_relative 'views/view'
5
6
  require_relative 'views/view_context'
6
7
 
7
8
  require_relative 'views/config_view'
8
9
  require_relative 'views/identifiable_collection_view'
9
- require_relative 'views/item_view'
10
- require_relative 'views/item_collection_view'
10
+ require_relative 'views/item_without_reps_view'
11
+ require_relative 'views/item_with_reps_view'
12
+ require_relative 'views/item_collection_with_reps_view'
13
+ require_relative 'views/item_collection_without_reps_view'
11
14
  require_relative 'views/item_rep_view'
12
15
  require_relative 'views/item_rep_collection_view'
13
16
  require_relative 'views/layout_view'
@@ -23,7 +23,7 @@ module Nanoc::CLI::Commands
23
23
 
24
24
  def self.env_for_site(site)
25
25
  {
26
- items: Nanoc::ItemCollectionView.new(site.items, nil),
26
+ items: Nanoc::ItemCollectionWithRepsView.new(site.items, nil),
27
27
  layouts: Nanoc::LayoutCollectionView.new(site.layouts, nil),
28
28
  config: Nanoc::ConfigView.new(site.config, nil),
29
29
  }
@@ -23,7 +23,7 @@ module Nanoc::Extra::Checking
23
23
  view_context = site.compiler.create_view_context
24
24
 
25
25
  context = {
26
- items: Nanoc::ItemCollectionView.new(site.items, view_context),
26
+ items: Nanoc::ItemCollectionWithRepsView.new(site.items, view_context),
27
27
  layouts: Nanoc::LayoutCollectionView.new(site.layouts, view_context),
28
28
  config: Nanoc::ConfigView.new(site.config, view_context),
29
29
  site: Nanoc::SiteView.new(site, view_context), # TODO: remove me
@@ -140,7 +140,7 @@ module Nanoc::Helpers
140
140
  raise ArgumentError, 'expected 2 arguments (the item ' \
141
141
  "and the name of the capture) but got #{args.size} instead"
142
142
  end
143
- item = args[0].is_a?(Nanoc::ItemView) ? args[0].unwrap : args[0]
143
+ item = args[0].is_a?(Nanoc::ItemWithRepsView) ? args[0].unwrap : args[0]
144
144
  name = args[1]
145
145
 
146
146
  # Create dependency
@@ -13,10 +13,10 @@ module Nanoc::RuleDSL
13
13
  @_executor = executor
14
14
 
15
15
  super({
16
- item: Nanoc::ItemView.new(rep.item, view_context),
16
+ item: Nanoc::ItemWithoutRepsView.new(rep.item, view_context),
17
17
  rep: Nanoc::ItemRepView.new(rep, view_context),
18
18
  item_rep: Nanoc::ItemRepView.new(rep, view_context),
19
- items: Nanoc::ItemCollectionView.new(site.items, view_context),
19
+ items: Nanoc::ItemCollectionWithoutRepsView.new(site.items, view_context),
20
20
  layouts: Nanoc::LayoutCollectionView.new(site.layouts, view_context),
21
21
  config: Nanoc::ConfigView.new(site.config, view_context),
22
22
  site: Nanoc::SiteView.new(site, view_context),
data/lib/nanoc/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Nanoc
2
2
  # The current Nanoc version.
3
- VERSION = '4.1.0rc1'
3
+ VERSION = '4.1.0rc2'
4
4
  end
data/tags CHANGED
@@ -146,7 +146,7 @@ MutableConfigView lib/nanoc/base/views/mutable_config_view.rb /^ class MutableC
146
146
  MutableDocumentViewMixin lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb /^ module MutableDocumentViewMixin$/;" m class:Nanoc
147
147
  MutableIdentifiableCollectionView lib/nanoc/base/views/mutable_identifiable_collection_view.rb /^ class MutableIdentifiableCollectionView < Nanoc::IdentifiableCollectionView$/;" c class:Nanoc
148
148
  MutableItemCollectionView lib/nanoc/base/views/mutable_item_collection_view.rb /^ class MutableItemCollectionView < Nanoc::MutableIdentifiableCollectionView$/;" c class:Nanoc
149
- MutableItemView lib/nanoc/base/views/mutable_item_view.rb /^ class MutableItemView < Nanoc::ItemView$/;" c class:Nanoc
149
+ MutableItemView lib/nanoc/base/views/mutable_item_view.rb /^ class MutableItemView < Nanoc::ItemWithRepsView$/;" c class:Nanoc
150
150
  MutableLayoutCollectionView lib/nanoc/base/views/mutable_layout_collection_view.rb /^ class MutableLayoutCollectionView < Nanoc::MutableIdentifiableCollectionView$/;" c class:Nanoc
151
151
  MutableLayoutView lib/nanoc/base/views/mutable_layout_view.rb /^ class MutableLayoutView < Nanoc::LayoutView$/;" c class:Nanoc
152
152
  Nanoc lib/nanoc.rb /^module Nanoc$/;" m
@@ -337,7 +337,7 @@ Piper lib/nanoc/extra/piper.rb /^ class Piper$/;" c class:Nanoc
337
337
  PluginMethods lib/nanoc/base/plugin_registry.rb /^ module PluginMethods$/;" m class:Nanoc.PluginRegistry
338
338
  PluginRegistry lib/nanoc/base/plugin_registry.rb /^ class PluginRegistry$/;" c class:Nanoc
339
339
  PostCompileItemCollectionView lib/nanoc/base/views/post_compile_item_collection_view.rb /^ class PostCompileItemCollectionView < Nanoc::IdentifiableCollectionView$/;" c class:Nanoc
340
- PostCompileItemView lib/nanoc/base/views/post_compile_item_view.rb /^ class PostCompileItemView < Nanoc::ItemView$/;" c class:Nanoc
340
+ PostCompileItemView lib/nanoc/base/views/post_compile_item_view.rb /^ class PostCompileItemView < Nanoc::ItemWithRepsView$/;" c class:Nanoc
341
341
  Prune lib/nanoc/cli/commands/prune.rb /^ class Prune < ::Nanoc::CLI::CommandRunner$/;" c class:Nanoc
342
342
  Pruner lib/nanoc/extra/pruner.rb /^ class Pruner$/;" c class:Nanoc
343
343
  RDiscount lib/nanoc/filters/rdiscount.rb /^ class RDiscount < Nanoc::Filter$/;" c class:Nanoc
@@ -2,7 +2,7 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
2
2
  def test_filter
3
3
  if_have 'less' do
4
4
  # Create item
5
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/'), nil)
5
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/'), nil)
6
6
 
7
7
  # Create filter
8
8
  filter = ::Nanoc::Filters::Less.new(item: @item, items: [@item])
@@ -20,7 +20,7 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
20
20
  File.open('content/foo/bar/imported_file.less', 'w') { |io| io.write('p { color: red; }') }
21
21
 
22
22
  # Create item
23
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/'), nil)
23
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/'), nil)
24
24
 
25
25
  # Create filter
26
26
  filter = ::Nanoc::Filters::Less.new(item: @item, items: [@item])
@@ -39,7 +39,7 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
39
39
 
40
40
  # Create item
41
41
  File.open('content/foo/bar.txt', 'w') { |io| io.write('meh') }
42
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/'), nil)
42
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/'), nil)
43
43
 
44
44
  # Create filter
45
45
  filter = ::Nanoc::Filters::Less.new(item: @item, items: [@item])
@@ -108,7 +108,7 @@ class Nanoc::Filters::LessTest < Nanoc::TestCase
108
108
  def test_compression
109
109
  if_have 'less' do
110
110
  # Create item
111
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/'), nil)
111
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('blah', { content_filename: 'content/foo/bar.txt' }, '/foo/bar/'), nil)
112
112
 
113
113
  # Create filter
114
114
  filter = ::Nanoc::Filters::Less.new(item: @item, items: [@item])
@@ -296,7 +296,7 @@ class Nanoc::Filters::SassTest < Nanoc::TestCase
296
296
  File.open('content/xyzzy.sass', 'w') { |io| io.write('p\n color: green') }
297
297
 
298
298
  items = [
299
- Nanoc::ItemView.new(
299
+ Nanoc::ItemWithRepsView.new(
300
300
  Nanoc::Int::Item.new(
301
301
  'blah',
302
302
  { content_filename: 'content/xyzzy.sass' },
@@ -85,7 +85,7 @@ EOS
85
85
  if_have 'nokogiri' do
86
86
  # Create our data objects
87
87
  item = Nanoc::Int::Item.new(SAMPLE_XML_IN, {}, '/content/')
88
- item = Nanoc::ItemView.new(item, nil)
88
+ item = Nanoc::ItemWithRepsView.new(item, nil)
89
89
  layout = Nanoc::Int::Layout.new(SAMPLE_XSL, {}, '/layout/')
90
90
  layout = Nanoc::LayoutView.new(layout, nil)
91
91
 
@@ -107,7 +107,7 @@ EOS
107
107
  if_have 'nokogiri' do
108
108
  # Create our data objects
109
109
  item = Nanoc::Int::Item.new(SAMPLE_XML_IN_WITH_PARAMS, {}, '/content/')
110
- item = Nanoc::ItemView.new(item, nil)
110
+ item = Nanoc::ItemWithRepsView.new(item, nil)
111
111
  layout = Nanoc::Int::Layout.new(SAMPLE_XSL_WITH_PARAMS, {}, '/layout/')
112
112
  layout = Nanoc::LayoutView.new(layout, nil)
113
113
 
@@ -129,7 +129,7 @@ EOS
129
129
  if_have 'nokogiri' do
130
130
  # Create our data objects
131
131
  item = Nanoc::Int::Item.new(SAMPLE_XML_IN_WITH_OMIT_XML_DECL, {}, '/content/')
132
- item = Nanoc::ItemView.new(item, nil)
132
+ item = Nanoc::ItemWithRepsView.new(item, nil)
133
133
  layout = Nanoc::Int::Layout.new(SAMPLE_XSL_WITH_OMIT_XML_DECL, {}, '/layout/')
134
134
  layout = Nanoc::LayoutView.new(layout, nil)
135
135
 
@@ -18,7 +18,7 @@ class Nanoc::Helpers::CapturingTest < Nanoc::TestCase
18
18
  site = Nanoc::Int::SiteLoader.new.new_empty
19
19
  item = Nanoc::Int::Item.new('moo', {}, '/blah/')
20
20
  @site = Nanoc::SiteView.new(Nanoc::Int::SiteLoader.new.new_empty, nil)
21
- @item = Nanoc::ItemView.new(item, nil)
21
+ @item = Nanoc::ItemWithRepsView.new(item, nil)
22
22
 
23
23
  # Evaluate content
24
24
  result = ::ERB.new(content).result(binding)
@@ -33,7 +33,7 @@ class Nanoc::Helpers::CapturingTest < Nanoc::TestCase
33
33
 
34
34
  # Build site
35
35
  @site = Nanoc::SiteView.new(Nanoc::Int::SiteLoader.new.new_empty, nil)
36
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('moo', {}, '/blah/'), nil)
36
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('moo', {}, '/blah/'), nil)
37
37
 
38
38
  # Capture
39
39
  _erbout = 'foo'
@@ -67,7 +67,7 @@ foot
67
67
  EOS
68
68
 
69
69
  @site = Nanoc::SiteView.new(Nanoc::Int::SiteLoader.new.new_empty, nil)
70
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', {}, '/'), nil)
70
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('content', {}, '/'), nil)
71
71
 
72
72
  result = ::ERB.new(content).result(binding)
73
73
 
@@ -85,7 +85,7 @@ EOS
85
85
  end
86
86
 
87
87
  @site = Nanoc::SiteView.new(Nanoc::Int::SiteLoader.new.new_empty, nil)
88
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', {}, '/'), nil)
88
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('content', {}, '/'), nil)
89
89
  content = '<% content_for :a do %>Content One<% end %>'
90
90
  ::ERB.new(content).result(binding)
91
91
 
@@ -93,7 +93,7 @@ EOS
93
93
  assert_equal nil, content_for(@item, :b)
94
94
 
95
95
  @site = Nanoc::SiteView.new(Nanoc::Int::SiteLoader.new.new_empty, nil)
96
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', {}, '/'), nil)
96
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('content', {}, '/'), nil)
97
97
  content = '<% content_for :b do %>Content Two<% end %>'
98
98
  ::ERB.new(content).result(binding)
99
99
 
@@ -32,7 +32,7 @@ class Nanoc::Helpers::FilteringTest < Nanoc::TestCase
32
32
  item = Nanoc::Int::Item.new('stuff', { title: 'Bar...' }, '/foo.md')
33
33
  item_rep = Nanoc::Int::ItemRep.new(item, :default)
34
34
 
35
- @item = Nanoc::ItemView.new(item, nil)
35
+ @item = Nanoc::ItemWithRepsView.new(item, nil)
36
36
  @item_rep = Nanoc::ItemRepView.new(item_rep, nil)
37
37
 
38
38
  result = ::ERB.new(content).result(binding)
@@ -3,7 +3,7 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
3
3
 
4
4
  def test_tags_for_without_tags
5
5
  # Create item
6
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', {}, '/path/'), nil)
6
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('content', {}, '/path/'), nil)
7
7
 
8
8
  # Check
9
9
  assert_equal(
@@ -14,7 +14,7 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
14
14
 
15
15
  def test_tags_for_with_custom_base_url
16
16
  # Create item
17
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', { tags: %w(foo bar) }, '/path/'), nil)
17
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('content', { tags: %w(foo bar) }, '/path/'), nil)
18
18
 
19
19
  # Check
20
20
  assert_equal(
@@ -26,7 +26,7 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
26
26
 
27
27
  def test_tags_for_with_custom_none_text
28
28
  # Create item
29
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', { tags: [] }, '/path/'), nil)
29
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('content', { tags: [] }, '/path/'), nil)
30
30
 
31
31
  # Check
32
32
  assert_equal(
@@ -37,7 +37,7 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
37
37
 
38
38
  def test_tags_for_with_custom_separator
39
39
  # Create item
40
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', { tags: %w(foo bar) }, '/path/'), nil)
40
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('content', { tags: %w(foo bar) }, '/path/'), nil)
41
41
 
42
42
  # Check
43
43
  assert_equal(
@@ -49,7 +49,7 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
49
49
 
50
50
  def test_tags_for_without_base_url
51
51
  # Create item
52
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('content', { tags: %w(foo bar) }, '/path/'), nil)
52
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('content', { tags: %w(foo bar) }, '/path/'), nil)
53
53
 
54
54
  # Check
55
55
  assert_equal('foo, bar', tags_for(item))
@@ -57,7 +57,7 @@ class Nanoc::Helpers::TaggingTest < Nanoc::TestCase
57
57
 
58
58
  def test_items_with_tag
59
59
  # Create items
60
- @items = Nanoc::ItemCollectionView.new(
60
+ @items = Nanoc::ItemCollectionWithRepsView.new(
61
61
  [
62
62
  Nanoc::Int::Item.new('item 1', { tags: [:foo] }, '/item1/'),
63
63
  Nanoc::Int::Item.new('item 2', { tags: [:bar] }, '/item2/'),
@@ -19,29 +19,29 @@ class Nanoc::Helpers::XMLSitemapTest < Nanoc::TestCase
19
19
  @items = Nanoc::Int::IdentifiableCollection.new({})
20
20
 
21
21
  # Create item 1
22
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one/'), @view_context)
22
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one/'), @view_context)
23
23
  @items << item
24
24
  create_item_rep(item.unwrap, :one_a, '/item-one/a/')
25
25
  create_item_rep(item.unwrap, :one_b, '/item-one/b/')
26
26
 
27
27
  # Create item 2
28
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 2', { is_hidden: true }, '/item-two/'), @view_context)
28
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 2', { is_hidden: true }, '/item-two/'), @view_context)
29
29
  @items << item
30
30
 
31
31
  # Create item 3
32
32
  attrs = { mtime: Time.parse('2004-07-12'), changefreq: 'daily', priority: 0.5 }
33
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 3', attrs, '/item-three/'), @view_context)
33
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 3', attrs, '/item-three/'), @view_context)
34
34
  @items << item
35
35
  create_item_rep(item.unwrap, :three_a, '/item-three/a/')
36
36
  create_item_rep(item.unwrap, :three_b, '/item-three/b/')
37
37
 
38
38
  # Create item 4
39
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 4', {}, '/item-four/'), @view_context)
39
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 4', {}, '/item-four/'), @view_context)
40
40
  @items << item
41
41
  create_item_rep(item.unwrap, :four_a, nil)
42
42
 
43
43
  # Create sitemap item
44
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/'), @view_context)
44
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/'), @view_context)
45
45
 
46
46
  # Create site
47
47
  @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' }, nil)
@@ -79,7 +79,7 @@ class Nanoc::Helpers::XMLSitemapTest < Nanoc::TestCase
79
79
  # Create items
80
80
  @items = Nanoc::Int::IdentifiableCollection.new({})
81
81
  @items << nil
82
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one/'), @view_context)
82
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one/'), @view_context)
83
83
  @items << item
84
84
  create_item_rep(item.unwrap, :one_a, '/item-one/a/')
85
85
  create_item_rep(item.unwrap, :one_b, '/item-one/b/')
@@ -115,13 +115,13 @@ class Nanoc::Helpers::XMLSitemapTest < Nanoc::TestCase
115
115
  if_have 'builder', 'nokogiri' do
116
116
  # Create items
117
117
  @items = Nanoc::Int::IdentifiableCollection.new({})
118
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one/'), @view_context)
118
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/item-one/'), @view_context)
119
119
  @items << item
120
120
  create_item_rep(item.unwrap, :one_a, '/item-one/a/')
121
121
  create_item_rep(item.unwrap, :one_b, '/item-one/b/')
122
122
 
123
123
  # Create sitemap item
124
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/'), @view_context)
124
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/'), @view_context)
125
125
 
126
126
  # Create site
127
127
  @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' }, nil)
@@ -146,21 +146,21 @@ class Nanoc::Helpers::XMLSitemapTest < Nanoc::TestCase
146
146
  if_have 'builder', 'nokogiri' do
147
147
  # Create items
148
148
  @items = Nanoc::Int::IdentifiableCollection.new({})
149
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/george/'), @view_context)
149
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/george/'), @view_context)
150
150
  @items << item
151
151
  create_item_rep(item.unwrap, :a_alice, '/george/alice/')
152
152
  create_item_rep(item.unwrap, :b_zoey, '/george/zoey/')
153
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/walton/'), @view_context)
153
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/walton/'), @view_context)
154
154
  @items << item
155
155
  create_item_rep(item.unwrap, :a_eve, '/walton/eve/')
156
156
  create_item_rep(item.unwrap, :b_bob, '/walton/bob/')
157
- item = Nanoc::ItemView.new(Nanoc::Int::Item.new('some content 1', {}, '/lucas/'), @view_context)
157
+ item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('some content 1', {}, '/lucas/'), @view_context)
158
158
  @items << item
159
159
  create_item_rep(item.unwrap, :a_trudy, '/lucas/trudy/')
160
160
  create_item_rep(item.unwrap, :b_mallory, '/lucas/mallory/')
161
161
 
162
162
  # Create sitemap item
163
- @item = Nanoc::ItemView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/'), @view_context)
163
+ @item = Nanoc::ItemWithRepsView.new(Nanoc::Int::Item.new('sitemap content', {}, '/sitemap/'), @view_context)
164
164
 
165
165
  # Create site
166
166
  @config = Nanoc::ConfigView.new({ base_url: 'http://example.com' }, nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0rc1
4
+ version: 4.1.0rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-12 00:00:00.000000000 Z
11
+ date: 2015-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cri
@@ -131,14 +131,17 @@ files:
131
131
  - lib/nanoc/base/views.rb
132
132
  - lib/nanoc/base/views/config_view.rb
133
133
  - lib/nanoc/base/views/identifiable_collection_view.rb
134
- - lib/nanoc/base/views/item_collection_view.rb
134
+ - lib/nanoc/base/views/item_collection_with_reps_view.rb
135
+ - lib/nanoc/base/views/item_collection_without_reps_view.rb
135
136
  - lib/nanoc/base/views/item_rep_collection_view.rb
136
137
  - lib/nanoc/base/views/item_rep_view.rb
137
- - lib/nanoc/base/views/item_view.rb
138
+ - lib/nanoc/base/views/item_with_reps_view.rb
139
+ - lib/nanoc/base/views/item_without_reps_view.rb
138
140
  - lib/nanoc/base/views/layout_collection_view.rb
139
141
  - lib/nanoc/base/views/layout_view.rb
140
142
  - lib/nanoc/base/views/mixins/document_view_mixin.rb
141
143
  - lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb
144
+ - lib/nanoc/base/views/mixins/with_reps_view_mixin.rb
142
145
  - lib/nanoc/base/views/mutable_config_view.rb
143
146
  - lib/nanoc/base/views/mutable_identifiable_collection_view.rb
144
147
  - lib/nanoc/base/views/mutable_item_collection_view.rb
@@ -1,8 +0,0 @@
1
- module Nanoc
2
- class ItemCollectionView < ::Nanoc::IdentifiableCollectionView
3
- # @api private
4
- def view_class
5
- Nanoc::ItemView
6
- end
7
- end
8
- end