parsergem 0.1.4 → 0.1.5
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/generators/parser_gem/test_generator.rb +12 -6
- data/lib/parser/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: 1c67a1e4c1a13b6a1c35f10515c9702ce67dffeffcdda47635963651898b9ba7
|
4
|
+
data.tar.gz: 36d4878138bd20771f7070c383d6a313c62019387b35a03a92f752c7678f26ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5ca9227f970cf96745a02aa68d182b82d5406c11d41881a2327977537b16b67fbf5fd9df4a90160f06c099a9eb2886a10e7810f187f725572389155f998c4b0
|
7
|
+
data.tar.gz: 0b17f6205514180431687ac4efd2f9d02749b82924fb5af546e9c39fb5f7ea4530679b31f0a0adfdc65c019ed61827d228ba14e482cb0018503549b2a6461619
|
data/Gemfile.lock
CHANGED
@@ -28,9 +28,7 @@ module ParserGem
|
|
28
28
|
def clone # Main method
|
29
29
|
sitemap = Nokogiri::XML(URI.open("http://#{options[:target_url]}/sitemap.xml")) # Load sitemap.xml
|
30
30
|
controller_name = options[:target_url].split('/').last.delete('.').delete('-') # Set controller name from clear domain name
|
31
|
-
actions = set_actions(sitemap)
|
32
|
-
|
33
|
-
puts options[:to_partials_blocks_ids].to_s
|
31
|
+
actions = set_actions(sitemap)
|
34
32
|
|
35
33
|
actions.each do |action| # Create routes
|
36
34
|
if action[:rails_route] == '/'
|
@@ -244,7 +242,7 @@ module ParserGem
|
|
244
242
|
|
245
243
|
body.css('a').each do |link| # Self absolute links to media repair
|
246
244
|
if link['href']
|
247
|
-
if link['href'].include?("http://#{options[:target_url]}") && (link['href'].include?('.png') || link['href'].include?('.jpg') || link['href'].include?('.jpeg') || link['href'].include?('.webp'))
|
245
|
+
if link['href'].include?("http://#{options[:target_url]}") && (link['href'].include?('.png') || link['href'].include?('.jpg') || link['href'].include?('.jpeg') || link['href'].include?('.webp') || link['href'].include?('.pdf'))
|
248
246
|
link['href'] = download_media(link['href'], controller_name)
|
249
247
|
end
|
250
248
|
end
|
@@ -276,8 +274,8 @@ module ParserGem
|
|
276
274
|
if action[:lang]
|
277
275
|
body.css('a').each do |link| # Repair links for lang versions
|
278
276
|
if link['href']
|
279
|
-
if !link['href'].include?('http') && !link['href'].include?('mailto:') && !link['href'].include?('tel:')
|
280
|
-
if link['href'][0] == '/'
|
277
|
+
if !link['href'].include?('http') && !link['href'].include?('mailto:') && !link['href'].include?('tel:') && !link['href'].include?('.jpg') && !link['href'].include?('.jpeg') && !link['href'].include?('.png') && !link['href'].include?('.webp') && !link['href'].include?('.pdf')
|
278
|
+
if link['href'][0] == '/'
|
281
279
|
link['href'] = "/#{action[:lang]}#{link['href']}"
|
282
280
|
else
|
283
281
|
link['href'] = "/#{action[:lang]}/#{link['href']}"
|
@@ -311,6 +309,14 @@ module ParserGem
|
|
311
309
|
end
|
312
310
|
end
|
313
311
|
|
312
|
+
if action[:lang]
|
313
|
+
body.css('img, video').each do |tag|
|
314
|
+
if tag['title'] && tag['title'].length > 2
|
315
|
+
tag['title'] = translate(tag['title'], action[:lang], client)
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
314
320
|
file.puts body.to_s.gsub(/(<%|%>)/) {|x| x=='<%' ? '<%' : '%>'} # Put edited body to view file, and repair ERB tags
|
315
321
|
end
|
316
322
|
repair_css(file_path, controller_name) # Repair links in inline css
|
data/lib/parser/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parsergem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Дмитрий Герасименко
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-05-
|
11
|
+
date: 2023-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|