mkwebook 0.1.6 → 0.1.7
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/mkwebook/app.rb +1 -0
- data/lib/mkwebook/ext/string.rb +4 -0
- data/lib/mkwebook/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0f8fc12f211be95d5f471f231318136663987e920e2dfd1345118d68eb0bc420
|
|
4
|
+
data.tar.gz: ec4a088bd415a554c232a85692eba1e1983d4bf75941be8f5a8a76b6578f99b3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ed276076ec77a9ed76386232f77282c350ae206fa2b7d477274dc3cfe460817fcf33c9f5e05c7ed4493333df001cfaa9f81dcfcc8bab524caeecadeb04c1037
|
|
7
|
+
data.tar.gz: 55830b7666568be18a1cdcce720d701c9e33a2121c4e568b1656fca303c71b82911dc3ecf4bd8d4233af64f85bb27b6e7b6c540f2963eec8ef627c300ea38d6e
|
data/Gemfile.lock
CHANGED
data/lib/mkwebook/app.rb
CHANGED
|
@@ -170,6 +170,7 @@ module Mkwebook
|
|
|
170
170
|
element.css('a').each do |a|
|
|
171
171
|
u = a.evaluate('this.href') rescue nil
|
|
172
172
|
next unless u.present?
|
|
173
|
+
next unless u =~ /^https?:\/\//
|
|
173
174
|
href = u.normalize_uri('.html').relative_path_from(url.normalize_uri('.html'))
|
|
174
175
|
file = u.normalize_file_path('.html')
|
|
175
176
|
a.evaluate <<~JS
|
data/lib/mkwebook/ext/string.rb
CHANGED
|
@@ -16,6 +16,8 @@ class String
|
|
|
16
16
|
def normalize_file_path(force_extname = nil)
|
|
17
17
|
return self unless present?
|
|
18
18
|
uri = URI.parse(self)
|
|
19
|
+
return unless uri.scheme.in? %w(http https)
|
|
20
|
+
return unless uri.path.present?
|
|
19
21
|
file_path = uri.path[1..]
|
|
20
22
|
extname = force_extname || File.extname(file_path)
|
|
21
23
|
basename = File.basename(file_path, extname)
|
|
@@ -27,6 +29,8 @@ class String
|
|
|
27
29
|
def normalize_uri(force_extname = nil)
|
|
28
30
|
return self unless present?
|
|
29
31
|
uri = URI.parse(self)
|
|
32
|
+
return unless uri.scheme.in? %w(http https)
|
|
33
|
+
return unless uri.path.present?
|
|
30
34
|
file_path = uri.path[1..]
|
|
31
35
|
extname = force_extname || File.extname(file_path)
|
|
32
36
|
basename = File.basename(file_path, extname)
|
data/lib/mkwebook/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mkwebook
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Liu Xiang
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2022-12-
|
|
11
|
+
date: 2022-12-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|