nanoc 4.1.0rc1 → 4.1.0rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/NEWS.md +10 -0
- data/lib/nanoc/base/checksummer.rb +1 -1
- data/lib/nanoc/base/compilation/compiler.rb +2 -2
- data/lib/nanoc/base/compilation/filter.rb +1 -1
- data/lib/nanoc/base/views/item_collection_with_reps_view.rb +8 -0
- data/lib/nanoc/base/views/item_collection_without_reps_view.rb +8 -0
- data/lib/nanoc/base/views/item_rep_view.rb +2 -2
- data/lib/nanoc/base/views/item_with_reps_view.rb +5 -0
- data/lib/nanoc/base/views/item_without_reps_view.rb +49 -0
- data/lib/nanoc/base/views/mixins/mutable_document_view_mixin.rb +1 -1
- data/lib/nanoc/base/views/{item_view.rb → mixins/with_reps_view_mixin.rb} +1 -45
- data/lib/nanoc/base/views/mutable_item_view.rb +1 -1
- data/lib/nanoc/base/views/post_compile_item_view.rb +1 -1
- data/lib/nanoc/base/views.rb +5 -2
- data/lib/nanoc/cli/commands/shell.rb +1 -1
- data/lib/nanoc/extra/checking/check.rb +1 -1
- data/lib/nanoc/helpers/capturing.rb +1 -1
- data/lib/nanoc/rule_dsl/rule_context.rb +2 -2
- data/lib/nanoc/version.rb +1 -1
- data/tags +2 -2
- data/test/filters/test_less.rb +4 -4
- data/test/filters/test_sass.rb +1 -1
- data/test/filters/test_xsl.rb +3 -3
- data/test/helpers/test_capturing.rb +5 -5
- data/test/helpers/test_filtering.rb +1 -1
- data/test/helpers/test_tagging.rb +6 -6
- data/test/helpers/test_xml_sitemap.rb +12 -12
- metadata +7 -4
- data/lib/nanoc/base/views/item_collection_view.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 023f1a7d6ab12c07227e7173bc85ad3595b292f2
|
4
|
+
data.tar.gz: c6c4d7bdf320ba8fa1c04085b4b2596dcded339d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 196b924475b05dc01d2b96f5c21749ac9d8b8034c93a94fa15abd10298c6e5330c2a4eff31fc687869b30be2fcb7fa64874c818a48a4ad51089001a82446125c
|
7
|
+
data.tar.gz: 000e3458409b477d50a5c3a7cd08c871f5f651639981cf73dd95aa622505cc0960747f882ac133a873a3278f2fd84b9c15824e4762c827af3c41824520f6ef70
|
data/Gemfile.lock
CHANGED
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::
|
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::
|
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::
|
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::
|
187
|
+
items = items.map { |i| i.is_a?(Nanoc::ItemWithRepsView) ? i.unwrap : i }
|
188
188
|
|
189
189
|
# Notify
|
190
190
|
items.each do |item|
|
@@ -60,9 +60,9 @@ module Nanoc
|
|
60
60
|
|
61
61
|
# Returns the item that this item rep belongs to.
|
62
62
|
#
|
63
|
-
# @return [Nanoc::
|
63
|
+
# @return [Nanoc::ItemWithRepsView]
|
64
64
|
def item
|
65
|
-
Nanoc::
|
65
|
+
Nanoc::ItemWithRepsView.new(@item_rep.item, @context)
|
66
66
|
end
|
67
67
|
|
68
68
|
# @api private
|
@@ -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
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module Nanoc
|
2
|
-
|
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
|
data/lib/nanoc/base/views.rb
CHANGED
@@ -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/
|
10
|
-
require_relative 'views/
|
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::
|
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::
|
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::
|
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::
|
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::
|
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
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::
|
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::
|
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
|
data/test/filters/test_less.rb
CHANGED
@@ -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::
|
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::
|
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::
|
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::
|
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])
|
data/test/filters/test_sass.rb
CHANGED
@@ -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::
|
299
|
+
Nanoc::ItemWithRepsView.new(
|
300
300
|
Nanoc::Int::Item.new(
|
301
301
|
'blah',
|
302
302
|
{ content_filename: 'content/xyzzy.sass' },
|
data/test/filters/test_xsl.rb
CHANGED
@@ -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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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::
|
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.
|
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-
|
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/
|
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/
|
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
|