nanoc 3.7.3 → 3.7.4

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.
Files changed (182) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +71 -46
  3. data/NEWS.md +14 -0
  4. data/lib/nanoc.rb +1 -1
  5. data/lib/nanoc/base/checksummer.rb +1 -1
  6. data/lib/nanoc/base/compilation/checksum_store.rb +1 -1
  7. data/lib/nanoc/base/compilation/compiled_content_cache.rb +1 -1
  8. data/lib/nanoc/base/compilation/compiler.rb +11 -10
  9. data/lib/nanoc/base/compilation/compiler_dsl.rb +4 -4
  10. data/lib/nanoc/base/compilation/dependency_tracker.rb +7 -7
  11. data/lib/nanoc/base/compilation/filter.rb +1 -1
  12. data/lib/nanoc/base/compilation/item_rep_proxy.rb +6 -5
  13. data/lib/nanoc/base/compilation/item_rep_recorder_proxy.rb +8 -7
  14. data/lib/nanoc/base/compilation/outdatedness_checker.rb +6 -6
  15. data/lib/nanoc/base/compilation/rule.rb +1 -1
  16. data/lib/nanoc/base/compilation/rule_memory_store.rb +1 -1
  17. data/lib/nanoc/base/compilation/rules_collection.rb +5 -5
  18. data/lib/nanoc/base/context.rb +1 -1
  19. data/lib/nanoc/base/core_ext/array.rb +1 -1
  20. data/lib/nanoc/base/core_ext/date.rb +1 -1
  21. data/lib/nanoc/base/core_ext/hash.rb +1 -1
  22. data/lib/nanoc/base/directed_graph.rb +3 -3
  23. data/lib/nanoc/base/memoization.rb +1 -1
  24. data/lib/nanoc/base/notification_center.rb +1 -1
  25. data/lib/nanoc/base/ordered_hash.rb +1 -1
  26. data/lib/nanoc/base/plugin_registry.rb +3 -3
  27. data/lib/nanoc/base/result_data/item_rep.rb +13 -11
  28. data/lib/nanoc/base/source_data/code_snippet.rb +2 -2
  29. data/lib/nanoc/base/source_data/data_source.rb +3 -3
  30. data/lib/nanoc/base/source_data/item.rb +8 -8
  31. data/lib/nanoc/base/source_data/item_array.rb +1 -1
  32. data/lib/nanoc/base/source_data/layout.rb +1 -1
  33. data/lib/nanoc/base/source_data/site.rb +27 -18
  34. data/lib/nanoc/base/store.rb +3 -3
  35. data/lib/nanoc/base/temp_filename_factory.rb +2 -2
  36. data/lib/nanoc/cli.rb +6 -6
  37. data/lib/nanoc/cli/cleaning_stream.rb +1 -1
  38. data/lib/nanoc/cli/command_runner.rb +4 -3
  39. data/lib/nanoc/cli/commands/autocompile.rb +3 -3
  40. data/lib/nanoc/cli/commands/check.rb +3 -3
  41. data/lib/nanoc/cli/commands/compile.rb +23 -23
  42. data/lib/nanoc/cli/commands/create-item.rb +5 -5
  43. data/lib/nanoc/cli/commands/create-layout.rb +14 -14
  44. data/lib/nanoc/cli/commands/create-site.rb +6 -6
  45. data/lib/nanoc/cli/commands/deploy.rb +8 -8
  46. data/lib/nanoc/cli/commands/nanoc.rb +3 -3
  47. data/lib/nanoc/cli/commands/prune.rb +3 -3
  48. data/lib/nanoc/cli/commands/shell.rb +4 -4
  49. data/lib/nanoc/cli/commands/show-data.rb +5 -5
  50. data/lib/nanoc/cli/commands/show-plugins.rb +5 -5
  51. data/lib/nanoc/cli/commands/show-rules.rb +4 -4
  52. data/lib/nanoc/cli/commands/sync.rb +1 -1
  53. data/lib/nanoc/cli/commands/update.rb +13 -13
  54. data/lib/nanoc/cli/commands/validate-css.rb +3 -3
  55. data/lib/nanoc/cli/commands/validate-html.rb +3 -3
  56. data/lib/nanoc/cli/commands/validate-links.rb +6 -6
  57. data/lib/nanoc/cli/commands/view.rb +4 -4
  58. data/lib/nanoc/cli/commands/watch.rb +11 -11
  59. data/lib/nanoc/cli/error_handler.rb +10 -10
  60. data/lib/nanoc/cli/logger.rb +1 -1
  61. data/lib/nanoc/cli/stream_cleaners/abstract.rb +1 -1
  62. data/lib/nanoc/data_sources/deprecated/last_fm.rb +5 -5
  63. data/lib/nanoc/data_sources/deprecated/twitter.rb +1 -1
  64. data/lib/nanoc/data_sources/filesystem.rb +16 -16
  65. data/lib/nanoc/data_sources/filesystem_unified.rb +1 -1
  66. data/lib/nanoc/data_sources/filesystem_verbose.rb +1 -1
  67. data/lib/nanoc/data_sources/static.rb +1 -1
  68. data/lib/nanoc/extra/auto_compiler.rb +2 -2
  69. data/lib/nanoc/extra/checking/check.rb +11 -1
  70. data/lib/nanoc/extra/checking/checks/external_links.rb +15 -7
  71. data/lib/nanoc/extra/checking/checks/internal_links.rb +3 -3
  72. data/lib/nanoc/extra/checking/checks/stale.rb +6 -6
  73. data/lib/nanoc/extra/checking/runner.rb +10 -9
  74. data/lib/nanoc/extra/chick.rb +2 -2
  75. data/lib/nanoc/extra/core_ext/enumerable.rb +1 -1
  76. data/lib/nanoc/extra/deployers/fog.rb +2 -2
  77. data/lib/nanoc/extra/deployers/rsync.rb +3 -3
  78. data/lib/nanoc/extra/file_proxy.rb +3 -3
  79. data/lib/nanoc/extra/jruby_nokogiri_warner.rb +1 -1
  80. data/lib/nanoc/extra/link_collector.rb +3 -3
  81. data/lib/nanoc/extra/piper.rb +2 -2
  82. data/lib/nanoc/extra/pruner.rb +4 -3
  83. data/lib/nanoc/extra/validators/links.rb +2 -2
  84. data/lib/nanoc/extra/validators/w3c.rb +1 -1
  85. data/lib/nanoc/extra/vcs.rb +5 -5
  86. data/lib/nanoc/extra/vcses/dummy.rb +1 -1
  87. data/lib/nanoc/filters/asciidoc.rb +1 -1
  88. data/lib/nanoc/filters/bluecloth.rb +1 -1
  89. data/lib/nanoc/filters/coffeescript.rb +1 -1
  90. data/lib/nanoc/filters/colorize_syntax.rb +19 -21
  91. data/lib/nanoc/filters/erubis.rb +1 -1
  92. data/lib/nanoc/filters/handlebars.rb +1 -1
  93. data/lib/nanoc/filters/less.rb +2 -2
  94. data/lib/nanoc/filters/markaby.rb +1 -1
  95. data/lib/nanoc/filters/mustache.rb +1 -1
  96. data/lib/nanoc/filters/rdoc.rb +1 -1
  97. data/lib/nanoc/filters/relativize_paths.rb +5 -5
  98. data/lib/nanoc/filters/rubypants.rb +1 -1
  99. data/lib/nanoc/filters/sass/sass_filesystem_importer.rb +1 -1
  100. data/lib/nanoc/filters/typogruby.rb +1 -1
  101. data/lib/nanoc/filters/xsl.rb +1 -1
  102. data/lib/nanoc/helpers/blogging.rb +12 -12
  103. data/lib/nanoc/helpers/capturing.rb +3 -3
  104. data/lib/nanoc/helpers/html_escape.rb +6 -6
  105. data/lib/nanoc/helpers/tagging.rb +1 -1
  106. data/lib/nanoc/helpers/xml_sitemap.rb +4 -4
  107. data/lib/nanoc/tasks/clean.rake +1 -1
  108. data/lib/nanoc/tasks/clean.rb +1 -1
  109. data/lib/nanoc/tasks/deploy/rsync.rake +2 -2
  110. data/lib/nanoc/version.rb +1 -1
  111. data/tasks/rubocop.rake +1 -0
  112. data/test/base/core_ext/array_spec.rb +7 -7
  113. data/test/base/core_ext/hash_spec.rb +1 -1
  114. data/test/base/test_checksum_store.rb +1 -1
  115. data/test/base/test_compiler.rb +14 -14
  116. data/test/base/test_compiler_dsl.rb +13 -13
  117. data/test/base/test_context.rb +2 -2
  118. data/test/base/test_dependency_tracker.rb +42 -42
  119. data/test/base/test_directed_graph.rb +102 -102
  120. data/test/base/test_item.rb +21 -21
  121. data/test/base/test_item_array.rb +19 -19
  122. data/test/base/test_item_rep.rb +50 -50
  123. data/test/base/test_layout.rb +6 -6
  124. data/test/base/test_outdatedness_checker.rb +2 -2
  125. data/test/base/test_rule_context.rb +2 -2
  126. data/test/base/test_site.rb +5 -5
  127. data/test/cli/commands/test_compile.rb +7 -7
  128. data/test/cli/commands/test_create_site.rb +2 -2
  129. data/test/cli/commands/test_deploy.rb +10 -10
  130. data/test/cli/commands/test_prune.rb +2 -2
  131. data/test/cli/commands/test_sync.rb +1 -1
  132. data/test/cli/commands/test_watch.rb +7 -7
  133. data/test/cli/test_cleaning_stream.rb +4 -4
  134. data/test/cli/test_cli.rb +3 -3
  135. data/test/cli/test_error_handler.rb +3 -3
  136. data/test/data_sources/test_filesystem.rb +19 -19
  137. data/test/data_sources/test_filesystem_unified.rb +30 -30
  138. data/test/data_sources/test_filesystem_verbose.rb +3 -3
  139. data/test/data_sources/test_static.rb +9 -9
  140. data/test/extra/checking/checks/test_stale.rb +8 -8
  141. data/test/extra/checking/test_check.rb +11 -1
  142. data/test/extra/checking/test_dsl.rb +1 -1
  143. data/test/extra/core_ext/test_enumerable.rb +2 -2
  144. data/test/extra/deployers/test_fog.rb +10 -10
  145. data/test/extra/deployers/test_rsync.rb +2 -2
  146. data/test/extra/test_auto_compiler.rb +28 -28
  147. data/test/extra/test_filesystem_tools.rb +3 -3
  148. data/test/extra/test_link_collector.rb +39 -20
  149. data/test/extra/validators/test_w3c.rb +5 -5
  150. data/test/filters/test_asciidoc.rb +2 -2
  151. data/test/filters/test_bluecloth.rb +1 -1
  152. data/test/filters/test_coffeescript.rb +1 -1
  153. data/test/filters/test_colorize_syntax.rb +20 -13
  154. data/test/filters/test_erb.rb +1 -1
  155. data/test/filters/test_kramdown.rb +1 -1
  156. data/test/filters/test_less.rb +10 -10
  157. data/test/filters/test_markaby.rb +2 -2
  158. data/test/filters/test_maruku.rb +2 -2
  159. data/test/filters/test_pandoc.rb +3 -3
  160. data/test/filters/test_rainpress.rb +4 -4
  161. data/test/filters/test_rdiscount.rb +2 -2
  162. data/test/filters/test_rdoc.rb +1 -1
  163. data/test/filters/test_redcarpet.rb +5 -5
  164. data/test/filters/test_redcloth.rb +5 -5
  165. data/test/filters/test_relativize_paths.rb +33 -31
  166. data/test/filters/test_rubypants.rb +2 -2
  167. data/test/filters/test_sass.rb +8 -8
  168. data/test/filters/test_slim.rb +3 -3
  169. data/test/filters/test_uglify_js.rb +1 -1
  170. data/test/filters/test_yui_compressor.rb +3 -3
  171. data/test/gem_loader.rb +1 -1
  172. data/test/helper.rb +14 -16
  173. data/test/helpers/test_blogging.rb +28 -28
  174. data/test/helpers/test_breadcrumbs.rb +12 -12
  175. data/test/helpers/test_capturing.rb +7 -7
  176. data/test/helpers/test_filtering.rb +16 -16
  177. data/test/helpers/test_link_to.rb +3 -3
  178. data/test/helpers/test_rendering.rb +1 -1
  179. data/test/helpers/test_tagging.rb +11 -11
  180. data/test/helpers/test_xml_sitemap.rb +18 -18
  181. data/test/tasks/test_clean.rb +8 -8
  182. metadata +2 -2
@@ -16,12 +16,12 @@ module Nanoc::Extra
16
16
  def freeze
17
17
  end
18
18
 
19
- def respond_to?(meth, include_all = false)
19
+ def respond_to?(meth, _include_all = false)
20
20
  file_instance_methods.include?(meth.to_sym)
21
21
  end
22
22
 
23
23
  def method_missing(sym, *args, &block)
24
- if !@@deprecation_warning_shown
24
+ unless @@deprecation_warning_shown
25
25
  $stderr.puts 'WARNING: The :file attribute is deprecated and will be removed in a future version of nanoc. Instead of using this :file attribute, consider manually creating a File object when it’s needed, using the :content_filename, :meta_filename or :filename attributes.'
26
26
  @@deprecation_warning_shown = true
27
27
  end
@@ -29,7 +29,7 @@ module Nanoc::Extra
29
29
  File.open(@path, 'r') { |io| io.__send__(sym, *args, &block) }
30
30
  end
31
31
 
32
- private
32
+ private
33
33
 
34
34
  def file_instance_methods
35
35
  @@file_instance_methods ||= Set.new(File.instance_methods.map { |m| m.to_sym })
@@ -35,7 +35,7 @@ EOS
35
35
  end
36
36
 
37
37
  def check_and_warn
38
- return if !defined?(RUBY_ENGINE)
38
+ return unless defined?(RUBY_ENGINE)
39
39
  return if RUBY_ENGINE != 'jruby'
40
40
  return if @warned
41
41
 
@@ -13,7 +13,7 @@ module ::Nanoc::Extra
13
13
  @filter =
14
14
  case mode
15
15
  when nil
16
- lambda { |h| true }
16
+ lambda { |_h| true }
17
17
  when :external
18
18
  lambda { |h| external_href?(h) }
19
19
  when :internal
@@ -36,7 +36,7 @@ module ::Nanoc::Extra
36
36
  end
37
37
 
38
38
  def external_href?(href)
39
- !!(href =~ %r{^(\/\/|[a-z\-]+:)})
39
+ href =~ %r{^(\/\/|[a-z\-]+:)}
40
40
  end
41
41
 
42
42
  def hrefs_in_file(filename)
@@ -47,7 +47,7 @@ module ::Nanoc::Extra
47
47
 
48
48
  # Convert protocol-relative urls
49
49
  # e.g. //example.com => http://example.com
50
- hrefs_in_file.map! { |href| href.gsub /^\/\//, 'http://' }
50
+ hrefs_in_file.map! { |href| href.gsub(/^\/\//, 'http://') }
51
51
 
52
52
  # Strip fragment
53
53
  hrefs_in_file.map! { |href| href.gsub(/#.*$/, '') }
@@ -21,7 +21,7 @@ module Nanoc::Extra
21
21
 
22
22
  # @option [IO] :stdout ($stdout)
23
23
  # @option [IO] :stderr ($stderr)
24
- def initialize(params={})
24
+ def initialize(params = {})
25
25
  @stdout = params.fetch(:stdout, $stdout)
26
26
  @stderr = params.fetch(:stderr, $stderr)
27
27
  end
@@ -43,7 +43,7 @@ module Nanoc::Extra
43
43
  stderr_thread.join
44
44
 
45
45
  exit_status = wait_thr.value
46
- if !exit_status.success?
46
+ unless exit_status.success?
47
47
  raise Error.new(cmd, exit_status.to_i)
48
48
  end
49
49
  end
@@ -27,11 +27,12 @@ module Nanoc::Extra
27
27
  require 'find'
28
28
 
29
29
  # Get compiled files
30
- compiled_files = site.items.map do |item|
30
+ all_raw_paths = site.items.map do |item|
31
31
  item.reps.map do |rep|
32
32
  rep.raw_path
33
33
  end
34
- end.flatten.compact.select { |f| File.file?(f) }
34
+ end
35
+ compiled_files = all_raw_paths.flatten.compact.select { |f| File.file?(f) }
35
36
 
36
37
  # Get present files and dirs
37
38
  present_files = []
@@ -64,7 +65,7 @@ module Nanoc::Extra
64
65
  @exclude.any? { |e| pathname.include_component?(e) }
65
66
  end
66
67
 
67
- protected
68
+ protected
68
69
 
69
70
  def delete_file(file)
70
71
  if @dry_run
@@ -5,7 +5,7 @@ module Nanoc::Extra::Validators
5
5
  # @deprecated Use the Checking API or the `check` command instead
6
6
  class Links
7
7
 
8
- def initialize(dir, index_filenames, params = {})
8
+ def initialize(_dir, _index_filenames, params = {})
9
9
  @include_internal = params.key?(:internal) && params[:internal]
10
10
  @include_external = params.key?(:external) && params[:external]
11
11
  end
@@ -14,7 +14,7 @@ module Nanoc::Extra::Validators
14
14
  checks = []
15
15
  checks << 'ilinks' if options[:internal]
16
16
  checks << 'elinks' if options[:external]
17
- Nanoc::CLI.run [ 'check', checks ].flatten
17
+ Nanoc::CLI.run ['check', checks].flatten
18
18
  end
19
19
 
20
20
  end
@@ -19,7 +19,7 @@ module Nanoc::Extra::Validators
19
19
  raise Nanoc::Errors::GenericTrivial, "unknown type(s) specified: #{types.join(', ')}"
20
20
  end
21
21
 
22
- Nanoc::CLI.run([ 'check', args ].flatten)
22
+ Nanoc::CLI.run(['check', args].flatten)
23
23
  end
24
24
 
25
25
  end
@@ -20,7 +20,7 @@ module Nanoc::Extra
20
20
  # @return [void]
21
21
  #
22
22
  # @abstract
23
- def add(filename)
23
+ def add(_filename)
24
24
  not_implemented('add')
25
25
  end
26
26
 
@@ -33,7 +33,7 @@ module Nanoc::Extra
33
33
  # @return [void]
34
34
  #
35
35
  # @abstract
36
- def remove(filename)
36
+ def remove(_filename)
37
37
  not_implemented('remove')
38
38
  end
39
39
 
@@ -48,15 +48,15 @@ module Nanoc::Extra
48
48
  # @return [void]
49
49
  #
50
50
  # @abstract
51
- def move(src, dst)
51
+ def move(_src, _dst)
52
52
  not_implemented('move')
53
53
  end
54
54
 
55
- private
55
+ private
56
56
 
57
57
  def not_implemented(name)
58
58
  raise NotImplementedError.new(
59
- "#{self.class} does not override ##{name}, which is required for " +
59
+ "#{self.class} does not override ##{name}, which is required for " \
60
60
  'this data source to be used.'
61
61
  )
62
62
  end
@@ -6,7 +6,7 @@ module Nanoc::Extra::VCSes
6
6
  class Dummy < Nanoc::Extra::VCS
7
7
 
8
8
  # @see Nanoc::Extra::VCS#add
9
- def add(filename)
9
+ def add(_filename)
10
10
  end
11
11
 
12
12
  # @see Nanoc::Extra::VCS#remove
@@ -11,7 +11,7 @@ module Nanoc::Filters
11
11
  # @param [String] content The content to filter
12
12
  #
13
13
  # @return [String] The filtered content
14
- def run(content, params = {})
14
+ def run(content, _params = {})
15
15
  stdout = StringIO.new
16
16
  stderr = $stderr
17
17
  piper = Nanoc::Extra::Piper.new(:stdout => stdout, :stderr => stderr)
@@ -11,7 +11,7 @@ module Nanoc::Filters
11
11
  # @param [String] content The content to filter
12
12
  #
13
13
  # @return [String] The filtered content
14
- def run(content, params = {})
14
+ def run(content, _params = {})
15
15
  ::BlueCloth.new(content).to_html
16
16
  end
17
17
 
@@ -13,7 +13,7 @@ module Nanoc::Filters
13
13
  # @param [String] content The CoffeeScript content to turn into JavaScript
14
14
  #
15
15
  # @return [String] The resulting JavaScript
16
- def run(content, params = {})
16
+ def run(content, _params = {})
17
17
  ::CoffeeScript.compile(content)
18
18
  end
19
19
 
@@ -159,18 +159,16 @@ module Nanoc::Filters
159
159
  #
160
160
  # @api private
161
161
  def parse(content, klass, is_fullpage)
162
- begin
163
- if is_fullpage
164
- klass.parse(content, nil, 'UTF-8')
165
- else
166
- klass.fragment(content)
167
- end
168
- rescue => e
169
- if e.message =~ /can't modify frozen string/
170
- parse(content.dup, klass, is_fullpage)
171
- else
172
- raise e
173
- end
162
+ if is_fullpage
163
+ klass.parse(content, nil, 'UTF-8')
164
+ else
165
+ klass.fragment(content)
166
+ end
167
+ rescue => e
168
+ if e.message =~ /can't modify frozen string/
169
+ parse(content.dup, klass, is_fullpage)
170
+ else
171
+ raise e
174
172
  end
175
173
  end
176
174
 
@@ -199,7 +197,7 @@ module Nanoc::Filters
199
197
  #
200
198
  # @return [String] The colorized output, which is identical to the input
201
199
  # in this case
202
- def dummy(code, language, params = {})
200
+ def dummy(code, _language, _params = {})
203
201
  code
204
202
  end
205
203
 
@@ -221,7 +219,7 @@ module Nanoc::Filters
221
219
  params[:encoding] ||= 'utf-8'
222
220
  params[:nowrap] ||= 'True'
223
221
 
224
- cmd = [ 'pygmentize', '-l', language, '-f', 'html' ]
222
+ cmd = ['pygmentize', '-l', language, '-f', 'html']
225
223
  cmd << '-O' << params.map { |k, v| "#{k}=#{v}" }.join(',') unless params.empty?
226
224
 
227
225
  stdout = StringIO.new
@@ -276,8 +274,8 @@ module Nanoc::Filters
276
274
  def simon_highlight(code, language, params = {})
277
275
  check_availability('highlight', '--version')
278
276
 
279
- cmd = [ 'highlight', '--syntax', language, '--fragment' ]
280
- params.each do |key, value|
277
+ cmd = ['highlight', '--syntax', language, '--fragment']
278
+ params.each do |key, _value|
281
279
  if SIMON_HIGHLIGHT_OPT_MAP[key]
282
280
  cmd << SIMON_HIGHLIGHT_OPT_MAP[key]
283
281
  else
@@ -298,7 +296,7 @@ module Nanoc::Filters
298
296
  end
299
297
 
300
298
  # Wraps the element in <div class="CodeRay"><div class="code">
301
- def coderay_postprocess(language, element)
299
+ def coderay_postprocess(_language, element)
302
300
  # Skip if we're a free <code>
303
301
  return if element.parent.nil?
304
302
 
@@ -345,7 +343,7 @@ module Nanoc::Filters
345
343
  # After:
346
344
  #
347
345
  # <pre><code class="language-ruby highlight">
348
- def rouge_postprocess(language, element)
346
+ def rouge_postprocess(_language, element)
349
347
  return if element.name != 'pre'
350
348
 
351
349
  code1 = element.xpath('code').first
@@ -354,12 +352,12 @@ module Nanoc::Filters
354
352
  return if code2.nil?
355
353
 
356
354
  code1.inner_html = code2.inner_html
357
- code1['class'] = [ code1['class'], code2['class'] ].compact.join(' ')
355
+ code1['class'] = [code1['class'], code2['class']].compact.join(' ')
358
356
  end
359
357
 
360
- protected
358
+ protected
361
359
 
362
- KNOWN_COLORIZERS = [ :coderay, :dummy, :pygmentize, :pygmentsrb, :simon_highlight, :rouge ]
360
+ KNOWN_COLORIZERS = [:coderay, :dummy, :pygmentize, :pygmentsrb, :simon_highlight, :rouge]
363
361
 
364
362
  # Removes the first blank lines and any whitespace at the end.
365
363
  def strip(s)
@@ -18,7 +18,7 @@ module Nanoc::Filters
18
18
  # @param [String] content The content to filter
19
19
  #
20
20
  # @return [String] The filtered content
21
- def run(content, params = {})
21
+ def run(content, _params = {})
22
22
  # Create context
23
23
  context = ::Nanoc::Context.new(assigns)
24
24
 
@@ -15,7 +15,7 @@ module Nanoc::Filters
15
15
  # @param [String] content The content to filter
16
16
  #
17
17
  # @return [String] The filtered content
18
- def run(content, params = {})
18
+ def run(content, _params = {})
19
19
  context = item.attributes.dup
20
20
  context[:item] = assigns[:item].attributes
21
21
  context[:config] = assigns[:config]
@@ -30,7 +30,7 @@ module Nanoc::Filters
30
30
  if imported_pathname.relative?
31
31
  imported_pathname = current_dir_pathname + imported_pathname
32
32
  end
33
- next if !imported_pathname.exist?
33
+ next unless imported_pathname.exist?
34
34
  imported_filename = imported_pathname.realpath
35
35
 
36
36
  # Find matching item
@@ -44,7 +44,7 @@ module Nanoc::Filters
44
44
  depend_on(imported_items)
45
45
 
46
46
  # Add filename to load path
47
- paths = [ File.dirname(@item[:content_filename]) ]
47
+ paths = [File.dirname(@item[:content_filename])]
48
48
  parser = ::Less::Parser.new(:paths => paths)
49
49
  parser.parse(content).to_css params
50
50
  end
@@ -11,7 +11,7 @@ module Nanoc::Filters
11
11
  # @param [String] content The content to filter
12
12
  #
13
13
  # @return [String] The filtered content
14
- def run(content, params = {})
14
+ def run(content, _params = {})
15
15
  # Get result
16
16
  ::Markaby::Builder.new(assigns).instance_eval(content).to_s
17
17
  end
@@ -14,7 +14,7 @@ module Nanoc::Filters
14
14
  # @param [String] content The content to filter
15
15
  #
16
16
  # @return [String] The filtered content
17
- def run(content, params = {})
17
+ def run(content, _params = {})
18
18
  context = item.attributes.merge({ :yield => assigns[:content] })
19
19
  ::Mustache.render(content, context)
20
20
  end
@@ -16,7 +16,7 @@ module Nanoc::Filters
16
16
  # @param [String] content The content to filter
17
17
  #
18
18
  # @return [String] The filtered content
19
- def run(content, params = {})
19
+ def run(content, _params = {})
20
20
  options = ::RDoc::Options.new
21
21
  to_html = ::RDoc::Markup::ToHtml.new(options)
22
22
  ::RDoc::Markup.new.convert(content, to_html)
@@ -6,7 +6,7 @@ module Nanoc::Filters
6
6
  require 'nanoc/helpers/link_to'
7
7
  include Nanoc::Helpers::LinkTo
8
8
 
9
- SELECTORS = [ '*/@href', '*/@src', 'object/@data', 'param[@name="movie"]/@content', 'comment()' ]
9
+ SELECTORS = ['*/@href', '*/@src', 'object/@data', 'param[@name="movie"]/@content', 'comment()']
10
10
 
11
11
  # Relativizes all paths in the given content, which can be HTML, XHTML, XML
12
12
  # or CSS. This filter is quite useful if a site needs to be hosted in a
@@ -63,13 +63,13 @@ module Nanoc::Filters
63
63
  nokogiri_process(content, selectors, namespaces, klass, params[:type])
64
64
  else
65
65
  raise RuntimeError.new(
66
- 'The relativize_paths needs to know the type of content to ' +
67
- 'process. Pass a :type to the filter call (:html for HTML, ' +
66
+ 'The relativize_paths needs to know the type of content to ' \
67
+ 'process. Pass a :type to the filter call (:html for HTML, ' \
68
68
  ':xhtml for XHTML, :xml for XML, or :css for CSS).')
69
69
  end
70
70
  end
71
71
 
72
- protected
72
+ protected
73
73
 
74
74
  def nokogiri_process(content, selectors, namespaces, klass, type)
75
75
  # Ensure that all prefixes are strings
@@ -80,7 +80,7 @@ module Nanoc::Filters
80
80
  doc.xpath(selector, namespaces).each do |node|
81
81
  if node.name == 'comment'
82
82
  content = node.content.dup
83
- content = content.sub(%r{^(\s*\[.+?\]>\s*)(.+?)(\s*<!\[endif\])}m) do |m|
83
+ content = content.sub(%r{^(\s*\[.+?\]>\s*)(.+?)(\s*<!\[endif\])}m) do |_m|
84
84
  fragment = nokogiri_process($2, selectors, namespaces, klass, type)
85
85
  $1 + fragment + $3
86
86
  end
@@ -11,7 +11,7 @@ module Nanoc::Filters
11
11
  # @param [String] content The content to filter
12
12
  #
13
13
  # @return [String] The filtered content
14
- def run(content, params = {})
14
+ def run(content, _params = {})
15
15
  # Get result
16
16
  ::RubyPants.new(content).to_html
17
17
  end
@@ -12,7 +12,7 @@ class ::Sass::Importers::Filesystem
12
12
  # Create dependency
13
13
  filter = options[:nanoc_current_filter]
14
14
  item = filter.imported_filename_to_item(full_filename)
15
- filter.depend_on([ item ]) unless item.nil?
15
+ filter.depend_on([item]) unless item.nil?
16
16
 
17
17
  # Call original _find
18
18
  _orig_find(dir, name, options)
@@ -13,7 +13,7 @@ module Nanoc::Filters
13
13
  # @param [String] content The content to filter
14
14
  #
15
15
  # @return [String] The filtered content
16
- def run(content, params = {})
16
+ def run(content, _params = {})
17
17
  # Get result
18
18
  ::Typogruby.improve(content)
19
19
  end
@@ -33,7 +33,7 @@ module Nanoc::Filters
33
33
  # `xsl:param` elements.
34
34
  #
35
35
  # @return [String] The transformed content
36
- def run(content, params = {})
36
+ def run(_content, params = {})
37
37
  Nanoc::Extra::JRubyNokogiriWarner.check_and_warn
38
38
 
39
39
  if assigns[:layout].nil?
@@ -87,7 +87,7 @@ module Nanoc::Helpers
87
87
  buffer
88
88
  end
89
89
 
90
- protected
90
+ protected
91
91
 
92
92
  def sorted_relevant_articles
93
93
  relevant_articles.sort_by do |a|
@@ -132,8 +132,8 @@ module Nanoc::Helpers
132
132
  root_url = @site.config[:base_url] + '/'
133
133
 
134
134
  # Add primary attributes
135
- xml.id root_url
136
- xml.title title
135
+ xml.id root_url
136
+ xml.title title
137
137
 
138
138
  # Add date
139
139
  xml.updated(attribute_to_time(last_article[:created_at]).to_iso8601_time)
@@ -144,8 +144,8 @@ module Nanoc::Helpers
144
144
 
145
145
  # Add author information
146
146
  xml.author do
147
- xml.name author_name
148
- xml.uri author_uri
147
+ xml.name author_name
148
+ xml.uri author_uri
149
149
  end
150
150
 
151
151
  # Add icon and logo
@@ -166,18 +166,18 @@ module Nanoc::Helpers
166
166
 
167
167
  xml.entry do
168
168
  # Add primary attributes
169
- xml.id atom_tag_for(a)
170
- xml.title a[:title], :type => 'html'
169
+ xml.id atom_tag_for(a)
170
+ xml.title a[:title], :type => 'html'
171
171
 
172
172
  # Add dates
173
173
  xml.published attribute_to_time(a[:created_at]).to_iso8601_time
174
- xml.updated attribute_to_time(a[:updated_at] || a[:created_at]).to_iso8601_time
174
+ xml.updated attribute_to_time(a[:updated_at] || a[:created_at]).to_iso8601_time
175
175
 
176
176
  # Add specific author information
177
177
  if a[:author_name] || a[:author_uri]
178
178
  xml.author do
179
- xml.name a[:author_name] || author_name
180
- xml.uri a[:author_uri] || author_uri
179
+ xml.name a[:author_name] || author_name
180
+ xml.uri a[:author_uri] || author_uri
181
181
  end
182
182
  end
183
183
 
@@ -186,8 +186,8 @@ module Nanoc::Helpers
186
186
 
187
187
  # Add content
188
188
  summary = excerpt_proc.call(a)
189
- xml.content content_proc.call(a), :type => 'html'
190
- xml.summary summary, :type => 'html' unless summary.nil?
189
+ xml.content content_proc.call(a), :type => 'html'
190
+ xml.summary summary, :type => 'html' unless summary.nil?
191
191
  end
192
192
  end
193
193