nanoc 4.12.20 → 4.13.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4f4f1156179e5c1fc63d9d2a7eb8539d41f3f2141fa1109027935cd7191f6e6
4
- data.tar.gz: e80a883c6c173dd2c767539ecbf060b30f0a41e23dfaaa028cb00037c80819a7
3
+ metadata.gz: 48a0bdf76aa79dd9d4f2ea05f2a8d4fd0b4d431e9889d91856878aaaf0ff39c9
4
+ data.tar.gz: 8d6ae45464a308e01d7d90cd1d5f81496df31d6512f84a80ee6d4f4c9133c1fb
5
5
  SHA512:
6
- metadata.gz: 54f4bc19b599bb1223fedce0c505896c6554596ee8a110f1f171b9cddc6faa1ca5a72f675e8a404483c250e897da0ca85347280c96f48fe3c13cb1e093bd3ddb
7
- data.tar.gz: 4605c0f855c3cdb3b1d352089087eb6a1ddbfc333fe3b11e77b7ddb3d6a8313f92cf8c20c93d22ea23887af8afa9b71d743c1bfe8852dd6f394a17b933e80fc9
6
+ metadata.gz: 22448a320d47169e6709a0f74ad962a5b6369bda3ab4c371bf0b7f475c8a40a3bb7077a1f6bec6d9da4d06499310582bf9d3ec5e5627a90abcb8c16eb4ebb972
7
+ data.tar.gz: 711d80a0ceed374cb8ccdb24d84136d6ae49e3f49b130a5e9789b4bc9fe75d3bdc466a4e360e9e993b4bde971d262a2859e0eac2d8fd2742c04a38be9d3c1ff5
data/NEWS.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Nanoc news
2
2
 
3
+ ## 4.13.0 (2024-06-19)
4
+
5
+ Features:
6
+
7
+ - Added `--focus` option to the `compile` and `live` commands (#1707)
8
+
9
+ Fixes:
10
+
11
+ - Made `delete` log lines use relative (not absolute) paths (#1706)
12
+
13
+ Changes:
14
+
15
+ - Dropped support for Ruby 3.0 (EOL) (#1704)
16
+
17
+ ## 4.12.21 (2024-04-27)
18
+
19
+ Fixes:
20
+
21
+ - Fixed a rare “private method printf” error (#1694)
22
+
23
+ Enhancements:
24
+
25
+ - Sped up checksummer and made it more reliable and correct (#1693)
26
+ - Removed Nokogiri warning message on JRuby (#1700)
27
+
3
28
  ## 4.12.20 (2024-03-15)
4
29
 
5
30
  Enhancements:
@@ -35,7 +35,7 @@ class Nanoc::DataSources::Filesystem
35
35
  content = content_filename ? Tools.read_file(content_filename, config: @config) : ''
36
36
  meta_raw = Tools.read_file(meta_filename, config: @config)
37
37
  meta = parse_metadata(meta_raw, meta_filename)
38
- ParseResult.new(content: content, attributes: meta, attributes_data: meta_raw)
38
+ ParseResult.new(content:, attributes: meta, attributes_data: meta_raw)
39
39
  end
40
40
 
41
41
  # @return [ParseResult]
@@ -54,7 +54,7 @@ class Nanoc::DataSources::Filesystem
54
54
  meta = parse_metadata(pieces[2], content_filename)
55
55
  content = pieces[4].sub(/\A\n/, '')
56
56
 
57
- ParseResult.new(content: content, attributes: meta, attributes_data: pieces[2])
57
+ ParseResult.new(content:, attributes: meta, attributes_data: pieces[2])
58
58
  end
59
59
 
60
60
  # @return [Hash]
@@ -248,8 +248,8 @@ module Nanoc::DataSources
248
248
  def extra_attributes_for(content_filename, meta_filename)
249
249
  {
250
250
  filename: content_filename,
251
- content_filename: content_filename,
252
- meta_filename: meta_filename,
251
+ content_filename:,
252
+ meta_filename:,
253
253
  extension: content_filename ? ext_of(content_filename)[1..] : nil,
254
254
  mtime: mtime_of(content_filename, meta_filename),
255
255
  }
@@ -25,7 +25,7 @@ module Nanoc
25
25
  x # and a U+0078 LATIN SMALL LETTER X character.
26
26
  )
27
27
  )*
28
- /x.freeze
28
+ /x
29
29
 
30
30
  def initialize(value)
31
31
  @value = value
data/lib/nanoc/extra.rb CHANGED
@@ -15,6 +15,5 @@ module Nanoc::Extra
15
15
  Pruner = Nanoc::Core::Pruner
16
16
  end
17
17
 
18
- require_relative 'extra/jruby_nokogiri_warner'
19
18
  require_relative 'extra/srcset_parser'
20
19
  require_relative 'extra/core_ext'
@@ -12,8 +12,6 @@ module Nanoc::Filters
12
12
  ExtractedLanguage = Struct.new(:language, :from_class)
13
13
 
14
14
  def run(content, params = {})
15
- Nanoc::Extra::JRubyNokogiriWarner.check_and_warn
16
-
17
15
  @colorizers = colorizers_from_params(params)
18
16
 
19
17
  syntax = params.fetch(:syntax, :html)
@@ -27,7 +27,7 @@ module Nanoc::Filters
27
27
 
28
28
  # Get result
29
29
  trim_mode = params[:trim_mode]
30
- erb = ::ERB.new(content, trim_mode: trim_mode)
30
+ erb = ::ERB.new(content, trim_mode:)
31
31
  erb.filename = filename
32
32
  erb.result(assigns_binding)
33
33
  end
@@ -23,7 +23,7 @@ module Nanoc::Filters
23
23
  assigns_binding = context.get_binding(&proc)
24
24
 
25
25
  # Get result
26
- engine_opts = { bufvar: '_erbout', filename: filename }.merge(params)
26
+ engine_opts = { bufvar: '_erbout', filename: }.merge(params)
27
27
  engine = ::Erubi::Engine.new(content, engine_opts)
28
28
  eval(engine.src, assigns_binding, filename)
29
29
  end
@@ -22,7 +22,7 @@ module Nanoc::Filters
22
22
  assigns_binding = context.get_binding(&proc)
23
23
 
24
24
  # Get result
25
- erubis_with_erbout.new(content, filename: filename).result(assigns_binding)
25
+ erubis_with_erbout.new(content, filename:).result(assigns_binding)
26
26
  end
27
27
 
28
28
  private
@@ -15,7 +15,7 @@ module Nanoc::Filters
15
15
  # @return [String] The filtered content
16
16
  def run(content, params = {})
17
17
  # Get options
18
- options = params.merge(filename: filename)
18
+ options = params.merge(filename:)
19
19
 
20
20
  # Create context
21
21
  context = ::Nanoc::Core::Context.new(assigns)
@@ -22,7 +22,7 @@ module Nanoc::Filters
22
22
  # Add filename to load path
23
23
  paths = [File.dirname(@item[:content_filename])]
24
24
  on_main_fiber do
25
- parser = ::Less::Parser.new(paths: paths)
25
+ parser = ::Less::Parser.new(paths:)
26
26
  parser.parse(content).to_css(params)
27
27
  end
28
28
  end
@@ -45,8 +45,6 @@ module Nanoc::Filters
45
45
  #
46
46
  # @return [String] The filtered content
47
47
  def run(content, params = {})
48
- Nanoc::Extra::JRubyNokogiriWarner.check_and_warn
49
-
50
48
  # Set assigns so helper function can be used
51
49
  @item_rep = assigns[:item_rep] if @item_rep.nil?
52
50
 
@@ -21,7 +21,7 @@ module Nanoc::Filters
21
21
 
22
22
  options = params.merge(
23
23
  load_paths: [importer, *params[:load_paths]&.reject { |p| p.is_a?(String) && %r{^content/} =~ p }],
24
- importer: importer,
24
+ importer:,
25
25
  filename: rep.item.identifier.to_s,
26
26
  cache: false,
27
27
  )
@@ -40,7 +40,7 @@ module Nanoc::Filters
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
42
  else
43
- sourcemap = sourcemap&.to_json(css_path: css_path, sourcemap_path: sourcemap_path, type: params[:sources_content] ? :inline : :auto)
43
+ sourcemap = sourcemap&.to_json(css_path:, sourcemap_path:, type: params[:sources_content] ? :inline : :auto)
44
44
  sourcemap = sourcemap&.split("\n")&.reject { |l| l =~ /^\s*"file":\s*"#{filter.object_id}"\s*$/ }&.join("\n")
45
45
  [css, sourcemap]
46
46
  end
@@ -36,8 +36,6 @@ module Nanoc::Filters
36
36
  #
37
37
  # @return [String] The transformed content
38
38
  def run(_content, params = {})
39
- Nanoc::Extra::JRubyNokogiriWarner.check_and_warn
40
-
41
39
  if assigns[:layout].nil?
42
40
  raise 'The XSL filter can only be run as a layout'
43
41
  end
@@ -33,12 +33,12 @@ module Nanoc::Helpers
33
33
 
34
34
  # e.g. unfold(10.class, &:superclass)
35
35
  # => [Integer, Numeric, Object, BasicObject]
36
- def self.unfold(obj, &blk)
36
+ def self.unfold(obj, &)
37
37
  acc = [obj]
38
38
 
39
39
  res = yield(obj)
40
40
  if res
41
- acc + unfold(res, &blk)
41
+ acc + unfold(res, &)
42
42
  else
43
43
  acc
44
44
  end
@@ -13,11 +13,11 @@ module Nanoc::Helpers
13
13
  @item = item
14
14
  end
15
15
 
16
- def run(&block)
16
+ def run(&)
17
17
  existing_behavior = @params.fetch(:existing, :error)
18
18
 
19
19
  # Capture
20
- content_string = capture(&block)
20
+ content_string = capture(&)
21
21
 
22
22
  # Get existing contents and prep for store
23
23
  compiled_content_store = @item._context.compiled_content_store
@@ -102,7 +102,7 @@ module Nanoc::Helpers
102
102
  # @overload content_for(item, name)
103
103
  # @param [Symbol, String] name
104
104
  # @return [String]
105
- def content_for(*args, &block)
105
+ def content_for(*args, &)
106
106
  if block_given? # Set content
107
107
  name = args[0]
108
108
  params =
@@ -116,7 +116,7 @@ module Nanoc::Helpers
116
116
  "of the capture, and optionally params) but got #{args.size} instead"
117
117
  end
118
118
 
119
- SetContent.new(name, params, @item).run(&block)
119
+ SetContent.new(name, params, @item).run(&)
120
120
  elsif args.size > 1 && (args.first.is_a?(Symbol) || args.first.is_a?(String)) # Set content
121
121
  name = args[0]
122
122
  content = args.last
@@ -22,8 +22,8 @@ module Nanoc::OrigCLI::Commands
22
22
  items = site.items.sort_by(&:identifier)
23
23
  layouts = site.layouts.sort_by(&:identifier)
24
24
 
25
- items.each { |e| explain_item(e, rules: rules, reps: reps) }
26
- layouts.each { |e| explain_layout(e, rules: rules) }
25
+ items.each { |e| explain_item(e, rules:, reps:) }
26
+ layouts.each { |e| explain_layout(e, rules:) }
27
27
  end
28
28
 
29
29
  def explain_item(item, rules:, reps:)
@@ -12,7 +12,7 @@ module Nanoc::RuleDSL
12
12
 
13
13
  action_sequence_calculator =
14
14
  Nanoc::RuleDSL::ActionSequenceCalculator.new(
15
- rules_collection: rules_collection, site: site,
15
+ rules_collection:, site:,
16
16
  )
17
17
 
18
18
  action_provider = new(rules_collection, action_sequence_calculator)
@@ -61,10 +61,10 @@ module Nanoc::RuleDSL
61
61
 
62
62
  view_context =
63
63
  Nanoc::Core::ViewContextForCompilation.new(
64
- reps: reps,
64
+ reps:,
65
65
  items: site.items,
66
- dependency_tracker: dependency_tracker,
67
- compilation_context: compiler.compilation_context(reps: reps),
66
+ dependency_tracker:,
67
+ compilation_context: compiler.compilation_context(reps:),
68
68
  compiled_content_store: Nanoc::Core::CompiledContentStore.new,
69
69
  )
70
70
  ctx = new_postprocessor_context(site, view_context)
@@ -62,7 +62,7 @@ module Nanoc::RuleDSL
62
62
  end
63
63
 
64
64
  recorder.snapshot(:raw)
65
- rule.apply_to(rep, recorder: recorder, site: @site, view_context: view_context)
65
+ rule.apply_to(rep, recorder:, site: @site, view_context:)
66
66
  recorder.snapshot(:post) if recorder.any_layouts?
67
67
  recorder.snapshot(:last)
68
68
  recorder.snapshot(:pre) unless recorder.pre_snapshot?
@@ -70,7 +70,7 @@ module Nanoc::RuleDSL
70
70
  copy_paths_from_routing_rules(
71
71
  compact_snapshots(recorder.action_sequence),
72
72
  recorder.snapshots_for_which_to_skip_routing_rule,
73
- rep: rep,
73
+ rep:,
74
74
  )
75
75
  end
76
76
 
@@ -98,7 +98,7 @@ module Nanoc::RuleDSL
98
98
  actions << action
99
99
  end
100
100
  end
101
- Nanoc::Core::ActionSequence.new(actions: actions)
101
+ Nanoc::Core::ActionSequence.new(actions:)
102
102
  end
103
103
 
104
104
  def copy_paths_from_routing_rules(seq, snapshots_for_which_to_skip_routing_rule, rep:)
@@ -119,7 +119,7 @@ module Nanoc::RuleDSL
119
119
  # For each snapshot name, find a path from a routing rule. The routing
120
120
  # rule might return nil, so we need #compact.
121
121
  paths = action.snapshot_names.map { |sn| basic_path_from_rules_for(rep, sn) }.compact
122
- action.update(snapshot_names: [], paths: paths)
122
+ action.update(snapshot_names: [], paths:)
123
123
  end
124
124
  end
125
125
 
@@ -136,7 +136,7 @@ module Nanoc::RuleDSL
136
136
  routing_rule.apply_to(
137
137
  rep,
138
138
  site: @site,
139
- view_context: view_context,
139
+ view_context:,
140
140
  )
141
141
 
142
142
  if basic_path && !basic_path.start_with?('/')
@@ -11,10 +11,10 @@ module Nanoc::RuleDSL
11
11
  ] => C::Any
12
12
  def apply_to(rep, site:, recorder:, view_context:)
13
13
  context = Nanoc::RuleDSL::CompilationRuleContext.new(
14
- rep: rep,
15
- recorder: recorder,
16
- site: site,
17
- view_context: view_context,
14
+ rep:,
15
+ recorder:,
16
+ site:,
17
+ view_context:,
18
18
  )
19
19
 
20
20
  context.instance_exec(matches(rep.item.identifier), &@block)
@@ -13,7 +13,7 @@ module Nanoc::RuleDSL
13
13
  def initialize(rep:, site:, recorder:, view_context:)
14
14
  @_recorder = recorder
15
15
 
16
- super(rep: rep, site: site, view_context: view_context)
16
+ super(rep:, site:, view_context:)
17
17
  end
18
18
 
19
19
  # Filters the current representation (calls {Nanoc::Core::ItemRep#filter} with
@@ -56,7 +56,7 @@ module Nanoc::RuleDSL
56
56
  #
57
57
  # @return [void]
58
58
  def snapshot(snapshot_name, path: Nanoc::Core::UNDEFINED)
59
- @_recorder.snapshot(snapshot_name, path: path)
59
+ @_recorder.snapshot(snapshot_name, path:)
60
60
  end
61
61
 
62
62
  # Creates a snapshot named :last the current compiled item content, with
@@ -79,7 +79,7 @@ module Nanoc::RuleDSL
79
79
  if arg.key?(:ext)
80
80
  ext = arg[:ext].sub(/\A\./, '')
81
81
  path = @item.identifier.without_exts + '.' + ext
82
- snapshot(snapshot_name, path: path)
82
+ snapshot(snapshot_name, path:)
83
83
  else
84
84
  raise ArgumentError, 'Cannot call #write this way (need path or :ext)'
85
85
  end
@@ -20,7 +20,7 @@ module Nanoc::RuleDSL
20
20
  def initialize(rules_collection, config)
21
21
  @rules_collection = rules_collection
22
22
  @config = config
23
- super({ config: config })
23
+ super({ config: })
24
24
  end
25
25
 
26
26
  # Creates a preprocessor block that will be executed after all data is
@@ -20,7 +20,7 @@ module Nanoc::RuleDSL
20
20
  ] => C::Any
21
21
  def apply_to(rep, site:, view_context:)
22
22
  context = Nanoc::RuleDSL::RoutingRuleContext.new(
23
- rep: rep, site: site, view_context: view_context,
23
+ rep:, site:, view_context:,
24
24
  )
25
25
 
26
26
  context.instance_exec(matches(rep.item.identifier), &@block)
data/lib/nanoc/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nanoc
4
4
  # The current Nanoc version.
5
- VERSION = '4.12.20'
5
+ VERSION = '4.13.0'
6
6
  end
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.12.20
4
+ version: 4.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-15 00:00:00.000000000 Z
11
+ date: 2024-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -64,28 +64,28 @@ dependencies:
64
64
  requirements:
65
65
  - - '='
66
66
  - !ruby/object:Gem::Version
67
- version: 4.12.20
67
+ version: 4.13.0
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - '='
73
73
  - !ruby/object:Gem::Version
74
- version: 4.12.20
74
+ version: 4.13.0
75
75
  - !ruby/object:Gem::Dependency
76
76
  name: nanoc-core
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: 4.12.20
81
+ version: 4.13.0
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - '='
87
87
  - !ruby/object:Gem::Version
88
- version: 4.12.20
88
+ version: 4.13.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: nanoc-deploying
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +165,6 @@ files:
165
165
  - lib/nanoc/extra.rb
166
166
  - lib/nanoc/extra/core_ext.rb
167
167
  - lib/nanoc/extra/core_ext/time.rb
168
- - lib/nanoc/extra/jruby_nokogiri_warner.rb
169
168
  - lib/nanoc/extra/srcset_parser.rb
170
169
  - lib/nanoc/filters.rb
171
170
  - lib/nanoc/filters/asciidoc.rb
@@ -234,7 +233,7 @@ licenses:
234
233
  - MIT
235
234
  metadata:
236
235
  rubygems_mfa_required: 'true'
237
- source_code_uri: https://github.com/nanoc/nanoc/tree/4.12.20/nanoc
236
+ source_code_uri: https://github.com/nanoc/nanoc/tree/4.13.0/nanoc
238
237
  post_install_message:
239
238
  rdoc_options: []
240
239
  require_paths:
@@ -243,14 +242,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
243
242
  requirements:
244
243
  - - ">="
245
244
  - !ruby/object:Gem::Version
246
- version: '2.7'
245
+ version: '3.1'
247
246
  required_rubygems_version: !ruby/object:Gem::Requirement
248
247
  requirements:
249
248
  - - ">="
250
249
  - !ruby/object:Gem::Version
251
250
  version: '0'
252
251
  requirements: []
253
- rubygems_version: 3.5.3
252
+ rubygems_version: 3.5.11
254
253
  signing_key:
255
254
  specification_version: 4
256
255
  summary: A static-site generator with a focus on flexibility.
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Nanoc::Extra
4
- # @api private
5
- class JRubyNokogiriWarner
6
- include Singleton
7
-
8
- TEXT = <<~EOS
9
- --------------------------------------------------------------------------------
10
- Note:
11
-
12
- The behavior of Pure Java Nokogiri differs from the Nokogiri used on the
13
- standard Ruby interpreter (MRI) due to differences in underlying libraries.
14
-
15
- These sometimes problematic behavioral differences can cause Nanoc filters not
16
- to function properly, if at all. If you need reliable (X)HTML and XML handling
17
- functionality, consider not using Nokogiri on JRuby for the time being.
18
-
19
- These issues are being worked on both from the Nokogiri and the Nanoc side. Keep
20
- your Nokogiri and Nanoc versions up to date!
21
-
22
- For details, see https://github.com/nanoc/nanoc/pull/422.
23
- --------------------------------------------------------------------------------
24
- EOS
25
-
26
- def self.check_and_warn
27
- instance.check_and_warn
28
- end
29
-
30
- def initialize
31
- @warned = false
32
- end
33
-
34
- def check_and_warn
35
- return unless defined?(RUBY_ENGINE)
36
- return if RUBY_ENGINE != 'jruby'
37
- return if @warned
38
-
39
- $stderr.puts TEXT
40
- @warned = true
41
- end
42
- end
43
- end