nanoc 4.14.6 → 4.14.7
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/NEWS.md +8 -0
- data/bin/nanoc +2 -1
- data/lib/nanoc/data_sources/filesystem/errors.rb +5 -1
- data/lib/nanoc/data_sources/filesystem/tools.rb +8 -2
- data/lib/nanoc/data_sources/filesystem.rb +11 -5
- data/lib/nanoc/filters/less.rb +1 -1
- data/lib/nanoc/filters/relativize_paths.rb +4 -6
- data/lib/nanoc/filters/sass/importer.rb +2 -2
- data/lib/nanoc/filters/sass.rb +1 -1
- data/lib/nanoc/helpers/blogging.rb +2 -2
- data/lib/nanoc/helpers/breadcrumbs.rb +5 -7
- data/lib/nanoc/helpers/capturing.rb +20 -8
- data/lib/nanoc/helpers/child_parent.rb +2 -2
- data/lib/nanoc/helpers/html_escape.rb +5 -2
- data/lib/nanoc/helpers/link_to.rb +13 -5
- data/lib/nanoc/helpers/xml_sitemap.rb +2 -1
- data/lib/nanoc/orig_cli/commands/show-rules.rb +2 -2
- data/lib/nanoc/rule_dsl/action_provider.rb +2 -0
- data/lib/nanoc/rule_dsl/action_sequence_calculator.rb +6 -2
- data/lib/nanoc/rule_dsl/compilation_rule_context.rb +1 -1
- data/lib/nanoc/rule_dsl/compiler_dsl.rb +9 -5
- data/lib/nanoc/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fb3e276213934470b9ec1e292ded4b5c769744a1c5b084861fba868fc4c87415
|
|
4
|
+
data.tar.gz: 8d594094a161c616dc7597bd55cef9bf8d26d14297e1c5c625b3d277e1157c1c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 528e5bfbda05a620de28cdf2b68990e3035491cadf8f68b6409f16a162de0c4347736eaef72f1879bf0117cfe8209da8617884f610b9be350c19c0c71cf52ff4
|
|
7
|
+
data.tar.gz: 6f2c34a506e7998338119c7e1272a42990affce644fe8485c09b6ecfe4bd314088a409938ff870dacd3cf4591d0b5ef47d1872bd647a065637aa1a26c9d8930c
|
data/NEWS.md
CHANGED
data/bin/nanoc
CHANGED
|
@@ -5,7 +5,8 @@ require 'nanoc'
|
|
|
5
5
|
require 'nanoc/orig_cli'
|
|
6
6
|
|
|
7
7
|
if File.file?('Gemfile') && !defined?(Bundler)
|
|
8
|
-
warn 'A Gemfile was detected, but Bundler is not loaded. This is probably
|
|
8
|
+
warn 'A Gemfile was detected, but Bundler is not loaded. This is probably ' \
|
|
9
|
+
'not what you want. To run Nanoc with Bundler, use `bundle exec nanoc`.'
|
|
9
10
|
end
|
|
10
11
|
|
|
11
12
|
Nanoc::CLI.run(ARGV)
|
|
@@ -26,7 +26,11 @@ class Nanoc::DataSources::Filesystem < Nanoc::DataSource
|
|
|
26
26
|
|
|
27
27
|
class InvalidFormat < Generic
|
|
28
28
|
def initialize(content_filename)
|
|
29
|
-
super(
|
|
29
|
+
super(
|
|
30
|
+
"The file '#{content_filename}' appears to start with a metadata " \
|
|
31
|
+
'section (three or five dashes at the top) but it does not seem ' \
|
|
32
|
+
'to be in the correct format.'
|
|
33
|
+
)
|
|
30
34
|
end
|
|
31
35
|
end
|
|
32
36
|
|
|
@@ -15,7 +15,10 @@ class Nanoc::DataSources::Filesystem < Nanoc::DataSource
|
|
|
15
15
|
# resolved before giving up
|
|
16
16
|
def initialize(filename)
|
|
17
17
|
@filename = filename
|
|
18
|
-
super(
|
|
18
|
+
super(
|
|
19
|
+
'Too many indirections while resolving symlinks. I gave up after ' \
|
|
20
|
+
"finding out #{filename} was yet another symlink. Sorry!",
|
|
21
|
+
)
|
|
19
22
|
end
|
|
20
23
|
end
|
|
21
24
|
|
|
@@ -29,7 +32,10 @@ class Nanoc::DataSources::Filesystem < Nanoc::DataSource
|
|
|
29
32
|
# supported
|
|
30
33
|
def initialize(filename)
|
|
31
34
|
@filename = filename
|
|
32
|
-
super(
|
|
35
|
+
super(
|
|
36
|
+
"The file at #{filename} is of an unsupported type (expected file, " \
|
|
37
|
+
"directory or link, but it is #{File.ftype(filename)}",
|
|
38
|
+
)
|
|
33
39
|
end
|
|
34
40
|
end
|
|
35
41
|
|
|
@@ -50,7 +50,10 @@ module Nanoc::DataSources
|
|
|
50
50
|
class Filesystem < Nanoc::DataSource
|
|
51
51
|
class AmbiguousMetadataAssociationError < ::Nanoc::Core::Error
|
|
52
52
|
def initialize(content_filenames, meta_filename)
|
|
53
|
-
super(
|
|
53
|
+
super(
|
|
54
|
+
"There are multiple content files (#{content_filenames.sort.join(', ')}) " \
|
|
55
|
+
"that could match the file containing metadata (#{meta_filename}).",
|
|
56
|
+
)
|
|
54
57
|
end
|
|
55
58
|
end
|
|
56
59
|
|
|
@@ -118,7 +121,11 @@ module Nanoc::DataSources
|
|
|
118
121
|
attr_reader :is_binary
|
|
119
122
|
alias binary? is_binary
|
|
120
123
|
|
|
121
|
-
def initialize(
|
|
124
|
+
def initialize(
|
|
125
|
+
is_binary:, attributes:, content: nil, filename: nil,
|
|
126
|
+
content_checksum_data: nil,
|
|
127
|
+
attributes_checksum_data: nil
|
|
128
|
+
)
|
|
122
129
|
if content.nil? && filename.nil?
|
|
123
130
|
raise ArgumentError, '#initialize needs at least content or filename'
|
|
124
131
|
end
|
|
@@ -309,8 +316,7 @@ module Nanoc::DataSources
|
|
|
309
316
|
|
|
310
317
|
by_basename.each_pair do |basename, filenames|
|
|
311
318
|
# Divide
|
|
312
|
-
meta_filenames
|
|
313
|
-
content_filenames = filenames.reject { |fn| ext_of(fn) == '.yaml' }
|
|
319
|
+
meta_filenames, content_filenames = filenames.partition { |fn| ext_of(fn) == '.yaml' }
|
|
314
320
|
|
|
315
321
|
# Check number of files per type
|
|
316
322
|
unless [0, 1].include?(meta_filenames.size)
|
|
@@ -352,7 +358,7 @@ module Nanoc::DataSources
|
|
|
352
358
|
elsif ext.empty?
|
|
353
359
|
base_filename
|
|
354
360
|
else
|
|
355
|
-
base_filename
|
|
361
|
+
"#{base_filename}.#{ext}"
|
|
356
362
|
end
|
|
357
363
|
end
|
|
358
364
|
|
data/lib/nanoc/filters/less.rb
CHANGED
|
@@ -30,7 +30,7 @@ module Nanoc::Filters
|
|
|
30
30
|
imports.concat(content.scan(/^@import\s+(["'])([^\1]+?)\1;/))
|
|
31
31
|
imports.concat(content.scan(/^@import\s+url\((["']?)([^)]+?)\1\);/))
|
|
32
32
|
|
|
33
|
-
imports.map { |i| /\.(less|css)$/.match?(i[1]) ? i[1] : i[1]
|
|
33
|
+
imports.map { |i| /\.(less|css)$/.match?(i[1]) ? i[1] : "#{i[1]}.less" }
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def imported_filenames_to_items(imported_filenames)
|
|
@@ -72,7 +72,7 @@ module Nanoc::Filters
|
|
|
72
72
|
if exclude?(path, params)
|
|
73
73
|
Regexp.last_match[0]
|
|
74
74
|
else
|
|
75
|
-
|
|
75
|
+
"url(#{quote}#{relative_path_to(path)}#{quote})"
|
|
76
76
|
end
|
|
77
77
|
end
|
|
78
78
|
end
|
|
@@ -115,10 +115,7 @@ module Nanoc::Filters
|
|
|
115
115
|
when :html5
|
|
116
116
|
require 'nokogiri'
|
|
117
117
|
::Nokogiri::HTML5
|
|
118
|
-
when :xml
|
|
119
|
-
require 'nokogiri'
|
|
120
|
-
::Nokogiri::XML
|
|
121
|
-
when :xhtml
|
|
118
|
+
when :xml, :xhtml
|
|
122
119
|
require 'nokogiri'
|
|
123
120
|
::Nokogiri::XML
|
|
124
121
|
end
|
|
@@ -211,7 +208,8 @@ module Nanoc::Filters
|
|
|
211
208
|
when :srcset
|
|
212
209
|
handle_srcset_node(node)
|
|
213
210
|
else
|
|
214
|
-
raise Nanoc::Core::Errors::InternalInconsistency,
|
|
211
|
+
raise Nanoc::Core::Errors::InternalInconsistency,
|
|
212
|
+
"Unsupported selector type #{selector_type.inspect} in #{self.class}"
|
|
215
213
|
end
|
|
216
214
|
end
|
|
217
215
|
|
|
@@ -45,7 +45,7 @@ module Nanoc::Filters::SassCommon
|
|
|
45
45
|
end
|
|
46
46
|
|
|
47
47
|
def key(identifier, _options)
|
|
48
|
-
[self.class.name
|
|
48
|
+
["#{self.class.name}:#{root}", identifier.to_s]
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
def public_url(identifier, _sourcemap_directory)
|
|
@@ -64,7 +64,7 @@ module Nanoc::Filters::SassCommon
|
|
|
64
64
|
|
|
65
65
|
def self.raw_filename_to_item_map_for_config(config, items)
|
|
66
66
|
@raw_filename_to_item_map ||= {}
|
|
67
|
-
@raw_filename_to_item_map[config
|
|
67
|
+
@raw_filename_to_item_map[[config, items]] ||=
|
|
68
68
|
{}.tap do |map|
|
|
69
69
|
items.each do |item|
|
|
70
70
|
filename_without_registering_dependency = item._unwrap.content.filename
|
data/lib/nanoc/filters/sass.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
module Nanoc::Filters
|
|
4
4
|
module SassCommon
|
|
5
|
-
REQUIRES =
|
|
5
|
+
REQUIRES = ['sass', 'nanoc/filters/sass/importer', 'nanoc/filters/sass/functions'].freeze
|
|
6
6
|
|
|
7
7
|
def css(filter, rep, content, params)
|
|
8
8
|
css, = render(filter, rep, content, params)
|
|
@@ -110,7 +110,7 @@ module Nanoc::Helpers
|
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
def build_for_feed(xml)
|
|
113
|
-
root_url = @config[:base_url]
|
|
113
|
+
root_url = "#{@config[:base_url]}/"
|
|
114
114
|
xml.instruct!
|
|
115
115
|
xml.feed(xmlns: 'http://www.w3.org/2005/Atom', 'xml:base' => root_url) do
|
|
116
116
|
# Add primary attributes
|
|
@@ -250,7 +250,7 @@ module Nanoc::Helpers
|
|
|
250
250
|
|
|
251
251
|
formatted_date = attribute_to_time(item[:created_at]).__nanoc_to_iso8601_date
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
"tag:#{hostname},#{formatted_date}:#{base_dir}#{item.path || item.identifier.to_s}"
|
|
254
254
|
end
|
|
255
255
|
|
|
256
256
|
# @param [String, Time, Date, DateTime] arg
|
|
@@ -5,13 +5,11 @@ module Nanoc::Helpers
|
|
|
5
5
|
module Breadcrumbs
|
|
6
6
|
class AmbiguousAncestorError < ::Nanoc::Core::Error
|
|
7
7
|
def initialize(pattern, items)
|
|
8
|
+
super("expected only one item to match #{pattern}, but found #{items.size}")
|
|
9
|
+
|
|
8
10
|
@pattern = pattern
|
|
9
11
|
@items = items
|
|
10
12
|
end
|
|
11
|
-
|
|
12
|
-
def message
|
|
13
|
-
"expected only one item to match #{@pattern}, but found #{@items.size}"
|
|
14
|
-
end
|
|
15
13
|
end
|
|
16
14
|
|
|
17
15
|
# @api private
|
|
@@ -53,7 +51,7 @@ module Nanoc::Helpers
|
|
|
53
51
|
new_prefix == old_prefix ? nil : new_prefix
|
|
54
52
|
end
|
|
55
53
|
|
|
56
|
-
prefixes.map { |pr| pr
|
|
54
|
+
prefixes.map { |pr| "#{pr}.*" }
|
|
57
55
|
end
|
|
58
56
|
|
|
59
57
|
def self.find_one(items, pat, tiebreaker)
|
|
@@ -105,12 +103,12 @@ module Nanoc::Helpers
|
|
|
105
103
|
|
|
106
104
|
# e.g. ['', '/foo', '/foo/bar']
|
|
107
105
|
components = item.identifier.components
|
|
108
|
-
prefixes = components.inject(['']) { |acc, elem| acc + [acc.last
|
|
106
|
+
prefixes = components.inject(['']) { |acc, elem| acc + ["#{acc.last}/#{elem}"] }
|
|
109
107
|
|
|
110
108
|
tiebreaker = Int::ERROR_TIEBREAKER if tiebreaker == :error
|
|
111
109
|
|
|
112
110
|
if @item.identifier.legacy?
|
|
113
|
-
prefixes.map { |pr| @items[Nanoc::Core::Identifier.new(
|
|
111
|
+
prefixes.map { |pr| @items[Nanoc::Core::Identifier.new("/#{pr}", type: :legacy)] }
|
|
114
112
|
else
|
|
115
113
|
ancestral_prefixes = prefixes.grep_v(%r{^/index\.})[0..-2]
|
|
116
114
|
ancestral_items =
|
|
@@ -39,8 +39,11 @@ module Nanoc::Helpers
|
|
|
39
39
|
''
|
|
40
40
|
end
|
|
41
41
|
else
|
|
42
|
-
raise
|
|
43
|
-
|
|
42
|
+
raise(
|
|
43
|
+
ArgumentError,
|
|
44
|
+
'expected :existing_behavior param to #content_for to be one of ' \
|
|
45
|
+
":overwrite, :append, or :error, but #{existing_behavior.inspect} was given",
|
|
46
|
+
)
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
# Store
|
|
@@ -118,8 +121,11 @@ module Nanoc::Helpers
|
|
|
118
121
|
when 2
|
|
119
122
|
args[1]
|
|
120
123
|
else
|
|
121
|
-
raise
|
|
122
|
-
|
|
124
|
+
raise(
|
|
125
|
+
ArgumentError,
|
|
126
|
+
'expected 1 or 2 argument (the name ' \
|
|
127
|
+
"of the capture, and optionally params) but got #{args.size} instead",
|
|
128
|
+
)
|
|
123
129
|
end
|
|
124
130
|
|
|
125
131
|
SetContent.new(name, params, @item).run(&)
|
|
@@ -133,16 +139,22 @@ module Nanoc::Helpers
|
|
|
133
139
|
when 3
|
|
134
140
|
args[1]
|
|
135
141
|
else
|
|
136
|
-
raise
|
|
137
|
-
|
|
142
|
+
raise(
|
|
143
|
+
ArgumentError,
|
|
144
|
+
'expected 2 or 3 arguments (the name ' \
|
|
145
|
+
"of the capture, optionally params, and the content) but got #{args.size} instead",
|
|
146
|
+
)
|
|
138
147
|
end
|
|
139
148
|
|
|
140
149
|
_erbout = +'' # rubocop:disable Lint/UnderscorePrefixedVariableName
|
|
141
150
|
SetContent.new(name, params, @item).run { _erbout << content }
|
|
142
151
|
else # Get content
|
|
143
152
|
if args.size != 2
|
|
144
|
-
raise
|
|
145
|
-
|
|
153
|
+
raise(
|
|
154
|
+
ArgumentError,
|
|
155
|
+
'expected 2 arguments (the item ' \
|
|
156
|
+
"and the name of the capture) but got #{args.size} instead",
|
|
157
|
+
)
|
|
146
158
|
end
|
|
147
159
|
requested_item = args[0]
|
|
148
160
|
name = args[1]
|
|
@@ -8,7 +8,7 @@ module Nanoc::Helpers
|
|
|
8
8
|
item.parent
|
|
9
9
|
else
|
|
10
10
|
path_without_last_component = item.identifier.to_s.sub(%r{[^/]+$}, '').chop
|
|
11
|
-
@items[path_without_last_component
|
|
11
|
+
@items["#{path_without_last_component}.*"]
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ module Nanoc::Helpers
|
|
|
16
16
|
if item.identifier.legacy?
|
|
17
17
|
item.children
|
|
18
18
|
else
|
|
19
|
-
pattern = item.identifier.without_ext
|
|
19
|
+
pattern = "#{item.identifier.without_ext}/*"
|
|
20
20
|
@items.find_all(pattern)
|
|
21
21
|
end
|
|
22
22
|
end
|
|
@@ -20,8 +20,11 @@ module Nanoc::Helpers
|
|
|
20
20
|
buffer << escaped_data
|
|
21
21
|
elsif string
|
|
22
22
|
unless string.is_a? String
|
|
23
|
-
raise
|
|
24
|
-
|
|
23
|
+
raise(
|
|
24
|
+
ArgumentError,
|
|
25
|
+
'The #html_escape or #h function needs either a ' \
|
|
26
|
+
"string or a block to HTML-escape, but #{string.class} was given",
|
|
27
|
+
)
|
|
25
28
|
end
|
|
26
29
|
|
|
27
30
|
string
|
|
@@ -18,16 +18,21 @@ module Nanoc::Helpers
|
|
|
18
18
|
when String
|
|
19
19
|
target
|
|
20
20
|
when Nanoc::Core::CompilationItemView, Nanoc::Core::BasicItemView, Nanoc::Core::BasicItemRepView
|
|
21
|
-
|
|
21
|
+
if target.path.nil?
|
|
22
|
+
raise "Cannot create a link to #{target.inspect} because this " \
|
|
23
|
+
'target is not outputted (its routing rule returns nil)'
|
|
24
|
+
end
|
|
22
25
|
|
|
23
26
|
target.path
|
|
24
27
|
else
|
|
25
|
-
raise ArgumentError,
|
|
28
|
+
raise ArgumentError,
|
|
29
|
+
"Cannot link to #{target.inspect} (expected a string or an " \
|
|
30
|
+
"item, not a #{target.class.name})"
|
|
26
31
|
end
|
|
27
32
|
|
|
28
33
|
# Join attributes
|
|
29
34
|
attributes = attributes.reduce('') do |memo, (key, value)|
|
|
30
|
-
memo
|
|
35
|
+
"#{memo}#{key}=\"#{h(value)}\" "
|
|
31
36
|
end
|
|
32
37
|
|
|
33
38
|
# Create link
|
|
@@ -60,7 +65,8 @@ module Nanoc::Helpers
|
|
|
60
65
|
path = target.path
|
|
61
66
|
if path.nil?
|
|
62
67
|
# TODO: get proper error
|
|
63
|
-
raise "Cannot get the relative path to #{target.inspect} because
|
|
68
|
+
raise "Cannot get the relative path to #{target.inspect} because " \
|
|
69
|
+
'this target is not outputted (its routing rule returns nil)'
|
|
64
70
|
end
|
|
65
71
|
end
|
|
66
72
|
|
|
@@ -73,7 +79,9 @@ module Nanoc::Helpers
|
|
|
73
79
|
dst_path = Pathname.new(path)
|
|
74
80
|
if @item_rep.path.nil?
|
|
75
81
|
# TODO: get proper error
|
|
76
|
-
raise "Cannot get the relative path to #{path} because the current
|
|
82
|
+
raise "Cannot get the relative path to #{path} because the current " \
|
|
83
|
+
"item representation, #{@item_rep.inspect}, is not outputted " \
|
|
84
|
+
'(its routing rule returns nil)'
|
|
77
85
|
end
|
|
78
86
|
|
|
79
87
|
src_path = Pathname.new(@item_rep.path)
|
|
@@ -20,7 +20,8 @@ module Nanoc::Helpers
|
|
|
20
20
|
|
|
21
21
|
# Check for required attributes
|
|
22
22
|
if @config[:base_url].nil?
|
|
23
|
-
raise 'The Nanoc::Helpers::XMLSitemap helper requires the site
|
|
23
|
+
raise 'The Nanoc::Helpers::XMLSitemap helper requires the site ' \
|
|
24
|
+
'configuration to specify the base URL for the site.'
|
|
24
25
|
end
|
|
25
26
|
|
|
26
27
|
# Build sitemap
|
|
@@ -27,7 +27,7 @@ module Nanoc::OrigCLI::Commands
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
def explain_item(item, rules:, reps:)
|
|
30
|
-
puts(fmt_heading("Item #{item.identifier}")
|
|
30
|
+
puts("#{fmt_heading("Item #{item.identifier}")}:")
|
|
31
31
|
|
|
32
32
|
reps[item].each do |rep|
|
|
33
33
|
rule = rules.compilation_rule_for(rep)
|
|
@@ -38,7 +38,7 @@ module Nanoc::OrigCLI::Commands
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
def explain_layout(layout, rules:)
|
|
41
|
-
puts(fmt_heading("Layout #{layout.identifier}")
|
|
41
|
+
puts("#{fmt_heading("Layout #{layout.identifier}")}:")
|
|
42
42
|
|
|
43
43
|
found = false
|
|
44
44
|
rules.layout_filter_mapping.each_key do |pattern|
|
|
@@ -22,7 +22,11 @@ module Nanoc::RuleDSL
|
|
|
22
22
|
|
|
23
23
|
class PathWithoutInitialSlashError < ::Nanoc::Error
|
|
24
24
|
def initialize(rep, basic_path)
|
|
25
|
-
super(
|
|
25
|
+
super(
|
|
26
|
+
"The path returned for the #{rep.inspect} item representation, " \
|
|
27
|
+
"“#{basic_path}”, does not start with a slash. Please ensure that " \
|
|
28
|
+
'all routing rules return a path that starts with a slash.',
|
|
29
|
+
)
|
|
26
30
|
end
|
|
27
31
|
end
|
|
28
32
|
|
|
@@ -92,7 +96,7 @@ module Nanoc::RuleDSL
|
|
|
92
96
|
def compact_snapshots(seq)
|
|
93
97
|
actions = []
|
|
94
98
|
seq.actions.each do |action|
|
|
95
|
-
if [actions.last, action].all?
|
|
99
|
+
if [actions.last, action].all?(Nanoc::Core::ProcessingActions::Snapshot)
|
|
96
100
|
actions[-1] = actions.last.update(snapshot_names: action.snapshot_names, paths: action.paths)
|
|
97
101
|
else
|
|
98
102
|
actions << action
|
|
@@ -78,7 +78,7 @@ module Nanoc::RuleDSL
|
|
|
78
78
|
when Hash
|
|
79
79
|
if arg.key?(:ext)
|
|
80
80
|
ext = arg[:ext].sub(/\A\./, '')
|
|
81
|
-
path = @item.identifier.without_exts
|
|
81
|
+
path = "#{@item.identifier.without_exts}.#{ext}"
|
|
82
82
|
snapshot(snapshot_name, path:)
|
|
83
83
|
else
|
|
84
84
|
raise ArgumentError, 'Cannot call #write this way (need path or :ext)'
|
|
@@ -177,15 +177,19 @@ module Nanoc::RuleDSL
|
|
|
177
177
|
routing_block = proc do
|
|
178
178
|
if item.identifier.full?
|
|
179
179
|
item.identifier.to_s
|
|
180
|
+
elsif item[:extension].nil? || (item[:content_filename].nil? && item.identifier =~ %r{#{item[:extension]}/$})
|
|
181
|
+
item.identifier.chop
|
|
180
182
|
else
|
|
181
183
|
# This is a temporary solution until an item can map back to its data
|
|
182
|
-
# source.
|
|
183
|
-
#
|
|
184
|
-
#
|
|
185
|
-
item[:extension].nil? || (item[:content_filename].nil? && item.identifier =~ %r{#{item[:extension]}/$}) ? item.identifier.chop : item.identifier.chop + '.' + item[:extension]
|
|
184
|
+
# source. ATM item[:content_filename] is nil for items coming from the
|
|
185
|
+
# static data source.
|
|
186
|
+
"#{item.identifier.chop}.#{item[:extension]}"
|
|
186
187
|
end
|
|
187
188
|
end
|
|
188
|
-
routing_rule = Nanoc::RuleDSL::RoutingRule.new(
|
|
189
|
+
routing_rule = Nanoc::RuleDSL::RoutingRule.new(
|
|
190
|
+
create_pattern(identifier), rep, routing_block,
|
|
191
|
+
snapshot_name: :last
|
|
192
|
+
)
|
|
189
193
|
@rules_collection.add_item_routing_rule(routing_rule)
|
|
190
194
|
end
|
|
191
195
|
|
data/lib/nanoc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nanoc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.14.
|
|
4
|
+
version: 4.14.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Denis Defreyne
|
|
@@ -49,28 +49,28 @@ dependencies:
|
|
|
49
49
|
requirements:
|
|
50
50
|
- - '='
|
|
51
51
|
- !ruby/object:Gem::Version
|
|
52
|
-
version: 4.14.
|
|
52
|
+
version: 4.14.7
|
|
53
53
|
type: :runtime
|
|
54
54
|
prerelease: false
|
|
55
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
56
56
|
requirements:
|
|
57
57
|
- - '='
|
|
58
58
|
- !ruby/object:Gem::Version
|
|
59
|
-
version: 4.14.
|
|
59
|
+
version: 4.14.7
|
|
60
60
|
- !ruby/object:Gem::Dependency
|
|
61
61
|
name: nanoc-core
|
|
62
62
|
requirement: !ruby/object:Gem::Requirement
|
|
63
63
|
requirements:
|
|
64
64
|
- - '='
|
|
65
65
|
- !ruby/object:Gem::Version
|
|
66
|
-
version: 4.14.
|
|
66
|
+
version: 4.14.7
|
|
67
67
|
type: :runtime
|
|
68
68
|
prerelease: false
|
|
69
69
|
version_requirements: !ruby/object:Gem::Requirement
|
|
70
70
|
requirements:
|
|
71
71
|
- - '='
|
|
72
72
|
- !ruby/object:Gem::Version
|
|
73
|
-
version: 4.14.
|
|
73
|
+
version: 4.14.7
|
|
74
74
|
- !ruby/object:Gem::Dependency
|
|
75
75
|
name: nanoc-deploying
|
|
76
76
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -218,7 +218,7 @@ licenses:
|
|
|
218
218
|
- MIT
|
|
219
219
|
metadata:
|
|
220
220
|
rubygems_mfa_required: 'true'
|
|
221
|
-
source_code_uri: https://github.com/nanoc/nanoc/tree/4.14.
|
|
221
|
+
source_code_uri: https://github.com/nanoc/nanoc/tree/4.14.7/nanoc
|
|
222
222
|
rdoc_options: []
|
|
223
223
|
require_paths:
|
|
224
224
|
- lib
|