nanoc-core 4.11.12 → 4.11.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nanoc/core.rb +37 -0
  3. data/lib/nanoc/core/basic_item_rep_collection_view.rb +88 -0
  4. data/lib/nanoc/core/basic_item_rep_view.rb +83 -0
  5. data/lib/nanoc/core/basic_item_view.rb +54 -0
  6. data/lib/nanoc/core/changes_stream.rb +55 -0
  7. data/lib/nanoc/core/checksum_store.rb +1 -1
  8. data/lib/nanoc/core/checksummer.rb +4 -2
  9. data/lib/nanoc/core/compilation_item_rep_collection_view.rb +12 -0
  10. data/lib/nanoc/core/compilation_item_rep_view.rb +57 -0
  11. data/lib/nanoc/core/compilation_item_view.rb +47 -0
  12. data/lib/nanoc/core/compilation_phases/abstract.rb +48 -0
  13. data/lib/nanoc/core/compilation_phases/cache.rb +43 -0
  14. data/lib/nanoc/core/compilation_phases/mark_done.rb +23 -0
  15. data/lib/nanoc/core/compilation_phases/notify.rb +19 -0
  16. data/lib/nanoc/core/compilation_phases/recalculate.rb +49 -0
  17. data/lib/nanoc/core/compilation_phases/resume.rb +52 -0
  18. data/lib/nanoc/core/compilation_phases/write.rb +84 -0
  19. data/lib/nanoc/core/compilation_stages/build_reps.rb +36 -0
  20. data/lib/nanoc/core/compilation_stages/calculate_checksums.rb +42 -0
  21. data/lib/nanoc/core/compilation_stages/cleanup.rb +43 -0
  22. data/lib/nanoc/core/compilation_stages/compile_reps.rb +96 -0
  23. data/lib/nanoc/core/compilation_stages/determine_outdatedness.rb +49 -0
  24. data/lib/nanoc/core/compilation_stages/forget_outdated_dependencies.rb +20 -0
  25. data/lib/nanoc/core/compilation_stages/load_stores.rb +35 -0
  26. data/lib/nanoc/core/compilation_stages/postprocess.rb +21 -0
  27. data/lib/nanoc/core/compilation_stages/preprocess.rb +32 -0
  28. data/lib/nanoc/core/compilation_stages/prune.rb +30 -0
  29. data/lib/nanoc/core/compilation_stages/store_post_compilation_state.rb +20 -0
  30. data/lib/nanoc/core/compilation_stages/store_pre_compilation_state.rb +32 -0
  31. data/lib/nanoc/core/compiled_content_cache.rb +2 -2
  32. data/lib/nanoc/core/compiler.rb +214 -0
  33. data/lib/nanoc/core/compiler_loader.rb +48 -0
  34. data/lib/nanoc/core/config_loader.rb +95 -0
  35. data/lib/nanoc/core/config_view.rb +67 -0
  36. data/lib/nanoc/core/configuration.rb +2 -4
  37. data/lib/nanoc/core/contracts_support.rb +20 -0
  38. data/lib/nanoc/core/dependency_store.rb +3 -3
  39. data/lib/nanoc/core/document_view_mixin.rb +87 -0
  40. data/lib/nanoc/core/errors.rb +108 -0
  41. data/lib/nanoc/core/executor.rb +134 -0
  42. data/lib/nanoc/core/feature.rb +92 -0
  43. data/lib/nanoc/core/filter.rb +269 -0
  44. data/lib/nanoc/core/identifiable_collection_view.rb +111 -0
  45. data/lib/nanoc/core/item_collection_with_reps_view.rb +12 -0
  46. data/lib/nanoc/core/item_collection_without_reps_view.rb +12 -0
  47. data/lib/nanoc/core/item_rep_builder.rb +54 -0
  48. data/lib/nanoc/core/item_rep_selector.rb +67 -0
  49. data/lib/nanoc/core/item_rep_writer.rb +85 -0
  50. data/lib/nanoc/core/layout_collection_view.rb +12 -0
  51. data/lib/nanoc/core/layout_view.rb +9 -0
  52. data/lib/nanoc/core/mutable_config_view.rb +16 -0
  53. data/lib/nanoc/core/mutable_document_view_mixin.rb +60 -0
  54. data/lib/nanoc/core/mutable_identifiable_collection_view.rb +19 -0
  55. data/lib/nanoc/core/mutable_item_collection_view.rb +34 -0
  56. data/lib/nanoc/core/mutable_item_view.rb +9 -0
  57. data/lib/nanoc/core/mutable_layout_collection_view.rb +26 -0
  58. data/lib/nanoc/core/mutable_layout_view.rb +9 -0
  59. data/lib/nanoc/core/outdatedness_checker.rb +222 -0
  60. data/lib/nanoc/core/outdatedness_rules/attributes_modified.rb +41 -0
  61. data/lib/nanoc/core/outdatedness_rules/code_snippets_modified.rb +31 -0
  62. data/lib/nanoc/core/outdatedness_rules/content_modified.rb +21 -0
  63. data/lib/nanoc/core/outdatedness_rules/item_collection_extended.rb +20 -0
  64. data/lib/nanoc/core/outdatedness_rules/layout_collection_extended.rb +20 -0
  65. data/lib/nanoc/core/outdatedness_rules/not_written.rb +17 -0
  66. data/lib/nanoc/core/outdatedness_rules/rules_modified.rb +45 -0
  67. data/lib/nanoc/core/outdatedness_rules/uses_always_outdated_filter.rb +26 -0
  68. data/lib/nanoc/core/post_compile_item_collection_view.rb +12 -0
  69. data/lib/nanoc/core/post_compile_item_rep_collection_view.rb +12 -0
  70. data/lib/nanoc/core/post_compile_item_rep_view.rb +33 -0
  71. data/lib/nanoc/core/post_compile_item_view.rb +20 -0
  72. data/lib/nanoc/core/pruner.rb +123 -0
  73. data/lib/nanoc/core/site_loader.rb +102 -0
  74. data/lib/nanoc/core/trivial_error.rb +10 -0
  75. data/lib/nanoc/core/version.rb +1 -1
  76. data/lib/nanoc/core/view.rb +43 -0
  77. data/lib/nanoc/core/view_context_for_compilation.rb +6 -6
  78. metadata +97 -3
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ # @api private
6
+ class CompilerLoader
7
+ def load(site, action_provider: nil)
8
+ action_sequence_store = Nanoc::Core::ActionSequenceStore.new(config: site.config)
9
+
10
+ dependency_store =
11
+ Nanoc::Core::DependencyStore.new(site.items, site.layouts, site.config)
12
+
13
+ objects = site.items.to_a + site.layouts.to_a + site.code_snippets + [site.config]
14
+
15
+ checksum_store =
16
+ Nanoc::Core::ChecksumStore.new(config: site.config, objects: objects)
17
+
18
+ action_provider ||= Nanoc::Core::ActionProvider.named(site.config.action_provider).for(site)
19
+
20
+ outdatedness_store =
21
+ Nanoc::Core::OutdatednessStore.new(config: site.config)
22
+
23
+ compiled_content_cache =
24
+ compiled_content_cache_class.new(config: site.config)
25
+
26
+ params = {
27
+ compiled_content_cache: compiled_content_cache,
28
+ checksum_store: checksum_store,
29
+ action_sequence_store: action_sequence_store,
30
+ dependency_store: dependency_store,
31
+ action_provider: action_provider,
32
+ outdatedness_store: outdatedness_store,
33
+ }
34
+
35
+ Nanoc::Core::Compiler.new(site, **params)
36
+ end
37
+
38
+ def compiled_content_cache_class
39
+ feature_name = Nanoc::Core::Feature::BINARY_COMPILED_CONTENT_CACHE
40
+ if Nanoc::Core::Feature.enabled?(feature_name)
41
+ Nanoc::Core::CompiledContentCache
42
+ else
43
+ Nanoc::Core::TextualCompiledContentCache
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,95 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ # @api private
6
+ class ConfigLoader
7
+ class NoConfigFileFoundError < ::Nanoc::Core::Error
8
+ def initialize
9
+ super('No configuration file found')
10
+ end
11
+ end
12
+
13
+ class NoParentConfigFileFoundError < ::Nanoc::Core::Error
14
+ def initialize(filename)
15
+ super("There is no parent configuration file at #{filename}")
16
+ end
17
+ end
18
+
19
+ class CyclicalConfigFileError < ::Nanoc::Core::Error
20
+ def initialize(filename)
21
+ super("The parent configuration file at #{filename} includes one of its descendants")
22
+ end
23
+ end
24
+
25
+ # @return [Boolean]
26
+ def self.cwd_is_nanoc_site?
27
+ !config_filename_for_cwd.nil?
28
+ end
29
+
30
+ # @return [String]
31
+ def self.config_filename_for_cwd
32
+ filenames =
33
+ if Nanoc::Core::Feature.enabled?(Nanoc::Core::Feature::TOML)
34
+ %w[nanoc.yaml config.yaml nanoc.toml]
35
+ else
36
+ %w[nanoc.yaml config.yaml]
37
+ end
38
+ candidate = filenames.find { |f| File.file?(f) }
39
+ candidate && File.expand_path(candidate)
40
+ end
41
+
42
+ def new_from_cwd
43
+ # Determine path
44
+ filename = self.class.config_filename_for_cwd
45
+ raise NoConfigFileFoundError if filename.nil?
46
+
47
+ # Read
48
+ config =
49
+ apply_parent_config(
50
+ Nanoc::Core::Configuration.new(
51
+ hash: load_file(filename),
52
+ dir: File.dirname(filename),
53
+ ),
54
+ [filename],
55
+ ).with_defaults
56
+
57
+ # Load environment
58
+ config.with_environment
59
+ end
60
+
61
+ def load_file(filename)
62
+ case File.extname(filename)
63
+ when '.yaml'
64
+ YAML.load_file(filename)
65
+ when '.toml'
66
+ Tomlrb.load_file(filename)
67
+ else
68
+ raise Nanoc::Core::Errors::InternalInconsistency, 'Unhandled config file extension'
69
+ end
70
+ end
71
+
72
+ # @api private
73
+ def apply_parent_config(config, processed_paths = [])
74
+ parent_path = config[:parent_config_file]
75
+ return config if parent_path.nil?
76
+
77
+ # Get absolute path
78
+ parent_path = File.absolute_path(parent_path, File.dirname(processed_paths.last))
79
+ unless File.file?(parent_path)
80
+ raise NoParentConfigFileFoundError.new(parent_path)
81
+ end
82
+
83
+ # Check recursion
84
+ if processed_paths.include?(parent_path)
85
+ raise CyclicalConfigFileError.new(parent_path)
86
+ end
87
+
88
+ # Load
89
+ parent_config = Nanoc::Core::Configuration.new(hash: load_file(parent_path), dir: config.dir)
90
+ full_parent_config = apply_parent_config(parent_config, processed_paths + [parent_path])
91
+ full_parent_config.merge(config.without(:parent_config_file))
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ class ConfigView < ::Nanoc::Core::View
6
+ # @api private
7
+ def initialize(config, context)
8
+ super(context)
9
+ @config = config
10
+ end
11
+
12
+ # @api private
13
+ def _unwrap
14
+ @config
15
+ end
16
+
17
+ # @api private
18
+ def output_dir
19
+ @config.output_dir
20
+ end
21
+
22
+ # @see Hash#fetch
23
+ def fetch(key, fallback = Nanoc::Core::UNDEFINED, &_block)
24
+ @context.dependency_tracker.bounce(_unwrap, attributes: [key])
25
+ @config.fetch(key) do
26
+ if !Nanoc::Core::UNDEFINED.equal?(fallback)
27
+ fallback
28
+ elsif block_given?
29
+ yield(key)
30
+ else
31
+ raise KeyError, "key not found: #{key.inspect}"
32
+ end
33
+ end
34
+ end
35
+
36
+ # @see Hash#key?
37
+ def key?(key)
38
+ @context.dependency_tracker.bounce(_unwrap, attributes: [key])
39
+ @config.key?(key)
40
+ end
41
+
42
+ # @see Hash#[]
43
+ def [](key)
44
+ @context.dependency_tracker.bounce(_unwrap, attributes: [key])
45
+ @config[key]
46
+ end
47
+
48
+ # @see Hash#each
49
+ def each(&block)
50
+ @context.dependency_tracker.bounce(_unwrap, attributes: true)
51
+ @config.each(&block)
52
+ end
53
+
54
+ # @see Configuration#env_name
55
+ def env_name
56
+ @context.dependency_tracker.bounce(_unwrap, attributes: true)
57
+ @config.env_name
58
+ end
59
+
60
+ # @see Hash#dig
61
+ def dig(*keys)
62
+ @context.dependency_tracker.bounce(_unwrap, attributes: keys.take(1))
63
+ @config.dig(*keys)
64
+ end
65
+ end
66
+ end
67
+ end
@@ -6,8 +6,6 @@ module Nanoc
6
6
  class Configuration
7
7
  include Nanoc::Core::ContractsSupport
8
8
 
9
- NONE = Object.new.freeze
10
-
11
9
  # The default configuration for a data source. A data source's
12
10
  # configuration overrides these options.
13
11
  DEFAULT_DATA_SOURCE_CONFIG = {
@@ -104,9 +102,9 @@ module Nanoc
104
102
  end
105
103
 
106
104
  contract C::Any, C::Maybe[C::Any], C::Maybe[C::Func[C::None => C::Any]] => C::Any
107
- def fetch(key, fallback = NONE, &_block)
105
+ def fetch(key, fallback = Nanoc::Core::UNDEFINED, &_block)
108
106
  @wrapped.fetch(key) do
109
- if !fallback.equal?(NONE)
107
+ if !Nanoc::Core::UNDEFINED.equal?(fallback)
110
108
  fallback
111
109
  elsif block_given?
112
110
  yield(key)
@@ -103,6 +103,8 @@ module Nanoc
103
103
  ::Contracts.const_set('Named', EnabledContracts::Named)
104
104
  ::Contracts.const_set('IterOf', EnabledContracts::IterOf)
105
105
  ::Contracts.const_set('AbsolutePathString', EnabledContracts::AbsolutePathString)
106
+
107
+ warn_about_performance
106
108
  end
107
109
 
108
110
  @_contracts_support__should_enable
@@ -126,6 +128,24 @@ module Nanoc
126
128
  base.const_set('C', DisabledContracts)
127
129
  end
128
130
  end
131
+
132
+ def self.warn_about_performance
133
+ return if ENV.key?('CI')
134
+ return if ENV.key?('NANOC_DEV_MODE')
135
+
136
+ puts '-' * 78
137
+ puts 'A NOTE ABOUT PERFORMANCE:'
138
+ puts 'The `contracts` gem is loaded, which enables extra run-time checks, but can drastically reduce Nanoc’s performance. The `contracts` gem is intended for development purposes, and is not recommended for day-to-day Nanoc usage.'
139
+ puts
140
+
141
+ if defined?(Bundler)
142
+ puts 'To speed up compilation, remove `contracts` from the Gemfile and run `bundle install`.'
143
+ else
144
+ puts 'To speed up compilation, either uninstall the `contracts` gem, or use Bundler (https://bundler.io/) with a Gemfile that doesn’t include `contracts`.'
145
+ end
146
+
147
+ puts '-' * 78
148
+ end
129
149
  end
130
150
  end
131
151
  end
@@ -113,7 +113,7 @@ module Nanoc
113
113
  src_ref = obj2ref(src)
114
114
  dst_ref = obj2ref(dst)
115
115
 
116
- existing_props = Nanoc::Core::DependencyProps.new(@graph.props_for(dst_ref, src_ref) || {})
116
+ existing_props = Nanoc::Core::DependencyProps.new(**(@graph.props_for(dst_ref, src_ref) || {}))
117
117
  new_props = Nanoc::Core::DependencyProps.new(raw_content: raw_content, attributes: attributes, compiled_content: compiled_content, path: path)
118
118
  props = existing_props.merge(new_props)
119
119
 
@@ -184,8 +184,8 @@ module Nanoc
184
184
  @graph = Nanoc::Core::DirectedGraph.new([nil] + refs)
185
185
 
186
186
  # Load vertices
187
- previous_refs = new_data[:vertices]
188
- previous_objects = Set.new(refs2objs(previous_refs))
187
+ previous_objects = refs2objs(new_data[:vertices])
188
+ previous_refs = objs2refs(previous_objects)
189
189
 
190
190
  # Load edges
191
191
  new_data[:edges].each do |edge|
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Nanoc
4
+ module Core
5
+ module DocumentViewMixin
6
+ # @api private
7
+ def initialize(document, context)
8
+ super(context)
9
+ @document = document
10
+ end
11
+
12
+ # @api private
13
+ def _unwrap
14
+ @document
15
+ end
16
+
17
+ # @see Object#==
18
+ def ==(other)
19
+ other.respond_to?(:identifier) && identifier == other.identifier
20
+ end
21
+
22
+ # @see Object#eql?
23
+ def eql?(other)
24
+ other.is_a?(self.class) && identifier.eql?(other.identifier)
25
+ end
26
+
27
+ # @see Object#hash
28
+ def hash
29
+ self.class.hash ^ identifier.hash
30
+ end
31
+
32
+ # @return [Nanoc::Core::Identifier]
33
+ def identifier
34
+ _unwrap.identifier
35
+ end
36
+
37
+ # @see Hash#[]
38
+ def [](key)
39
+ @context.dependency_tracker.bounce(_unwrap, attributes: [key])
40
+ _unwrap.attributes[key]
41
+ end
42
+
43
+ # @return [Hash]
44
+ def attributes
45
+ # TODO: Refine dependencies
46
+ @context.dependency_tracker.bounce(_unwrap, attributes: true)
47
+ _unwrap.attributes
48
+ end
49
+
50
+ # @see Hash#fetch
51
+ def fetch(key, fallback = Nanoc::Core::UNDEFINED, &_block)
52
+ @context.dependency_tracker.bounce(_unwrap, attributes: [key])
53
+
54
+ if _unwrap.attributes.key?(key)
55
+ _unwrap.attributes[key]
56
+ elsif !Nanoc::Core::UNDEFINED.equal?(fallback)
57
+ fallback
58
+ elsif block_given?
59
+ yield(key)
60
+ else
61
+ raise KeyError, "key not found: #{key.inspect}"
62
+ end
63
+ end
64
+
65
+ # @see Hash#key?
66
+ def key?(key)
67
+ @context.dependency_tracker.bounce(_unwrap, attributes: [key])
68
+ _unwrap.attributes.key?(key)
69
+ end
70
+
71
+ # @api private
72
+ def reference
73
+ _unwrap.reference
74
+ end
75
+
76
+ # @api private
77
+ def raw_content
78
+ @context.dependency_tracker.bounce(_unwrap, raw_content: true)
79
+ _unwrap.content.string
80
+ end
81
+
82
+ def inspect
83
+ "<#{self.class} identifier=#{_unwrap.identifier}>"
84
+ end
85
+ end
86
+ end
87
+ end
@@ -24,6 +24,31 @@ module Nanoc
24
24
  end
25
25
  end
26
26
 
27
+ # Error that is raised when compilation of an item rep fails. The
28
+ # underlying error is available by calling `#unwrap`.
29
+ class CompilationError < ::Nanoc::Core::Error
30
+ attr_reader :item_rep
31
+
32
+ def initialize(wrapped, item_rep)
33
+ @wrapped = wrapped
34
+ @item_rep = item_rep
35
+ end
36
+
37
+ def unwrap
38
+ @wrapped
39
+ end
40
+ end
41
+
42
+ # Error that is raised when a site is loaded that uses a data source with
43
+ # an unknown identifier.
44
+ class UnknownDataSource < ::Nanoc::Core::Error
45
+ # @param [String] data_source_name The data source name for which no
46
+ # data source could be found
47
+ def initialize(data_source_name)
48
+ super("The data source specified in the site’s configuration file, “#{data_source_name}”, does not exist.")
49
+ end
50
+ end
51
+
27
52
  # Error that is raised when an rep cannot be compiled because it depends
28
53
  # on other representations.
29
54
  class UnmetDependency < ::Nanoc::Core::Error
@@ -44,6 +69,36 @@ module Nanoc
44
69
  end
45
70
  end
46
71
 
72
+ # Error that is raised during site compilation when an item (directly or
73
+ # indirectly) includes its own item content, leading to endless recursion.
74
+ class DependencyCycle < ::Nanoc::Core::Error
75
+ def initialize(stack)
76
+ start_idx = stack.index(stack.last)
77
+ cycle = stack[start_idx..-2]
78
+
79
+ msg_bits = []
80
+ msg_bits << 'The site cannot be compiled because there is a dependency cycle:'
81
+ msg_bits << ''
82
+ cycle.each.with_index do |r, i|
83
+ msg_bits << " (#{i + 1}) item #{r.item.identifier}, rep #{r.name.inspect}, uses compiled content of"
84
+ end
85
+ msg_bits << msg_bits.pop + ' (1)'
86
+
87
+ super(msg_bits.map { |x| x + "\n" }.join(''))
88
+ end
89
+ end
90
+
91
+ # Error that is raised during site compilation when a layout is compiled
92
+ # for which the filter cannot be determined. This is similar to the
93
+ # {UnknownFilter} error, but specific for filters for layouts.
94
+ class CannotDetermineFilter < ::Nanoc::Core::Error
95
+ # @param [String] layout_identifier The identifier of the layout for
96
+ # which the filter could not be determined
97
+ def initialize(layout_identifier)
98
+ super("The filter to be used for the “#{layout_identifier}” layout could not be determined. Make sure the layout does have a filter.")
99
+ end
100
+ end
101
+
47
102
  # Error that is raised when the compiled content of a binary item is attempted to be accessed.
48
103
  class CannotGetCompiledContentOfBinaryItem < ::Nanoc::Core::Error
49
104
  # @param [Nanoc::Core::ItemRep] rep The binary item representation whose compiled content was attempted to be accessed
@@ -51,6 +106,59 @@ module Nanoc
51
106
  super("You cannot access the compiled content of a binary item representation (but you can access the path). The offending item rep is #{rep}.")
52
107
  end
53
108
  end
109
+
110
+ # Error that is raised when attempting to call #parent or #children on an item with a legacy identifier.
111
+ class CannotGetParentOrChildrenOfNonLegacyItem < ::Nanoc::Core::Error
112
+ def initialize(identifier)
113
+ super("You cannot get the parent or children of an item that has a “full” identifier (#{identifier}). Getting the parent or children of an item is only possible for items that have a legacy identifier.")
114
+ end
115
+ end
116
+
117
+ # Error that is raised during site compilation when an item uses a layout
118
+ # that is not present in the site.
119
+ class UnknownLayout < ::Nanoc::Core::Error
120
+ # @param [String] layout_identifier The layout identifier for which no
121
+ # layout could be found
122
+ def initialize(layout_identifier)
123
+ super("The site does not have a layout with identifier “#{layout_identifier}”.")
124
+ end
125
+ end
126
+
127
+ # Error that is raised when a binary item is attempted to be laid out.
128
+ class CannotLayoutBinaryItem < ::Nanoc::Core::Error
129
+ # @param [Nanoc::Core::ItemRep] rep The item representation that was attempted
130
+ # to be laid out
131
+ def initialize(rep)
132
+ super("The “#{rep.item.identifier}” item (rep “#{rep.name}”) cannot be laid out because it is a binary item. If you are getting this error for an item that should be textual instead of binary, make sure that its extension is included in the text_extensions array in the site configuration.")
133
+ end
134
+ end
135
+
136
+ # Error that is raised when a textual filter is attempted to be applied to
137
+ # a binary item representation.
138
+ class CannotUseTextualFilter < ::Nanoc::Core::Error
139
+ # @param [Nanoc::Core::ItemRep] rep The item representation that was
140
+ # attempted to be filtered
141
+ #
142
+ # @param [Class] filter_class The filter class that was used
143
+ def initialize(rep, filter_class)
144
+ super("The “#{filter_class.inspect}” filter cannot be used to filter the “#{rep.item.identifier}” item (rep “#{rep.name}”), because textual filters cannot be used on binary items.")
145
+ end
146
+ end
147
+
148
+ # Error that is raised when a binary filter is attempted to be applied to
149
+ # a textual item representation.
150
+ class CannotUseBinaryFilter < ::Nanoc::Core::Error
151
+ # @param [Nanoc::Core::ItemRep] rep The item representation that was
152
+ # attempted to be filtered
153
+ #
154
+ # @param [Class] filter_class The filter class that was used
155
+ def initialize(rep, filter_class)
156
+ super("The “#{filter_class.inspect}” filter cannot be used to filter the “#{rep.item.identifier}” item (rep “#{rep.name}”), because binary filters cannot be used on textual items. If you are getting this error for an item that should be textual instead of binary, make sure that its extension is included in the text_extensions array in the site configuration.")
157
+ end
158
+ end
159
+
160
+ class InternalInconsistency < ::Nanoc::Core::Error
161
+ end
54
162
  end
55
163
  end
56
164
  end