nanoc 3.8.0 → 4.0.0a1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +322 -0
- data/NEWS.md +6 -0
- data/bin/nanoc +0 -18
- data/lib/nanoc.rb +5 -3
- data/lib/nanoc/base.rb +24 -6
- data/lib/nanoc/base/checksummer.rb +6 -4
- data/lib/nanoc/base/compilation/checksum_store.rb +4 -4
- data/lib/nanoc/base/compilation/compiled_content_cache.rb +5 -5
- data/lib/nanoc/base/compilation/compiler.rb +60 -65
- data/lib/nanoc/base/compilation/compiler_dsl.rb +11 -9
- data/lib/nanoc/base/compilation/dependency_tracker.rb +24 -38
- data/lib/nanoc/base/compilation/filter.rb +22 -7
- data/lib/nanoc/base/compilation/item_rep_proxy.rb +14 -12
- data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -8
- data/lib/nanoc/base/compilation/outdatedness_checker.rb +32 -32
- data/lib/nanoc/base/compilation/outdatedness_reasons.rb +3 -1
- data/lib/nanoc/base/compilation/rule.rb +9 -7
- data/lib/nanoc/base/compilation/rule_context.rb +15 -15
- data/lib/nanoc/base/compilation/rule_memory_calculator.rb +3 -3
- data/lib/nanoc/base/compilation/rule_memory_store.rb +7 -7
- data/lib/nanoc/base/compilation/rules_collection.rb +28 -30
- data/lib/nanoc/base/context.rb +2 -2
- data/lib/nanoc/base/core_ext/array.rb +17 -25
- data/lib/nanoc/base/core_ext/hash.rb +17 -25
- data/lib/nanoc/base/core_ext/pathname.rb +4 -2
- data/lib/nanoc/base/core_ext/string.rb +5 -3
- data/lib/nanoc/base/directed_graph.rb +4 -9
- data/lib/nanoc/base/error.rb +7 -0
- data/lib/nanoc/base/errors.rb +16 -23
- data/lib/nanoc/base/memoization.rb +4 -2
- data/lib/nanoc/base/notification_center.rb +3 -1
- data/lib/nanoc/base/plugin_registry.rb +14 -21
- data/lib/nanoc/base/result_data/item_rep.rb +43 -88
- data/lib/nanoc/base/source_data/code_snippet.rb +6 -4
- data/lib/nanoc/base/source_data/configuration.rb +3 -1
- data/lib/nanoc/base/source_data/data_source.rb +12 -94
- data/lib/nanoc/base/source_data/identifier.rb +50 -0
- data/lib/nanoc/base/source_data/item.rb +24 -67
- data/lib/nanoc/base/source_data/item_array.rb +6 -4
- data/lib/nanoc/base/source_data/layout.rb +17 -28
- data/lib/nanoc/base/source_data/site.rb +33 -44
- data/lib/nanoc/base/store.rb +3 -5
- data/lib/nanoc/base/temp_filename_factory.rb +3 -2
- data/lib/nanoc/base/views/config.rb +19 -0
- data/lib/nanoc/base/views/item.rb +77 -0
- data/lib/nanoc/base/views/item_collection.rb +43 -0
- data/lib/nanoc/base/views/item_rep.rb +125 -0
- data/lib/nanoc/base/views/layout.rb +42 -0
- data/lib/nanoc/base/views/layout_collection.rb +26 -0
- data/lib/nanoc/base/views/mutable_config.rb +9 -0
- data/lib/nanoc/base/views/mutable_item.rb +9 -0
- data/lib/nanoc/base/views/mutable_item_collection.rb +18 -0
- data/lib/nanoc/base/views/mutable_layout.rb +9 -0
- data/lib/nanoc/base/views/mutable_layout_collection.rb +18 -0
- data/lib/nanoc/base/views/site.rb +35 -0
- data/lib/nanoc/cli.rb +3 -6
- data/lib/nanoc/cli/ansi_string_colorizer.rb +2 -0
- data/lib/nanoc/cli/cleaning_stream.rb +2 -0
- data/lib/nanoc/cli/command_runner.rb +8 -42
- data/lib/nanoc/cli/commands/check.rb +2 -2
- data/lib/nanoc/cli/commands/compile.rb +19 -34
- data/lib/nanoc/cli/commands/create-site.rb +46 -83
- data/lib/nanoc/cli/commands/deploy.rb +4 -4
- data/lib/nanoc/cli/commands/shell.rb +1 -1
- data/lib/nanoc/cli/commands/show-plugins.rb +4 -6
- data/lib/nanoc/cli/error_handler.rb +4 -14
- data/lib/nanoc/cli/logger.rb +2 -0
- data/lib/nanoc/cli/stream_cleaners.rb +1 -0
- data/lib/nanoc/cli/stream_cleaners/abstract.rb +2 -0
- data/lib/nanoc/cli/stream_cleaners/ansi_colors.rb +2 -0
- data/lib/nanoc/cli/stream_cleaners/utf8.rb +2 -0
- data/lib/nanoc/data_sources.rb +1 -17
- data/lib/nanoc/data_sources/filesystem.rb +6 -37
- data/lib/nanoc/data_sources/filesystem_unified.rb +5 -3
- data/lib/nanoc/data_sources/filesystem_verbose.rb +5 -3
- data/lib/nanoc/data_sources/static.rb +4 -2
- data/lib/nanoc/extra.rb +1 -13
- data/lib/nanoc/extra/checking.rb +1 -0
- data/lib/nanoc/extra/checking/check.rb +4 -2
- data/lib/nanoc/extra/checking/checks.rb +1 -0
- data/lib/nanoc/extra/checking/checks/css.rb +1 -0
- data/lib/nanoc/extra/checking/checks/external_links.rb +2 -0
- data/lib/nanoc/extra/checking/checks/html.rb +1 -0
- data/lib/nanoc/extra/checking/checks/internal_links.rb +2 -0
- data/lib/nanoc/extra/checking/checks/mixed_content.rb +2 -0
- data/lib/nanoc/extra/checking/checks/stale.rb +1 -0
- data/lib/nanoc/extra/checking/dsl.rb +1 -0
- data/lib/nanoc/extra/checking/issue.rb +1 -0
- data/lib/nanoc/extra/checking/runner.rb +3 -3
- data/lib/nanoc/extra/core_ext/pathname.rb +5 -3
- data/lib/nanoc/extra/core_ext/time.rb +4 -2
- data/lib/nanoc/extra/deployer.rb +3 -1
- data/lib/nanoc/extra/deployers.rb +1 -0
- data/lib/nanoc/extra/deployers/fog.rb +2 -0
- data/lib/nanoc/extra/deployers/rsync.rb +2 -0
- data/lib/nanoc/extra/filesystem_tools.rb +3 -7
- data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -0
- data/lib/nanoc/extra/link_collector.rb +1 -0
- data/lib/nanoc/extra/piper.rb +2 -1
- data/lib/nanoc/extra/pruner.rb +5 -3
- data/lib/nanoc/filters.rb +1 -2
- data/lib/nanoc/filters/asciidoc.rb +2 -0
- data/lib/nanoc/filters/bluecloth.rb +1 -0
- data/lib/nanoc/filters/coffeescript.rb +2 -0
- data/lib/nanoc/filters/colorize_syntax.rb +1 -12
- data/lib/nanoc/filters/erb.rb +2 -1
- data/lib/nanoc/filters/erubis.rb +2 -1
- data/lib/nanoc/filters/haml.rb +2 -1
- data/lib/nanoc/filters/handlebars.rb +2 -0
- data/lib/nanoc/filters/kramdown.rb +1 -0
- data/lib/nanoc/filters/less.rb +1 -0
- data/lib/nanoc/filters/markaby.rb +1 -0
- data/lib/nanoc/filters/maruku.rb +1 -0
- data/lib/nanoc/filters/mustache.rb +2 -0
- data/lib/nanoc/filters/pandoc.rb +1 -0
- data/lib/nanoc/filters/rainpress.rb +1 -0
- data/lib/nanoc/filters/rdiscount.rb +1 -0
- data/lib/nanoc/filters/rdoc.rb +1 -0
- data/lib/nanoc/filters/redcarpet.rb +2 -0
- data/lib/nanoc/filters/redcloth.rb +1 -0
- data/lib/nanoc/filters/relativize_paths.rb +1 -0
- data/lib/nanoc/filters/rubypants.rb +1 -0
- data/lib/nanoc/filters/sass.rb +1 -0
- data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +2 -0
- data/lib/nanoc/filters/slim.rb +3 -1
- data/lib/nanoc/filters/typogruby.rb +2 -0
- data/lib/nanoc/filters/uglify_js.rb +1 -0
- data/lib/nanoc/filters/xsl.rb +2 -0
- data/lib/nanoc/filters/yui_compressor.rb +2 -0
- data/lib/nanoc/helpers/blogging.rb +30 -30
- data/lib/nanoc/helpers/breadcrumbs.rb +2 -2
- data/lib/nanoc/helpers/capturing.rb +6 -17
- data/lib/nanoc/helpers/filtering.rb +3 -3
- data/lib/nanoc/helpers/link_to.rb +3 -3
- data/lib/nanoc/helpers/rendering.rb +11 -11
- data/lib/nanoc/helpers/xml_sitemap.rb +3 -3
- data/lib/nanoc/tasks.rb +1 -0
- data/lib/nanoc/tasks/clean.rake +1 -1
- data/lib/nanoc/version.rb +1 -1
- data/tasks/doc.rake +2 -1
- data/tasks/test.rake +7 -1
- data/test/base/checksummer_spec.rb +15 -15
- data/test/base/core_ext/array_spec.rb +10 -10
- data/test/base/core_ext/hash_spec.rb +16 -16
- data/test/base/core_ext/pathname_spec.rb +2 -2
- data/test/base/core_ext/string_spec.rb +9 -9
- data/test/base/temp_filename_factory_spec.rb +3 -7
- data/test/base/test_checksum_store.rb +5 -5
- data/test/base/test_code_snippet.rb +3 -3
- data/test/base/test_compiler.rb +29 -29
- data/test/base/test_compiler_dsl.rb +23 -23
- data/test/base/test_context.rb +4 -4
- data/test/base/test_data_source.rb +17 -7
- data/test/base/test_dependency_tracker.rb +29 -29
- data/test/base/test_directed_graph.rb +27 -27
- data/test/base/test_item.rb +23 -21
- data/test/base/test_item_array.rb +18 -18
- data/test/base/test_item_rep.rb +76 -76
- data/test/base/test_item_rep_recorder_proxy.rb +4 -4
- data/test/base/test_layout.rb +8 -16
- data/test/base/test_memoization.rb +4 -4
- data/test/base/test_notification_center.rb +6 -6
- data/test/base/test_outdatedness_checker.rb +18 -18
- data/test/base/test_plugin.rb +1 -1
- data/test/base/test_rule.rb +2 -2
- data/test/base/test_rule_context.rb +5 -5
- data/test/base/test_site.rb +62 -38
- data/test/base/test_store.rb +2 -2
- data/test/cli/commands/test_check.rb +1 -1
- data/test/cli/commands/test_compile.rb +24 -18
- data/test/cli/commands/test_create_site.rb +5 -7
- data/test/cli/commands/test_deploy.rb +1 -1
- data/test/data_sources/test_filesystem.rb +22 -67
- data/test/data_sources/test_filesystem_unified.rb +10 -23
- data/test/data_sources/test_filesystem_verbose.rb +8 -53
- data/test/data_sources/test_static.rb +9 -9
- data/test/extra/checking/checks/test_stale.rb +1 -1
- data/test/extra/core_ext/test_pathname.rb +3 -3
- data/test/extra/core_ext/test_time.rb +4 -4
- data/test/extra/test_filesystem_tools.rb +1 -1
- data/test/filters/test_handlebars.rb +3 -3
- data/test/filters/test_less.rb +6 -6
- data/test/filters/test_mustache.rb +2 -2
- data/test/filters/test_relativize_paths.rb +81 -81
- data/test/filters/test_sass.rb +7 -7
- data/test/filters/test_xsl.rb +6 -6
- data/test/helper.rb +1 -1
- data/test/helpers/test_blogging.rb +78 -99
- data/test/helpers/test_breadcrumbs.rb +12 -12
- data/test/helpers/test_capturing.rb +10 -11
- data/test/helpers/test_filtering.rb +6 -6
- data/test/helpers/test_rendering.rb +3 -3
- data/test/helpers/test_tagging.rb +7 -7
- data/test/helpers/test_xml_sitemap.rb +34 -33
- metadata +19 -43
- data/lib/nanoc/cli/commands/autocompile.rb +0 -69
- data/lib/nanoc/cli/commands/create-item.rb +0 -55
- data/lib/nanoc/cli/commands/create-layout.rb +0 -68
- data/lib/nanoc/cli/commands/sync.rb +0 -32
- data/lib/nanoc/cli/commands/update.rb +0 -63
- data/lib/nanoc/cli/commands/validate-css.rb +0 -20
- data/lib/nanoc/cli/commands/validate-html.rb +0 -20
- data/lib/nanoc/cli/commands/validate-links.rb +0 -27
- data/lib/nanoc/cli/commands/watch.rb +0 -176
- data/lib/nanoc/data_sources/deprecated/delicious.rb +0 -38
- data/lib/nanoc/data_sources/deprecated/last_fm.rb +0 -85
- data/lib/nanoc/data_sources/deprecated/twitter.rb +0 -34
- data/lib/nanoc/extra/auto_compiler.rb +0 -99
- data/lib/nanoc/extra/chick.rb +0 -117
- data/lib/nanoc/extra/file_proxy.rb +0 -36
- data/lib/nanoc/extra/validators.rb +0 -8
- data/lib/nanoc/extra/validators/links.rb +0 -18
- data/lib/nanoc/extra/validators/w3c.rb +0 -23
- data/lib/nanoc/extra/vcs.rb +0 -62
- data/lib/nanoc/extra/vcses.rb +0 -15
- data/lib/nanoc/extra/vcses/bazaar.rb +0 -21
- data/lib/nanoc/extra/vcses/dummy.rb +0 -20
- data/lib/nanoc/extra/vcses/git.rb +0 -21
- data/lib/nanoc/extra/vcses/mercurial.rb +0 -21
- data/lib/nanoc/extra/vcses/subversion.rb +0 -21
- data/lib/nanoc/filters/coderay.rb +0 -19
- data/lib/nanoc3.rb +0 -3
- data/lib/nanoc3/cli.rb +0 -3
- data/lib/nanoc3/tasks.rb +0 -3
- data/test/cli/commands/test_create_item.rb +0 -10
- data/test/cli/commands/test_create_layout.rb +0 -24
- data/test/cli/commands/test_sync.rb +0 -27
- data/test/cli/commands/test_update.rb +0 -6
- data/test/cli/commands/test_watch.rb +0 -74
- data/test/extra/test_auto_compiler.rb +0 -437
- data/test/extra/test_vcs.rb +0 -18
- data/test/extra/validators/test_links.rb +0 -4
- data/test/extra/validators/test_w3c.rb +0 -37
- data/test/filters/test_coderay.rb +0 -40
data/lib/nanoc/base/store.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
module Nanoc
|
3
|
+
module Nanoc::Int
|
4
4
|
# An abstract superclass for classes that need to store data to the
|
5
5
|
# filesystem, such as checksums, cached compiled content and dependency
|
6
6
|
# graphs.
|
@@ -42,7 +42,7 @@ module Nanoc
|
|
42
42
|
#
|
43
43
|
# @abstract This method must be implemented by the subclass.
|
44
44
|
def data
|
45
|
-
raise NotImplementedError.new('Nanoc::Store subclasses must implement #data and #data=')
|
45
|
+
raise NotImplementedError.new('Nanoc::Int::Store subclasses must implement #data and #data=')
|
46
46
|
end
|
47
47
|
|
48
48
|
# @param new_data The data that has been loaded from the disk
|
@@ -51,7 +51,7 @@ module Nanoc
|
|
51
51
|
#
|
52
52
|
# @return [void]
|
53
53
|
def data=(new_data) # rubocop:disable Lint/UnusedMethodArgument
|
54
|
-
raise NotImplementedError.new('Nanoc::Store subclasses must implement #data and #data=')
|
54
|
+
raise NotImplementedError.new('Nanoc::Int::Store subclasses must implement #data and #data=')
|
55
55
|
end
|
56
56
|
|
57
57
|
# Loads the data from the filesystem into memory. This method will set the
|
@@ -91,8 +91,6 @@ module Nanoc
|
|
91
91
|
end
|
92
92
|
|
93
93
|
# Undoes the effects of {#load}. Used when {#load} raises an exception.
|
94
|
-
#
|
95
|
-
# @api private
|
96
94
|
def unload
|
97
95
|
end
|
98
96
|
|
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'tmpdir'
|
4
4
|
|
5
|
-
module Nanoc
|
5
|
+
module Nanoc::Int
|
6
|
+
# @api private
|
6
7
|
class TempFilenameFactory
|
7
8
|
# @return [String] The root directory for all temporary filenames
|
8
9
|
attr_reader :root_dir
|
9
10
|
|
10
|
-
# @return [Nanoc::TempFilenameFactory] A common instance
|
11
|
+
# @return [Nanoc::Int::TempFilenameFactory] A common instance
|
11
12
|
def self.instance
|
12
13
|
@instance ||= new
|
13
14
|
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
class ItemView
|
5
|
+
# @api private
|
6
|
+
def initialize(item)
|
7
|
+
@item = item
|
8
|
+
end
|
9
|
+
|
10
|
+
# @api private
|
11
|
+
def unwrap
|
12
|
+
@item
|
13
|
+
end
|
14
|
+
|
15
|
+
def ==(other)
|
16
|
+
identifier == other.identifier
|
17
|
+
end
|
18
|
+
alias_method :eql?, :==
|
19
|
+
|
20
|
+
def hash
|
21
|
+
self.class.hash ^ identifier.hash
|
22
|
+
end
|
23
|
+
|
24
|
+
def identifier
|
25
|
+
@item.identifier
|
26
|
+
end
|
27
|
+
|
28
|
+
def [](key)
|
29
|
+
@item[key]
|
30
|
+
end
|
31
|
+
|
32
|
+
def compiled_content(params = {})
|
33
|
+
@item.compiled_content(params)
|
34
|
+
end
|
35
|
+
|
36
|
+
def path(params = {})
|
37
|
+
@item.path(params)
|
38
|
+
end
|
39
|
+
|
40
|
+
def children
|
41
|
+
@item.children.map { |i| Nanoc::ItemView.new(i) }
|
42
|
+
end
|
43
|
+
|
44
|
+
def binary?
|
45
|
+
@item.binary?
|
46
|
+
end
|
47
|
+
|
48
|
+
def raw_content
|
49
|
+
@item.raw_content
|
50
|
+
end
|
51
|
+
|
52
|
+
# @api private
|
53
|
+
def reference
|
54
|
+
@item.reference
|
55
|
+
end
|
56
|
+
|
57
|
+
# @api private
|
58
|
+
def reps
|
59
|
+
@item.reps.map { |r| Nanoc::ItemRepView.new(r) }
|
60
|
+
end
|
61
|
+
|
62
|
+
# @api private
|
63
|
+
def raw_filename
|
64
|
+
@item.raw_filename
|
65
|
+
end
|
66
|
+
|
67
|
+
# @api private
|
68
|
+
def forced_outdated?
|
69
|
+
@item.forced_outdated?
|
70
|
+
end
|
71
|
+
|
72
|
+
# @api private
|
73
|
+
def __nanoc_checksum
|
74
|
+
@item.__nanoc_checksum
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
class ItemCollectionView
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
# @api private
|
8
|
+
def initialize(items)
|
9
|
+
@items = items
|
10
|
+
end
|
11
|
+
|
12
|
+
# @api private
|
13
|
+
def unwrap
|
14
|
+
@items
|
15
|
+
end
|
16
|
+
|
17
|
+
# @api private
|
18
|
+
def view_class
|
19
|
+
Nanoc::ItemView
|
20
|
+
end
|
21
|
+
|
22
|
+
def each
|
23
|
+
@items.each { |i| yield view_class.new(i) }
|
24
|
+
end
|
25
|
+
|
26
|
+
def at(arg)
|
27
|
+
item = @items.at(arg)
|
28
|
+
item && view_class.new(item)
|
29
|
+
end
|
30
|
+
|
31
|
+
def [](*args)
|
32
|
+
res = @items[*args]
|
33
|
+
case res
|
34
|
+
when Array
|
35
|
+
res.map { |r| view_class.new(r) }
|
36
|
+
when nil
|
37
|
+
nil
|
38
|
+
else
|
39
|
+
view_class.new(res)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,125 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
class ItemRepView
|
5
|
+
# @api private
|
6
|
+
def initialize(item_rep)
|
7
|
+
@item_rep = item_rep
|
8
|
+
end
|
9
|
+
|
10
|
+
# @api private
|
11
|
+
def unwrap
|
12
|
+
@item_rep
|
13
|
+
end
|
14
|
+
|
15
|
+
def ==(other)
|
16
|
+
item.identifier == other.item.identifier && name == other.name
|
17
|
+
end
|
18
|
+
alias_method :eql?, :==
|
19
|
+
|
20
|
+
def hash
|
21
|
+
self.class.hash ^ item.identifier.hash ^ name.hash
|
22
|
+
end
|
23
|
+
|
24
|
+
def name
|
25
|
+
@item_rep.name
|
26
|
+
end
|
27
|
+
|
28
|
+
def compiled_content(params = {})
|
29
|
+
@item_rep.compiled_content(params)
|
30
|
+
end
|
31
|
+
|
32
|
+
def path(params = {})
|
33
|
+
@item_rep.path(params)
|
34
|
+
end
|
35
|
+
|
36
|
+
def item
|
37
|
+
Nanoc::ItemView.new(@item_rep.item)
|
38
|
+
end
|
39
|
+
|
40
|
+
# @api private
|
41
|
+
def to_recording_proxy
|
42
|
+
@item_rep.to_recording_proxy
|
43
|
+
end
|
44
|
+
|
45
|
+
# @api private
|
46
|
+
def raw_path(params = {})
|
47
|
+
@item_rep.raw_path(params)
|
48
|
+
end
|
49
|
+
|
50
|
+
# @api private
|
51
|
+
def compiled?
|
52
|
+
@item_rep.compiled?
|
53
|
+
end
|
54
|
+
|
55
|
+
# @api private
|
56
|
+
def compiled=(new_compiled)
|
57
|
+
@item_rep.compiled = new_compiled
|
58
|
+
end
|
59
|
+
|
60
|
+
# @api private
|
61
|
+
def forget_progress
|
62
|
+
@item_rep.forget_progress
|
63
|
+
end
|
64
|
+
|
65
|
+
# @api private
|
66
|
+
def assigns
|
67
|
+
@item_rep.assigns
|
68
|
+
end
|
69
|
+
|
70
|
+
# @api private
|
71
|
+
def assigns=(new_assigns)
|
72
|
+
@item_rep.assigns = new_assigns
|
73
|
+
end
|
74
|
+
|
75
|
+
# @api private
|
76
|
+
def type
|
77
|
+
@item_rep.type
|
78
|
+
end
|
79
|
+
|
80
|
+
# @api private
|
81
|
+
def reference
|
82
|
+
@item_rep.reference
|
83
|
+
end
|
84
|
+
|
85
|
+
# @api private
|
86
|
+
def snapshot(snapshot_name, params = {})
|
87
|
+
@item_rep.snapshot(snapshot_name, params)
|
88
|
+
end
|
89
|
+
|
90
|
+
# @api private
|
91
|
+
def filter(filter_name, filter_args = {})
|
92
|
+
@item_rep.filter(filter_name, filter_args)
|
93
|
+
end
|
94
|
+
|
95
|
+
# @api private
|
96
|
+
def layout(layout, filter_name, filter_args)
|
97
|
+
@item_rep.layout(layout, filter_name, filter_args)
|
98
|
+
end
|
99
|
+
|
100
|
+
# @api private
|
101
|
+
def proxy?
|
102
|
+
@item_rep.proxy?
|
103
|
+
end
|
104
|
+
|
105
|
+
# @api private
|
106
|
+
def binary?
|
107
|
+
@item_rep.binary?
|
108
|
+
end
|
109
|
+
|
110
|
+
# @api private
|
111
|
+
def has_snapshot?(snapshot_name)
|
112
|
+
@item_rep.has_snapshot?(snapshot_name)
|
113
|
+
end
|
114
|
+
|
115
|
+
# @api private
|
116
|
+
def content
|
117
|
+
@item_rep.content
|
118
|
+
end
|
119
|
+
|
120
|
+
# @api private
|
121
|
+
def temporary_filenames
|
122
|
+
@item_rep.temporary_filenames
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
class LayoutView
|
5
|
+
# @api private
|
6
|
+
def initialize(layout)
|
7
|
+
@layout = layout
|
8
|
+
end
|
9
|
+
|
10
|
+
# @api private
|
11
|
+
def unwrap
|
12
|
+
@layout
|
13
|
+
end
|
14
|
+
|
15
|
+
def ==(other)
|
16
|
+
identifier == other.identifier
|
17
|
+
end
|
18
|
+
alias_method :eql?, :==
|
19
|
+
|
20
|
+
def hash
|
21
|
+
self.class.hash ^ identifier.hash
|
22
|
+
end
|
23
|
+
|
24
|
+
def identifier
|
25
|
+
@layout.identifier
|
26
|
+
end
|
27
|
+
|
28
|
+
def [](key)
|
29
|
+
@layout[key]
|
30
|
+
end
|
31
|
+
|
32
|
+
# @api private
|
33
|
+
def reference
|
34
|
+
@layout.reference
|
35
|
+
end
|
36
|
+
|
37
|
+
# @api private
|
38
|
+
def raw_content
|
39
|
+
@layout.raw_content
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
class LayoutCollectionView
|
5
|
+
include Enumerable
|
6
|
+
|
7
|
+
# @api private
|
8
|
+
def initialize(layouts)
|
9
|
+
@layouts = layouts
|
10
|
+
end
|
11
|
+
|
12
|
+
# @api private
|
13
|
+
def unwrap
|
14
|
+
@item
|
15
|
+
end
|
16
|
+
|
17
|
+
# @api private
|
18
|
+
def view_class
|
19
|
+
Nanoc::LayoutView
|
20
|
+
end
|
21
|
+
|
22
|
+
def each
|
23
|
+
@layouts.each { |l| yield view_class.new(l) }
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
class MutableItemCollectionView < Nanoc::ItemCollectionView
|
5
|
+
# @api private
|
6
|
+
def view_class
|
7
|
+
Nanoc::MutableItemView
|
8
|
+
end
|
9
|
+
|
10
|
+
def create(content, attributes, identifier, params = {})
|
11
|
+
@items << Nanoc::Int::Item.new(content, attributes, identifier, params)
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete_if(&block)
|
15
|
+
@items.delete_if(&block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Nanoc
|
4
|
+
class MutableLayoutCollectionView < Nanoc::LayoutCollectionView
|
5
|
+
# @api private
|
6
|
+
def view_class
|
7
|
+
Nanoc::MutableLayoutView
|
8
|
+
end
|
9
|
+
|
10
|
+
def create(content, attributes, identifier, params = {})
|
11
|
+
@layouts << Nanoc::Int::Layout.new(content, attributes, identifier, params)
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete_if(&block)
|
15
|
+
@layouts.delete_if(&block)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|