html-proofer 5.0.10 → 5.1.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: 6ecfce010632739b71710eb8b6c91b8ca6ca4828e2b6e7df254c2cc6b00462a4
4
- data.tar.gz: 50d19f3c6145d6184dc5d463cfde6684d609f797277b437103bf8114387d8570
3
+ metadata.gz: fd5f97da4b4c9537822e31a821d41bcb04ea8eff97a5331d297ecb898ccd0630
4
+ data.tar.gz: 8d3df0b4bb5812e5aaa20907314bceef819134f56f55ad081776edc96e5406a7
5
5
  SHA512:
6
- metadata.gz: 92253a2948b3492043b548c1ae3ccf23dc66e9da5dd14bdf6724e9c6f377ce53960fa4b689390d4242e1cd3090773b3de0caba8550a61cebde932564a2811a4d
7
- data.tar.gz: 8c9ad6f1cdd747241d46e06ff444f84d7de7a73f6ae71b8b9e73406e11ad8748bf29ff3db3d837e7535ddb4c235e87f5b52b8999992811ae87e2dc00bbd96a76
6
+ metadata.gz: 8c65b869c013635c247c7235b3680d6c2ab99cc99c39eff43140a6ff8884f63bf70f3c625042d0a2124cf0e7b7bd36053c240cd1101ca768089657bb8b4fc17d
7
+ data.tar.gz: 239211f870b13baeb8c3f337005158c055c1dd53f5513092243c2d8548b5105e974a0472db85fc93e97bf91a83ad10c36d505ad778a5395030651a6e8a5d9199
@@ -133,8 +133,9 @@ module HTMLProofer
133
133
  path_with_extension # existence checked implicitly by File.file?
134
134
  # implicit index support
135
135
  elsif File.directory?(path_to_resolve) && !unslashed_directory?(path_to_resolve)
136
- path_with_index = File.join(path_to_resolve, @runner.options[:directory_index_file])
137
- path_with_index if File.file?(path_with_index)
136
+ @runner.options[:directory_index_files]
137
+ .map { |dif| File.join(path_to_resolve, dif) }
138
+ .find { |path_with_index| File.file?(path_with_index) }
138
139
  # explicit file or directory
139
140
  elsif File.exist?(path_to_resolve)
140
141
  path_to_resolve
@@ -34,9 +34,9 @@ module HTMLProofer
34
34
  setup_cache!(options)
35
35
 
36
36
  @external_timeframe = parsed_timeframe(options[:timeframe][:external])
37
- define_singleton_method(:external_enabled?) { !@external_timeframe.nil? }
37
+ define_singleton_method(:external_enabled?) { !@external_timeframe.nil? } # rubocop:disable ThreadSafety/ClassInstanceVariable
38
38
  @internal_timeframe = parsed_timeframe(options[:timeframe][:internal])
39
- define_singleton_method(:internal_enabled?) { !@internal_timeframe.nil? }
39
+ define_singleton_method(:internal_enabled?) { !@internal_timeframe.nil? } # rubocop:disable ThreadSafety/ClassInstanceVariable
40
40
  end
41
41
  end
42
42
 
@@ -13,7 +13,7 @@ module HTMLProofer
13
13
  check_external_hash: true,
14
14
  check_internal_hash: true,
15
15
  checks: DEFAULT_TESTS,
16
- directory_index_file: "index.html",
16
+ directory_index_files: ["index.html"],
17
17
  disable_external: false,
18
18
  ignore_empty_alt: true,
19
19
  ignore_empty_mailto: false,
@@ -47,6 +47,12 @@ module HTMLProofer
47
47
 
48
48
  class << self
49
49
  def generate_defaults(opts)
50
+ # If `:directory_index_file` (singular) is given, convert it into an
51
+ # array for `:directory_index_files` (plural) instead.
52
+ if opts.key?(:directory_index_file)
53
+ opts[:directory_index_files] = [opts.delete(:directory_index_file)]
54
+ end
55
+
50
56
  options = PROOFER_DEFAULTS.merge(opts)
51
57
 
52
58
  options[:typhoeus] = HTMLProofer::Configuration::TYPHOEUS_DEFAULTS.merge(opts[:typhoeus] || {})
@@ -89,6 +95,10 @@ module HTMLProofer
89
95
  @options[long_opt_symbol] = arg
90
96
  end
91
97
 
98
+ set_option(opts, "--directory-index-files [FILENAME1,FILENAME2,...]") do |long_opt_symbol, list|
99
+ @options[long_opt_symbol] = list.nil? ? [] : list.split(",")
100
+ end
101
+
92
102
  set_option(opts, "--extensions [EXT1,EXT2,...]") do |long_opt_symbol, list|
93
103
  @options[long_opt_symbol] = list.nil? ? [] : list.split(",")
94
104
  end
@@ -285,6 +295,7 @@ module HTMLProofer
285
295
  "to allow extensionless URLs (as supported by most servers) (default: `.html`).",
286
296
  ],
287
297
  directory_index_file: ["Sets the file to look for when a link refers to a directory. (default: `index.html`)."],
298
+ directory_index_files: ["Sets the files to look for when a link refers to a directory. (default: `[\"index.html\"]`)."],
288
299
  extensions: [
289
300
  "A comma-separated list of Strings indicating the file extensions you",
290
301
  "would like to check (default: `.html`)",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTMLProofer
4
- VERSION = "5.0.10"
4
+ VERSION = "5.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-proofer
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.10
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-21 00:00:00.000000000 Z
11
+ date: 2025-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable