nokogiri-html-ext 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/nokogiri/html_ext/document.rb +12 -4
- data/lib/nokogiri/html_ext/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63aafc92d00db444d3e8d3ec92817ef8246bd8dd7d66d7d3540d9aac2f55f96b
|
4
|
+
data.tar.gz: 904f44d50a9fb46c6383abb3e902c1a4166763778c1fe469696cff96c9d1c8a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 932fbeed6638155ec3033405ea43bf33f9b513e4e2b129ed62c8ef86b483e942ad894421de908e0a1077dd118383faf609b9da4c974a7a4c8a9ef2678ce3436e
|
7
|
+
data.tar.gz: 073d5a3983516d0bdfd68347ec42474d5c128cef1d7cf5170340d4eea24d334b10dbe5d39acd2fd5462ea1ac3da9b79031d2731db6ea5ad2c8b2fdadcba221b3
|
data/CHANGELOG.md
CHANGED
@@ -69,13 +69,13 @@ module Nokogiri
|
|
69
69
|
#
|
70
70
|
# @return [String]
|
71
71
|
def resolve_relative_url(url)
|
72
|
-
|
73
|
-
|
74
|
-
uri_parser.unescape(
|
75
|
-
uri_parser.join(*[document.url.strip, base_href, url_str].compact.map { |u| uri_parser.escape(u) })
|
72
|
+
unescape(
|
73
|
+
uri_parser.join(*[document.url.strip, base_href, unescape(url)].compact.map { |u| escape(u) })
|
76
74
|
.normalize
|
77
75
|
.to_s
|
78
76
|
)
|
77
|
+
rescue URI::InvalidComponentError, URI::InvalidURIError
|
78
|
+
unescape(url)
|
79
79
|
end
|
80
80
|
|
81
81
|
# Convert the document's relative URLs to absolute URLs.
|
@@ -99,6 +99,10 @@ module Nokogiri
|
|
99
99
|
|
100
100
|
private
|
101
101
|
|
102
|
+
def escape(url)
|
103
|
+
uri_parser.escape(url.to_s)
|
104
|
+
end
|
105
|
+
|
102
106
|
def resolve_relative_urls_for(attributes_map)
|
103
107
|
attributes_map.each do |attribute, names|
|
104
108
|
xpaths = names.map { |name| "//#{name}[@#{attribute}]" }
|
@@ -109,6 +113,10 @@ module Nokogiri
|
|
109
113
|
end
|
110
114
|
end
|
111
115
|
|
116
|
+
def unescape(url)
|
117
|
+
uri_parser.unescape(url.to_s)
|
118
|
+
end
|
119
|
+
|
112
120
|
def uri_parser
|
113
121
|
@uri_parser ||= URI::DEFAULT_PARSER
|
114
122
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri-html-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Garber
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -44,7 +44,7 @@ licenses:
|
|
44
44
|
- MIT
|
45
45
|
metadata:
|
46
46
|
bug_tracker_uri: https://github.com/jgarber623/nokogiri-html-ext/issues
|
47
|
-
changelog_uri: https://github.com/jgarber623/nokogiri-html-ext/blob/v0.2.
|
47
|
+
changelog_uri: https://github.com/jgarber623/nokogiri-html-ext/blob/v0.2.1/CHANGELOG.md
|
48
48
|
rubygems_mfa_required: 'true'
|
49
49
|
post_install_message:
|
50
50
|
rdoc_options: []
|