html-proofer 5.2.0 → 5.2.1

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: 03f01340b8aebd3ccad6d82ab5aef056991f91bae04498df5091b3c7e9e6641f
4
- data.tar.gz: 3dda407dc70dc4d6d65ac88f6b3474e091832c3b37bc70d3bc74e8fdc4d136db
3
+ metadata.gz: 9883d35b171b2912cb327e9360f7ff63fcecaaff8cafa44c04eb7ba38c2ea226
4
+ data.tar.gz: '009a17164398c5bfd6456d6c0235e8606cd9bc98602ac392e11269e49574867e'
5
5
  SHA512:
6
- metadata.gz: f652269525122a2199b373be5f19a3a93541f14e14539621f207605f5e346cf2cd34fe68cea4ed6e86236f37e69e5f1db709c68fab71816847b20248acb487a3
7
- data.tar.gz: 487828db630f2916ab417d8d9d3cecbd8aa96a5140ee3695d2c49b589f3d8f286bcb9fef964bf517f08286e35500dfc6c0a1119f2f83d22d9f0a6653ad3a3c8d
6
+ metadata.gz: 02ba6094a5a0516d6452b72d898be194cc1c2ace2779e6c21b688116b2335dd55704c78ba614cac7d5aab56fa0557b18e82fb0c1d0f084954bc012de584f52e3
7
+ data.tar.gz: 0cf8697a7bb36c0213ee62596323e21679d0bc679315aee33ab521bea8675f13d8a2adf3a9f8be7284fd488686629b9e18b2fbcbafc7b59b88d424daa063b50e
@@ -200,7 +200,7 @@ module HTMLProofer
200
200
  end
201
201
 
202
202
  def failed_checks
203
- @reporter.failures.flatten.select { |f| f.is_a?(Failure) }
203
+ @reporter.failures.flatten.grep(Failure)
204
204
  end
205
205
 
206
206
  def report_failed_checks
@@ -116,10 +116,13 @@ module HTMLProofer
116
116
  return true if blank?(href_hash)
117
117
  return true unless @runner.options[:check_internal_hash]
118
118
 
119
- # prevents searching files we didn't ask about
120
- return false unless url.known_extension?
119
+ # For hash links, we need to defer to file-based checking
120
+ # (even if URL doesn't have extension, it may resolve to index.html)
121
121
  return false unless url.has_hash?
122
122
 
123
+ # If URL has no known extension, defer to file-based checking
124
+ return false unless url.known_extension?
125
+
123
126
  decoded_href_hash = Addressable::URI.unescape(href_hash)
124
127
  fragment_ids = [href_hash, decoded_href_hash]
125
128
  # https://www.w3.org/TR/html5/single-page.html#scroll-to-fragid
@@ -134,10 +137,18 @@ module HTMLProofer
134
137
 
135
138
  private def find_fragments(fragment_ids, html)
136
139
  xpaths = fragment_ids.uniq.flat_map do |frag_id|
137
- escaped_frag_id = "'#{frag_id.split("'").join("', \"'\", '")}', ''"
140
+ # Build XPath string argument, handling single quotes
141
+ if frag_id.include?("'")
142
+ # Use concat() to handle single quotes: concat('part1', "'", 'part2')
143
+ escaped_frag_id = frag_id.split("'").map { |part| "'#{part}'" }.join(", \"'\", ")
144
+ xpath_arg = "concat(#{escaped_frag_id})"
145
+ else
146
+ # No single quotes, just use quoted string
147
+ xpath_arg = "'#{frag_id}'"
148
+ end
138
149
  [
139
- "//*[case_sensitive_equals(@id, concat(#{escaped_frag_id}))]",
140
- "//*[case_sensitive_equals(@name, concat(#{escaped_frag_id}))]",
150
+ "//*[case_sensitive_equals(@id, #{xpath_arg})]",
151
+ "//*[case_sensitive_equals(@name, #{xpath_arg})]",
141
152
  ]
142
153
  end
143
154
  xpaths << XpathFunctions.new
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTMLProofer
4
- VERSION = "5.2.0"
4
+ VERSION = "5.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-proofer
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen Torikian
@@ -234,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
234
  - !ruby/object:Gem::Version
235
235
  version: '0'
236
236
  requirements: []
237
- rubygems_version: 4.0.3
237
+ rubygems_version: 4.0.6
238
238
  specification_version: 4
239
239
  summary: A set of tests to validate your HTML output. These tests check if your image
240
240
  references are legitimate, if they have alt tags, if your internal links are working,