validate-website 1.11.0 → 1.12.0

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: f63d4c84f653035be69262c33ccad0025c48013492b653882a803f7d110e717f
4
- data.tar.gz: fdf8e994af98a8dbff7411dd480b88f759009a70b5b5c1fcde15120b5db1ad02
3
+ metadata.gz: e75c6ffc6e4b8087ecdeff96f028c95aec4d7a145f36e8b7f1290aac2958a711
4
+ data.tar.gz: 8e57b037034aa7e20cbba2f420f478dd66bb362b40a592a6d8c375994144fd64
5
5
  SHA512:
6
- metadata.gz: 6b0774aaab6ca32e10d43cfc0dd6c57219cc9e3862af5febd892a30884920195512301f702e5af11459a55c8dde4eaa4238a09833b102924a8ca36c9deb8480f
7
- data.tar.gz: c0cdf68b1486c2d15257d7fb07e8561f52054b5a234e46162a468b1ffdc6bbc26905563150ccab3053e78a15a70c59142a857afa1aaff7563a22279840752332
6
+ metadata.gz: 846ee7365d54a843644857244af7a6c9a1616f080a667b0dbcf5aa6fc17047d4c6902b15eacf6f88ee514466963f0899d31b60d5038c0c9a2147db1083de6186
7
+ data.tar.gz: fcc0f3f832bf725e6b2b464d500ee19663c928999a60f038298c72fe96cc0d32c06d0c58a6e8d8f2b10e6f4cc652e1cd9c0e5ac42ad6ac596c27a822edf69649
data/History.md CHANGED
@@ -1,4 +1,27 @@
1
1
 
2
+ 1.12.0 / 2022-11-15
3
+ ===================
4
+
5
+ * Regen manpages
6
+ * Bump year
7
+ * Fix lint Metrics/AbcSize on check_page
8
+ * Fix test/static_test.rb with relative path
9
+ * Add relative link test fail
10
+ * Fix test/static_test.rb with relative path
11
+ * Nokigumbo is merged into nokogiri 1.12~
12
+
13
+ 1.11.1 / 2021-01-10
14
+ ===================
15
+
16
+ * Add nokogumbo doc
17
+ * nokogumbo support for ruby engine
18
+ * Add support for nokogumbo
19
+ * Add jruby to github actions
20
+ * Merge pull request #24 from @marocchino / patch-1
21
+ * Some minor improvements
22
+ * Remove travis ci
23
+ * Init github actions ci
24
+
2
25
  1.11.0 / 2021-01-08
3
26
  ===================
4
27
 
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright (c) 2009-2021 Laurent Arnoud <laurent@spkdev.net>
3
+ Copyright (c) 2009-2022 Laurent Arnoud <laurent@spkdev.net>
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -95,6 +95,11 @@ If the libtidy5 is found on your system this will be the default to validate
95
95
  your html5 document. This does not depend on a tier service everything is done
96
96
  locally.
97
97
 
98
+ #### nokogiri
99
+
100
+ nokogiri can validate html5 document without tier service but reports less
101
+ errors than tidy.
102
+
98
103
  #### Validator.nu web service
99
104
 
100
105
  When `--html5-validator nu` option is used HTML5 support is done by using the
@@ -145,7 +150,7 @@ See [GitHub](https://github.com/spk/validate-website/graphs/contributors).
145
150
 
146
151
  The MIT License
147
152
 
148
- Copyright (c) 2009-2021 Laurent Arnoud <laurent@spkdev.net>
153
+ Copyright (c) 2009-2022 Laurent Arnoud <laurent@spkdev.net>
149
154
 
150
155
  ---
151
156
  [![Build](https://img.shields.io/gitlab/pipeline/spkdev/validate-website/master)](https://gitlab.com/spkdev/validate-website/-/commits/master)
@@ -56,7 +56,7 @@ module ValidateWebsite
56
56
  opt.regexp('-i', '--ignore',
57
57
  'Validation errors to ignore (ex: "valign|autocorrect")')
58
58
  opt.string('-x', '--html5-validator',
59
- 'Change default html5 validator engine (ex: tidy or nu)',
59
+ 'Change default html5 validator engine (tidy/nu/nokogiri)',
60
60
  default: DEFAULT_OPTIONS[:html5_validator])
61
61
  opt.string('-5', '--html5-validator-service-url',
62
62
  'Change default html5 validator service URL for "nu" engine')
@@ -61,17 +61,16 @@ module ValidateWebsite
61
61
  def check_page(file, page)
62
62
  if page.html? && options[:markup]
63
63
  keys = %i[ignore html5_validator]
64
- # slice does not exists on Ruby <= 2.4
65
- slice = Hash[[keys, options.values_at(*keys)].transpose]
64
+ slice = options.slice(*keys)
66
65
  validate(page.doc, page.body, file, slice)
67
66
  end
68
- check_static_not_found(page.links) if options[:not_found]
67
+ check_static_not_found(page.links, page.url.to_s) if options[:not_found]
69
68
  end
70
69
 
71
70
  # check files linked on static document
72
71
  # see lib/validate_website/runner.rb
73
- def check_static_not_found(links)
74
- static_links = links.map { |l| StaticLink.new(l, @site) }
72
+ def check_static_not_found(links, site = @site)
73
+ static_links = links.map { |l| StaticLink.new(l, site) }
75
74
  static_links.each do |static_link|
76
75
  next unless static_link.check?
77
76
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'uri'
4
4
 
5
- require 'nokogiri'
5
+ require 'nokogiri' unless ValidateWebsite.jruby?
6
6
  require 'w3c_validators'
7
7
 
8
8
  require 'validate_website/validator_class_methods'
@@ -112,8 +112,10 @@ module ValidateWebsite
112
112
  def html5_validate
113
113
  if html5_validator.to_sym == :tidy && self.class.tidy
114
114
  tidy_validate
115
- else
115
+ elsif html5_validator.to_sym == :nu
116
116
  nu_validate
117
+ else
118
+ Nokogiri::HTML5(document, max_errors: -1).errors
117
119
  end
118
120
  end
119
121
 
@@ -2,5 +2,9 @@
2
2
 
3
3
  # Version file for ValidateWebsite
4
4
  module ValidateWebsite
5
- VERSION = '1.11.0'
5
+ VERSION = '1.12.0'
6
+
7
+ def self.jruby? # :nodoc:
8
+ defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
9
+ end
6
10
  end
@@ -1,13 +1,13 @@
1
1
  '\" t
2
2
  .\" Title: validate-website-static
3
3
  .\" Author: [see the "AUTHOR(S)" section]
4
- .\" Generator: Asciidoctor 1.5.8
5
- .\" Date: 2019-01-09
4
+ .\" Generator: Asciidoctor 2.0.18
5
+ .\" Date: 2022-05-02
6
6
  .\" Manual: \ \&
7
7
  .\" Source: \ \&
8
8
  .\" Language: English
9
9
  .\"
10
- .TH "VALIDATE\-WEBSITE\-STATIC" "1" "2019-01-09" "\ \&" "\ \&"
10
+ .TH "VALIDATE\-WEBSITE\-STATIC" "1" "2022-05-02" "\ \&" "\ \&"
11
11
  .ie \n(.g .ds Aq \(aq
12
12
  .el .ds Aq '
13
13
  .ss \n[.ss] 0
@@ -28,7 +28,7 @@
28
28
  . LINKSTYLE blue R < >
29
29
  .\}
30
30
  .SH "NAME"
31
- validate\-website\-static \- check the validity of your documents
31
+ validate-website-static \- check the validity of your documents
32
32
  .SH "SYNOPSIS"
33
33
  .sp
34
34
  \fBvalidate\-website\-static\fP [\fIOPTIONS\fP]
@@ -82,7 +82,7 @@ Show colored output (Default: true)
82
82
  .sp
83
83
  \fB\-x\fP, \fB\-\-html5\-validator\fP \fIVALIDATOR\fP
84
84
  .RS 4
85
- Change default html5 validator engine (ex: tidy or nu)
85
+ Change default html5 validator engine (tidy/nu/nokogiri)
86
86
  .RE
87
87
  .sp
88
88
  \fB\-5\fP, \fB\-\-html5\-validator\-service\-url\fP \fIURL\fP
@@ -1,13 +1,13 @@
1
1
  '\" t
2
2
  .\" Title: validate-website
3
3
  .\" Author: [see the "AUTHOR(S)" section]
4
- .\" Generator: Asciidoctor 1.5.8
5
- .\" Date: 2019-01-09
4
+ .\" Generator: Asciidoctor 2.0.18
5
+ .\" Date: 2022-05-02
6
6
  .\" Manual: \ \&
7
7
  .\" Source: \ \&
8
8
  .\" Language: English
9
9
  .\"
10
- .TH "VALIDATE\-WEBSITE" "1" "2019-01-09" "\ \&" "\ \&"
10
+ .TH "VALIDATE\-WEBSITE" "1" "2022-05-02" "\ \&" "\ \&"
11
11
  .ie \n(.g .ds Aq \(aq
12
12
  .el .ds Aq '
13
13
  .ss \n[.ss] 0
@@ -28,7 +28,7 @@
28
28
  . LINKSTYLE blue R < >
29
29
  .\}
30
30
  .SH "NAME"
31
- validate\-website \- Web crawler for checking the validity of your documents
31
+ validate-website \- Web crawler for checking the validity of your documents
32
32
  .SH "SYNOPSIS"
33
33
  .sp
34
34
  \fBvalidate\-website\fP [\fIOPTIONS\fP]
@@ -87,7 +87,7 @@ Show colored output (Default: true)
87
87
  .sp
88
88
  \fB\-x\fP, \fB\-\-html5\-validator\fP \fIVALIDATOR\fP
89
89
  .RS 4
90
- Change default html5 validator engine (ex: tidy or nu)
90
+ Change default html5 validator engine (tidy/nu/nokogiri)
91
91
  .RE
92
92
  .sp
93
93
  \fB\-5\fP, \fB\-\-html5\-validator\-service\-url\fP \fIURL\fP
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>title</title>
6
+ <meta name="description" content="" />
7
+ <meta name="keywords" content="" />
8
+ <meta name="author" content="" />
9
+ </head>
10
+ <body>
11
+ <header>
12
+ <nav>
13
+ <ul>
14
+ <li><a href="ryzom-naissance-du-projet-libre-ryzom-forge.md" title="title">my url</a></li>
15
+ </ul>
16
+ </nav>
17
+ </header>
18
+ </body>
19
+ </html>
data/test/static_test.rb CHANGED
@@ -34,15 +34,14 @@ describe ValidateWebsite::Static do
34
34
  end
35
35
 
36
36
  it 'not found' do
37
- pattern = File.join(File.dirname(__FILE__), '**/*.html')
38
37
  Dir.chdir('test/data') do
39
38
  _out, _err = capture_io do
40
- @validate_website.crawl(pattern: pattern,
39
+ @validate_website.crawl(pattern: '**/*.html',
41
40
  site: 'https://linuxfr.org/',
42
41
  markup: false,
43
42
  not_found: true)
44
43
  end
45
- _(@validate_website.not_founds_count).must_equal 213
44
+ _(@validate_website.not_founds_count).must_equal 210
46
45
  end
47
46
  end
48
47
 
@@ -79,7 +79,7 @@ describe ValidateWebsite::Validator do
79
79
  @html5_page = @http.get_page(page.url)
80
80
  end
81
81
 
82
- describe('without tidy') do
82
+ describe('with nu') do
83
83
  it 'should have an array of errors' do
84
84
  validator = subject.new(@html5_page.doc,
85
85
  @html5_page.body,
@@ -99,8 +99,31 @@ describe ValidateWebsite::Validator do
99
99
  end
100
100
  end
101
101
 
102
+ describe('with nokogiri') do
103
+ it 'have an array of errors' do
104
+ skip('nokogiri dont support jruby') if ValidateWebsite.jruby?
105
+ validator = subject.new(@html5_page.doc,
106
+ @html5_page.body,
107
+ html5_validator: :nokogiri)
108
+ _(validator.valid?).must_equal false
109
+ _(validator.errors.size).must_equal 1
110
+ end
111
+
112
+ it 'exclude errors ignored by :ignore option' do
113
+ skip('nokogiri dont support jruby') if ValidateWebsite.jruby?
114
+ ignore = /That tag isn't allowed here/
115
+ validator = subject.new(@html5_page.doc,
116
+ @html5_page.body,
117
+ ignore: ignore,
118
+ html5_validator: :nokogiri)
119
+ _(validator.valid?).must_equal true
120
+ _(validator.errors.size).must_equal 0
121
+ end
122
+ end
123
+
102
124
  describe('with tidy') do
103
125
  it 'should have an array of errors' do
126
+ skip('tidy is not installed') unless ValidateWebsite::Validator.tidy
104
127
  validator = subject.new(@html5_page.doc,
105
128
  @html5_page.body)
106
129
  _(validator.valid?).must_equal false
@@ -108,6 +131,7 @@ describe ValidateWebsite::Validator do
108
131
  end
109
132
 
110
133
  it 'should exclude errors ignored by :ignore option' do
134
+ skip('tidy is not installed') unless ValidateWebsite::Validator.tidy
111
135
  ignore = /letter not allowed here|trimming empty/
112
136
  validator = subject.new(@html5_page.doc,
113
137
  @html5_page.body,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: validate-website
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Arnoud
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2022-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: crass
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.12'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.12'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: paint
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -251,6 +265,7 @@ files:
251
265
  - test/data/html4-strict.html
252
266
  - test/data/html5-fail.html
253
267
  - test/data/html5.html
268
+ - test/data/news/index.html
254
269
  - test/data/news/ryzom-naissance-du-projet-libre-ryzom-forge.md
255
270
  - test/data/validator.nu-failure.json
256
271
  - test/data/validator.nu-success.json
@@ -265,7 +280,7 @@ homepage: http://github.com/spk/validate-website
265
280
  licenses:
266
281
  - MIT
267
282
  metadata: {}
268
- post_install_message:
283
+ post_install_message:
269
284
  rdoc_options: []
270
285
  require_paths:
271
286
  - lib
@@ -280,12 +295,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
280
295
  - !ruby/object:Gem::Version
281
296
  version: '0'
282
297
  requirements: []
283
- rubygems_version: 3.2.0.rc.2
284
- signing_key:
298
+ rubygems_version: 3.3.15
299
+ signing_key:
285
300
  specification_version: 4
286
301
  summary: Web crawler for checking the validity of your documents
287
302
  test_files:
288
- - test/static_test.rb
289
303
  - test/core_test.rb
290
- - test/validator_test.rb
291
304
  - test/crawler_test.rb
305
+ - test/static_test.rb
306
+ - test/validator_test.rb