nanoc 4.14.5 → 4.14.6
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 +6 -0
- data/lib/nanoc/data_sources/filesystem.rb +6 -6
- data/lib/nanoc/filters/colorize_syntax.rb +2 -2
- data/lib/nanoc/filters/kramdown.rb +1 -1
- data/lib/nanoc/filters/relativize_paths.rb +7 -7
- data/lib/nanoc/filters/sass.rb +10 -3
- data/lib/nanoc/helpers/blogging.rb +1 -1
- data/lib/nanoc/helpers/breadcrumbs.rb +1 -1
- data/lib/nanoc/helpers/capturing.rb +18 -11
- data/lib/nanoc/helpers/child_parent.rb +1 -1
- data/lib/nanoc/helpers/html_escape.rb +2 -2
- data/lib/nanoc/rule_dsl/action_provider.rb +1 -1
- data/lib/nanoc/rule_dsl/compiler_dsl.rb +2 -2
- data/lib/nanoc/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 381f9b78be0bd850ae42b2166d8d12c59d6dca22bdbbecc0638ef3e4569288aa
|
|
4
|
+
data.tar.gz: 89da1dea5adea2239cde2af78182f593b66e003bc170acb01b309d9ca9e36e5f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '0910d3ef0fd6ba12e12cfb6c9feb554e414575898cc34392ad8f311df5d26de7b4f5b59164b79378a8d90e170371e461f8440ce5c9329959baecd6890621520a'
|
|
7
|
+
data.tar.gz: ea616d1d317bd5ee94693f9c1ffe4f5a469e15e586014f0981ab02205bc7adb957da60d6586d46f0f8b0c26dc17d869cab8c9e7fa91afdb67aef394637c26580
|
data/NEWS.md
CHANGED
|
@@ -302,7 +302,7 @@ module Nanoc::DataSources
|
|
|
302
302
|
|
|
303
303
|
by_basename =
|
|
304
304
|
all_files_in(dir_name)
|
|
305
|
-
.
|
|
305
|
+
.grep_v(/(~|\.orig|\.rej|\.bak)$/)
|
|
306
306
|
.group_by { |fn| basename_of(fn) }
|
|
307
307
|
|
|
308
308
|
all = {}
|
|
@@ -364,10 +364,10 @@ module Nanoc::DataSources
|
|
|
364
364
|
end
|
|
365
365
|
|
|
366
366
|
regex =
|
|
367
|
-
if
|
|
368
|
-
allow_periods_in_identifiers? ?
|
|
367
|
+
if %r{(^|/)index(\.[^/]+)?$}.match?(filename)
|
|
368
|
+
allow_periods_in_identifiers? ? %r{/?(index)?(\.[^/.]+)?$} : %r{/?index(\.[^/]+)?$}
|
|
369
369
|
else
|
|
370
|
-
allow_periods_in_identifiers? ?
|
|
370
|
+
allow_periods_in_identifiers? ? %r{\.[^/.]+$} : %r{\.[^/]+$}
|
|
371
371
|
end
|
|
372
372
|
Nanoc::Core::Identifier.new(filename.sub(regex, ''), type: :legacy)
|
|
373
373
|
end
|
|
@@ -393,9 +393,9 @@ module Nanoc::DataSources
|
|
|
393
393
|
# @return [Regex]
|
|
394
394
|
def extension_regex
|
|
395
395
|
if allow_periods_in_identifiers?
|
|
396
|
-
|
|
396
|
+
%r{(\.[^/.]+$)}
|
|
397
397
|
else
|
|
398
|
-
|
|
398
|
+
%r{(\.[^/]+$)}
|
|
399
399
|
end
|
|
400
400
|
end
|
|
401
401
|
|
|
@@ -56,9 +56,9 @@ module Nanoc::Filters
|
|
|
56
56
|
has_class = true if language
|
|
57
57
|
else
|
|
58
58
|
# Get language from comment line
|
|
59
|
-
match = element.inner_text.strip.split[0].match(
|
|
59
|
+
match = element.inner_text.strip.split[0].match(%r{^#!([^/][^\n]*)$})
|
|
60
60
|
language = match[1] if match
|
|
61
|
-
element.content = element.content.sub(
|
|
61
|
+
element.content = element.content.sub(%r{^#!([^/][^\n]*)$\n}, '') if language
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
language ? ExtractedLanguage.new(language, has_class) : nil
|
|
@@ -56,8 +56,8 @@ module Nanoc::Filters
|
|
|
56
56
|
relativize_html_like(content, params)
|
|
57
57
|
else
|
|
58
58
|
raise 'The relativize_paths needs to know the type of content to ' \
|
|
59
|
-
|
|
60
|
-
|
|
59
|
+
'process. Pass a :type to the filter call (:html for HTML, ' \
|
|
60
|
+
':xhtml for XHTML, :xml for XML, or :css for CSS).'
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
@@ -65,7 +65,7 @@ module Nanoc::Filters
|
|
|
65
65
|
|
|
66
66
|
def relativize_css(content, params)
|
|
67
67
|
# FIXME: parse CSS the proper way using csspool or something
|
|
68
|
-
content.gsub(
|
|
68
|
+
content.gsub(%r{url\((['"]?)(/(?:[^/].*?)?)\1\)}) do
|
|
69
69
|
quote = Regexp.last_match[1]
|
|
70
70
|
path = Regexp.last_match[2]
|
|
71
71
|
|
|
@@ -84,7 +84,7 @@ module Nanoc::Filters
|
|
|
84
84
|
when Regexp
|
|
85
85
|
exclusion
|
|
86
86
|
when String
|
|
87
|
-
|
|
87
|
+
%r{\A#{exclusion}(\z|/)}
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
end
|
|
@@ -193,7 +193,7 @@ module Nanoc::Filters
|
|
|
193
193
|
end
|
|
194
194
|
|
|
195
195
|
def nokogiri_process_comment(node, doc, selectors, namespaces, klass, type, params)
|
|
196
|
-
content = node.content.dup.sub(
|
|
196
|
+
content = node.content.dup.sub(/^(\s*\[.+?\]>\s*)(.+?)(\s*<!\[endif\])/m) do |_m|
|
|
197
197
|
beginning = Regexp.last_match[1]
|
|
198
198
|
body = Regexp.last_match[2]
|
|
199
199
|
ending = Regexp.last_match[3]
|
|
@@ -220,7 +220,7 @@ module Nanoc::Filters
|
|
|
220
220
|
|
|
221
221
|
if parsed.is_a?(Array)
|
|
222
222
|
parsed.map do |pair|
|
|
223
|
-
[relative_path_to(pair[:url]), pair[:rest]].join
|
|
223
|
+
[relative_path_to(pair[:url]), pair[:rest]].join
|
|
224
224
|
end.join(',')
|
|
225
225
|
else
|
|
226
226
|
relative_path_to(parsed)
|
|
@@ -228,7 +228,7 @@ module Nanoc::Filters
|
|
|
228
228
|
end
|
|
229
229
|
|
|
230
230
|
def path_is_relativizable?(path, params)
|
|
231
|
-
path.match?(
|
|
231
|
+
path.match?(%r{\A\s*/}) && !exclude?(path, params)
|
|
232
232
|
end
|
|
233
233
|
end
|
|
234
234
|
end
|
data/lib/nanoc/filters/sass.rb
CHANGED
|
@@ -39,10 +39,17 @@ module Nanoc::Filters
|
|
|
39
39
|
sourcemap = sourcemap&.to_json(css_uri: css_path)
|
|
40
40
|
encoded = "data:application/json;base64,#{Base64.urlsafe_encode64(sourcemap)}"
|
|
41
41
|
[css.gsub(%r{^/\*#\s+sourceMappingURL=\s*#{sourcemap_path}\s*\*/$}, "/*# sourceMappingURL=#{encoded} */")]
|
|
42
|
-
|
|
43
|
-
sourcemap =
|
|
44
|
-
|
|
42
|
+
elsif sourcemap
|
|
43
|
+
sourcemap =
|
|
44
|
+
sourcemap
|
|
45
|
+
.to_json(css_path:, sourcemap_path:, type: params[:sources_content] ? :inline : :auto)
|
|
46
|
+
.split("\n")
|
|
47
|
+
.grep_v(/^\s*"file":\s*"#{filter.object_id}"\s*$/)
|
|
48
|
+
.join("\n")
|
|
45
49
|
[css, sourcemap]
|
|
50
|
+
else
|
|
51
|
+
[css, nil]
|
|
52
|
+
|
|
46
53
|
end
|
|
47
54
|
end
|
|
48
55
|
end
|
|
@@ -241,7 +241,7 @@ module Nanoc::Helpers
|
|
|
241
241
|
raise Nanoc::Core::TrivialError.new('Cannot build Atom feed: site configuration has no base_url')
|
|
242
242
|
end
|
|
243
243
|
|
|
244
|
-
@item[:feed_url] || @config[:base_url] + @item.path
|
|
244
|
+
@item[:feed_url] || (@config[:base_url] + @item.path)
|
|
245
245
|
end
|
|
246
246
|
|
|
247
247
|
# @return [String]
|
|
@@ -112,7 +112,7 @@ module Nanoc::Helpers
|
|
|
112
112
|
if @item.identifier.legacy?
|
|
113
113
|
prefixes.map { |pr| @items[Nanoc::Core::Identifier.new('/' + pr, type: :legacy)] }
|
|
114
114
|
else
|
|
115
|
-
ancestral_prefixes = prefixes.
|
|
115
|
+
ancestral_prefixes = prefixes.grep_v(%r{^/index\.})[0..-2]
|
|
116
116
|
ancestral_items =
|
|
117
117
|
ancestral_prefixes.map do |pr|
|
|
118
118
|
if pr == ''
|
|
@@ -20,7 +20,7 @@ module Nanoc::Helpers
|
|
|
20
20
|
content_string = capture(&)
|
|
21
21
|
|
|
22
22
|
# Get existing contents and prep for store
|
|
23
|
-
|
|
23
|
+
compiled_content_repo = @item._context.compiled_content_repo
|
|
24
24
|
rep = @item.reps[:default]._unwrap
|
|
25
25
|
capture_name = :"__capture_#{@name}"
|
|
26
26
|
old_content_string =
|
|
@@ -28,10 +28,10 @@ module Nanoc::Helpers
|
|
|
28
28
|
when :overwrite
|
|
29
29
|
''
|
|
30
30
|
when :append
|
|
31
|
-
c =
|
|
31
|
+
c = compiled_content_repo.get(rep, capture_name)
|
|
32
32
|
c ? c.string : ''
|
|
33
33
|
when :error
|
|
34
|
-
contents =
|
|
34
|
+
contents = compiled_content_repo.get(rep, capture_name)
|
|
35
35
|
if contents && contents.string != content_string
|
|
36
36
|
# FIXME: get proper exception
|
|
37
37
|
raise "a capture named #{@name.inspect} for #{@item.identifier} already exists"
|
|
@@ -40,12 +40,12 @@ module Nanoc::Helpers
|
|
|
40
40
|
end
|
|
41
41
|
else
|
|
42
42
|
raise ArgumentError, 'expected :existing_behavior param to #content_for to be one of ' \
|
|
43
|
-
|
|
43
|
+
":overwrite, :append, or :error, but #{existing_behavior.inspect} was given"
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# Store
|
|
47
47
|
new_content = Nanoc::Core::TextualContent.new(old_content_string + content_string)
|
|
48
|
-
|
|
48
|
+
compiled_content_repo.set(rep, capture_name, new_content)
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
|
|
@@ -59,21 +59,28 @@ module Nanoc::Helpers
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def run
|
|
62
|
-
|
|
62
|
+
rep_view = @requested_item.reps[:default]
|
|
63
|
+
rep = rep_view._unwrap
|
|
63
64
|
|
|
64
65
|
# Create dependency
|
|
65
66
|
if @item.nil? || @requested_item != @item._unwrap
|
|
66
67
|
dependency_tracker = @config._context.dependency_tracker
|
|
67
68
|
dependency_tracker.bounce(@requested_item._unwrap, compiled_content: true)
|
|
68
69
|
|
|
70
|
+
unless rep.compiled?
|
|
71
|
+
rep_view._try_load_from_cache
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# If the item rep still isn’t compiled by now, then it can’t be loaded
|
|
75
|
+
# from the cache and needs to compiled as usual.
|
|
69
76
|
unless rep.compiled?
|
|
70
77
|
# FIXME: is :last appropriate?
|
|
71
78
|
raise Nanoc::Core::Errors::UnmetDependency.new(rep, :last)
|
|
72
79
|
end
|
|
73
80
|
end
|
|
74
81
|
|
|
75
|
-
|
|
76
|
-
content =
|
|
82
|
+
compiled_content_repo = @config._context.compiled_content_repo
|
|
83
|
+
content = compiled_content_repo.get(rep, :"__capture_#{@name}")
|
|
77
84
|
content&.string
|
|
78
85
|
end
|
|
79
86
|
end
|
|
@@ -112,7 +119,7 @@ module Nanoc::Helpers
|
|
|
112
119
|
args[1]
|
|
113
120
|
else
|
|
114
121
|
raise ArgumentError, 'expected 1 or 2 argument (the name ' \
|
|
115
|
-
|
|
122
|
+
"of the capture, and optionally params) but got #{args.size} instead"
|
|
116
123
|
end
|
|
117
124
|
|
|
118
125
|
SetContent.new(name, params, @item).run(&)
|
|
@@ -127,7 +134,7 @@ module Nanoc::Helpers
|
|
|
127
134
|
args[1]
|
|
128
135
|
else
|
|
129
136
|
raise ArgumentError, 'expected 2 or 3 arguments (the name ' \
|
|
130
|
-
|
|
137
|
+
"of the capture, optionally params, and the content) but got #{args.size} instead"
|
|
131
138
|
end
|
|
132
139
|
|
|
133
140
|
_erbout = +'' # rubocop:disable Lint/UnderscorePrefixedVariableName
|
|
@@ -135,7 +142,7 @@ module Nanoc::Helpers
|
|
|
135
142
|
else # Get content
|
|
136
143
|
if args.size != 2
|
|
137
144
|
raise ArgumentError, 'expected 2 arguments (the item ' \
|
|
138
|
-
|
|
145
|
+
"and the name of the capture) but got #{args.size} instead"
|
|
139
146
|
end
|
|
140
147
|
requested_item = args[0]
|
|
141
148
|
name = args[1]
|
|
@@ -7,7 +7,7 @@ module Nanoc::Helpers
|
|
|
7
7
|
if item.identifier.legacy?
|
|
8
8
|
item.parent
|
|
9
9
|
else
|
|
10
|
-
path_without_last_component = item.identifier.to_s.sub(
|
|
10
|
+
path_without_last_component = item.identifier.to_s.sub(%r{[^/]+$}, '').chop
|
|
11
11
|
@items[path_without_last_component + '.*']
|
|
12
12
|
end
|
|
13
13
|
end
|
|
@@ -21,7 +21,7 @@ module Nanoc::Helpers
|
|
|
21
21
|
elsif string
|
|
22
22
|
unless string.is_a? String
|
|
23
23
|
raise ArgumentError, 'The #html_escape or #h function needs either a ' \
|
|
24
|
-
|
|
24
|
+
"string or a block to HTML-escape, but #{string.class} was given"
|
|
25
25
|
end
|
|
26
26
|
|
|
27
27
|
string
|
|
@@ -32,7 +32,7 @@ module Nanoc::Helpers
|
|
|
32
32
|
.gsub("'", ''')
|
|
33
33
|
else
|
|
34
34
|
raise 'The #html_escape or #h function needs either a ' \
|
|
35
|
-
|
|
35
|
+
'string or a block to HTML-escape, but neither a string nor a block was given'
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
|
|
@@ -65,7 +65,7 @@ module Nanoc::RuleDSL
|
|
|
65
65
|
items: site.items,
|
|
66
66
|
dependency_tracker:,
|
|
67
67
|
compilation_context: compiler.compilation_context(reps:),
|
|
68
|
-
|
|
68
|
+
compiled_content_repo: Nanoc::Core::CompiledContentRepo.new,
|
|
69
69
|
)
|
|
70
70
|
ctx = new_postprocessor_context(site, view_context)
|
|
71
71
|
|
|
@@ -32,7 +32,7 @@ module Nanoc::RuleDSL
|
|
|
32
32
|
def preprocess(&block)
|
|
33
33
|
if @rules_collection.preprocessors[rules_filename]
|
|
34
34
|
warn 'WARNING: A preprocess block is already defined. Defining ' \
|
|
35
|
-
|
|
35
|
+
'another preprocess block overrides the previously one.'
|
|
36
36
|
end
|
|
37
37
|
@rules_collection.preprocessors[rules_filename] = block
|
|
38
38
|
end
|
|
@@ -245,7 +245,7 @@ module Nanoc::RuleDSL
|
|
|
245
245
|
def postprocess(&block)
|
|
246
246
|
if @rules_collection.postprocessors[rules_filename]
|
|
247
247
|
warn 'WARNING: A postprocess block is already defined. Defining ' \
|
|
248
|
-
|
|
248
|
+
'another postprocess block overrides the previously one.'
|
|
249
249
|
end
|
|
250
250
|
@rules_collection.postprocessors[rules_filename] = block
|
|
251
251
|
end
|
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.6
|
|
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.6
|
|
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.6
|
|
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.6
|
|
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.6
|
|
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.6/nanoc
|
|
222
222
|
rdoc_options: []
|
|
223
223
|
require_paths:
|
|
224
224
|
- lib
|
|
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
233
233
|
- !ruby/object:Gem::Version
|
|
234
234
|
version: '0'
|
|
235
235
|
requirements: []
|
|
236
|
-
rubygems_version:
|
|
236
|
+
rubygems_version: 4.0.3
|
|
237
237
|
specification_version: 4
|
|
238
238
|
summary: A static-site generator with a focus on flexibility.
|
|
239
239
|
test_files: []
|