validate-website 1.11.0 → 1.11.1

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: 7208a9c728f7798aecc7a10bec8a3537940a6857e3eb4f6612efa551f2871a94
4
+ data.tar.gz: 25e5112b42c14a6ed86f0271fba1bb9ada63c1d92cc75414a227716289e241f8
5
5
  SHA512:
6
- metadata.gz: 6b0774aaab6ca32e10d43cfc0dd6c57219cc9e3862af5febd892a30884920195512301f702e5af11459a55c8dde4eaa4238a09833b102924a8ca36c9deb8480f
7
- data.tar.gz: c0cdf68b1486c2d15257d7fb07e8561f52054b5a234e46162a468b1ffdc6bbc26905563150ccab3053e78a15a70c59142a857afa1aaff7563a22279840752332
6
+ metadata.gz: 95962fe71e144cc5c8f244e1960556e56c9956bdcd5852e194532ee16b40dfbda5ba39db75169651ddd4048afc79311fdee2aa1087dddc3388aaa894c4dc27fe
7
+ data.tar.gz: 6a6e8185f8a359e0482c0ef5893b28d307a31be560a2e83bfd19f88f042cfbd3ec37e244f602e5ea4a6876afce9b8d2a38f98f645452168b752c03ee62fdc70d
data/History.md CHANGED
@@ -1,4 +1,16 @@
1
1
 
2
+ 1.11.1 / 2021-01-10
3
+ ===================
4
+
5
+ * Add nokogumbo doc
6
+ * nokogumbo support for ruby engine
7
+ * Add support for nokogumbo
8
+ * Add jruby to github actions
9
+ * Merge pull request #24 from @marocchino / patch-1
10
+ * Some minor improvements
11
+ * Remove travis ci
12
+ * Init github actions ci
13
+
2
14
  1.11.0 / 2021-01-08
3
15
  ===================
4
16
 
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
+ #### Nokogumbo
99
+
100
+ Nokogumbo 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
@@ -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/nokogumbo)',
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')
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'uri'
4
4
 
5
- require 'nokogiri'
5
+ require 'nokogumbo' 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.11.1'
6
+
7
+ def self.jruby? # :nodoc:
8
+ defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
9
+ end
6
10
  end
@@ -2,12 +2,12 @@
2
2
  .\" Title: validate-website-static
3
3
  .\" Author: [see the "AUTHOR(S)" section]
4
4
  .\" Generator: Asciidoctor 1.5.8
5
- .\" Date: 2019-01-09
5
+ .\" Date: 2021-01-10
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" "2021-01-10" "\ \&" "\ \&"
11
11
  .ie \n(.g .ds Aq \(aq
12
12
  .el .ds Aq '
13
13
  .ss \n[.ss] 0
@@ -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/nokogumbo)
86
86
  .RE
87
87
  .sp
88
88
  \fB\-5\fP, \fB\-\-html5\-validator\-service\-url\fP \fIURL\fP
@@ -2,12 +2,12 @@
2
2
  .\" Title: validate-website
3
3
  .\" Author: [see the "AUTHOR(S)" section]
4
4
  .\" Generator: Asciidoctor 1.5.8
5
- .\" Date: 2019-01-09
5
+ .\" Date: 2021-01-10
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" "2021-01-10" "\ \&" "\ \&"
11
11
  .ie \n(.g .ds Aq \(aq
12
12
  .el .ds Aq '
13
13
  .ss \n[.ss] 0
@@ -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/nokogumbo)
91
91
  .RE
92
92
  .sp
93
93
  \fB\-5\fP, \fB\-\-html5\-validator\-service\-url\fP \fIURL\fP
@@ -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 nokogumbo') do
103
+ it 'have an array of errors' do
104
+ skip('nokogumbo dont support jruby') if ValidateWebsite.jruby?
105
+ validator = subject.new(@html5_page.doc,
106
+ @html5_page.body,
107
+ html5_validator: :nokogumbo)
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('nokogumbo 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: :nokogumbo)
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.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laurent Arnoud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2021-01-10 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: nokogumbo
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: paint
29
43
  requirement: !ruby/object:Gem::Requirement