nokorexi 0.5.4 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9aadf6b4ed40438741d8cb72269370725384600daa5554606e40a6c680a4be84
4
- data.tar.gz: f70f28a7e8e55249a16e1b0d983dd1177a2fcae1b9135081d4b3f8cc116f8a76
3
+ metadata.gz: 25605bfc0ee4f888df2d747607d7f36686b53936719a25583a5e363376aecae2
4
+ data.tar.gz: 69a07ae4c77dcd9abc99a6daf37eef062e3c0ebea6dd96eee68fcc6c6cf4cd0c
5
5
  SHA512:
6
- metadata.gz: 50dbae2b1ad4d0448cbe22ad96e86c21c48deb2dea1a67f32071390ba4281c60d4598114146f2e7955491b78da6d7a6a4c867bc14f6b3c64956c99daf7479fa4
7
- data.tar.gz: 810d8692f1cb9baa0e9d3495f5bdbdbd05c1943b657319e9413d9e35bd45662aa8df2fdebf0685c1a10a96b7b77d6eec6a5fdfde8559b92d405676d85352024f
6
+ metadata.gz: d008d96bc2796177243535e371aa7de407ffd9711deb633f3606c802a68ad9474fe1e27679326adae42291b8ffef9563e1e52bb2cb41d95248de279369a59cd1
7
+ data.tar.gz: 0ad62669fadf9ec315a333974f35ff7c7ddb407ad7a67bac61e30ec843c1fca49766bb5480002c88ccc5f780c9953ae0a59a10d76ab75bf77ddeaf9dc4a66f2a
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/nokorexi.rb CHANGED
@@ -11,14 +11,29 @@ class Nokorexi
11
11
 
12
12
  attr_reader :to_doc, :to_s
13
13
 
14
- def initialize(x, noscript: true, debug: false)
14
+ def initialize(x, noscript: true, noevents: true, nosvg: true, debug: false)
15
15
 
16
16
  raws = RXFHelper.read(x).first
17
17
  s = raws[/.*<\/html>$/m] || raws
18
18
  puts 's: ' + s.inspect if debug
19
19
 
20
20
  raw_doc = Nokogiri::HTML(s.gsub("&nbsp;",' '))
21
+ raw_doc.xpath('//style').each(&:remove)
22
+ raw_doc.xpath('//link').each(&:remove)
21
23
  raw_doc.xpath('//script').each(&:remove) if noscript
24
+ raw_doc.xpath('//svg').each(&:remove) if nosvg
25
+
26
+ if noevents then
27
+
28
+ raw_doc.xpath('//*[@onclick]').each do |e|
29
+ e.attributes['onclick'].value = ''
30
+ end
31
+
32
+ raw_doc.xpath('//*[@onmousedown]').each do |e|
33
+ e.attributes['onmousedown'].value = ''
34
+ end
35
+ end
36
+
22
37
  yield(raw_doc) if block_given?
23
38
 
24
39
  @to_s = xml = raw_doc.xpath('html').to_xml
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokorexi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  IfE+n6Nsn4mmYcgqnR+5A8Ut2JnVTJzYZ/lUeIJY3MPjH+7PDAtWb1HltA/iim3A
36
36
  28fDHFSeSGWneCQs80GLobdt
37
37
  -----END CERTIFICATE-----
38
- date: 2022-01-23 00:00:00.000000000 Z
38
+ date: 2022-01-24 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: nokogiri
metadata.gz.sig CHANGED
Binary file