jekyll-validator 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/main.yml +27 -0
- data/.gitignore +16 -0
- data/.rspec +3 -0
- data/.rubocop.yml +25 -0
- data/CHANGELOG.md +5 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/Gemfile +13 -0
- data/Gemfile.lock +144 -0
- data/LICENSE +8 -0
- data/README.md +31 -0
- data/Rakefile +12 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/jekyll-validator.gemspec +33 -0
- data/lib/jekyll-validator/version.rb +7 -0
- data/lib/jekyll-validator.rb +51 -0
- data/spec/fixtures/_config.yml +11 -0
- data/spec/fixtures/cassettes/css_invalid.yml +83 -0
- data/spec/fixtures/cassettes/css_valid.yml +91 -0
- data/spec/fixtures/cassettes/html_invalid.yml +77 -0
- data/spec/fixtures/cassettes/html_valid.yml +83 -0
- data/spec/fixtures/files/excluded.css +0 -0
- data/spec/fixtures/files/excluded.txt +0 -0
- data/spec/fixtures/files/invalid.css +7 -0
- data/spec/fixtures/files/invalid.html +16 -0
- data/spec/fixtures/files/valid.css +7 -0
- data/spec/fixtures/files/valid.html +15 -0
- data/spec/jekyll-validator/validator_spec.rb +77 -0
- data/spec/spec_helper.rb +23 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 742c5a6e91c774a7b2831e499ab9273cb35eeca4873c07f0a9393bb7ef0f4621
|
4
|
+
data.tar.gz: 35f94686ef8f7a9eb985047158fb86f2ab60e72bb52412d0e28c8ad1a57201a8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b0998ad55fa4042d8d1fbef63864023a99622ff46fc9c021d03cac8566a1ca0e590e8c1c921e98310a8c9c07b424969911c0f1b3e4697ea854660ab3db1ae2d3
|
7
|
+
data.tar.gz: 7f8553e8a6c21312586e9a57d5b15ae49b94d6a4cef68bc6f6818c2e4c25bdfae7ee548f4a5eeec9b9fe8f98e359bc150d71e99d735952fef54de5322b54c847
|
@@ -0,0 +1,27 @@
|
|
1
|
+
name: Ruby
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches:
|
6
|
+
- main
|
7
|
+
|
8
|
+
pull_request:
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
build:
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
name: Ruby ${{ matrix.ruby }}
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby:
|
17
|
+
- '3.1.2'
|
18
|
+
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v3
|
21
|
+
- name: Set up Ruby
|
22
|
+
uses: ruby/setup-ruby@v1
|
23
|
+
with:
|
24
|
+
ruby-version: ${{ matrix.ruby }}
|
25
|
+
bundler-cache: true
|
26
|
+
- name: Run the default task
|
27
|
+
run: bundle exec rake
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
TargetRubyVersion: 2.6
|
5
|
+
NewCops: enable
|
6
|
+
|
7
|
+
Naming/FileName:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Style/Documentation:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
Style/StringLiterals:
|
14
|
+
Enabled: true
|
15
|
+
EnforcedStyle: double_quotes
|
16
|
+
|
17
|
+
Style/StringLiteralsInInterpolation:
|
18
|
+
Enabled: true
|
19
|
+
EnforcedStyle: double_quotes
|
20
|
+
|
21
|
+
RSpec/FilePath:
|
22
|
+
Enabled: false
|
23
|
+
|
24
|
+
Layout/LineLength:
|
25
|
+
Max: 120
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at ngw@nofeed.org. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/Gemfile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in jekyll-validator.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
gem "rspec", "~> 3.0"
|
10
|
+
gem "rubocop", "~> 1.21"
|
11
|
+
gem "rubocop-rspec", "~> 2.20"
|
12
|
+
gem "vcr", "~> 6"
|
13
|
+
gem "webmock", "~> 3.18"
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jekyll-validator (0.1.2)
|
5
|
+
jekyll (>= 3.0, < 5.0)
|
6
|
+
rainbow (>= 3.0, < 4.0)
|
7
|
+
w3c_validators (>= 1.0, < 2.0)
|
8
|
+
|
9
|
+
GEM
|
10
|
+
remote: https://rubygems.org/
|
11
|
+
specs:
|
12
|
+
addressable (2.8.4)
|
13
|
+
public_suffix (>= 2.0.2, < 6.0)
|
14
|
+
ast (2.4.2)
|
15
|
+
colorator (1.1.0)
|
16
|
+
concurrent-ruby (1.2.2)
|
17
|
+
crack (0.4.5)
|
18
|
+
rexml
|
19
|
+
diff-lcs (1.5.0)
|
20
|
+
em-websocket (0.5.3)
|
21
|
+
eventmachine (>= 0.12.9)
|
22
|
+
http_parser.rb (~> 0)
|
23
|
+
eventmachine (1.2.7)
|
24
|
+
ffi (1.15.5)
|
25
|
+
forwardable-extended (2.6.0)
|
26
|
+
google-protobuf (3.22.3-arm64-darwin)
|
27
|
+
google-protobuf (3.22.3-x86_64-linux)
|
28
|
+
hashdiff (1.0.1)
|
29
|
+
http_parser.rb (0.8.0)
|
30
|
+
i18n (1.12.0)
|
31
|
+
concurrent-ruby (~> 1.0)
|
32
|
+
jekyll (4.3.2)
|
33
|
+
addressable (~> 2.4)
|
34
|
+
colorator (~> 1.0)
|
35
|
+
em-websocket (~> 0.5)
|
36
|
+
i18n (~> 1.0)
|
37
|
+
jekyll-sass-converter (>= 2.0, < 4.0)
|
38
|
+
jekyll-watch (~> 2.0)
|
39
|
+
kramdown (~> 2.3, >= 2.3.1)
|
40
|
+
kramdown-parser-gfm (~> 1.0)
|
41
|
+
liquid (~> 4.0)
|
42
|
+
mercenary (>= 0.3.6, < 0.5)
|
43
|
+
pathutil (~> 0.9)
|
44
|
+
rouge (>= 3.0, < 5.0)
|
45
|
+
safe_yaml (~> 1.0)
|
46
|
+
terminal-table (>= 1.8, < 4.0)
|
47
|
+
webrick (~> 1.7)
|
48
|
+
jekyll-sass-converter (3.0.0)
|
49
|
+
sass-embedded (~> 1.54)
|
50
|
+
jekyll-watch (2.2.1)
|
51
|
+
listen (~> 3.0)
|
52
|
+
json (2.6.3)
|
53
|
+
kramdown (2.4.0)
|
54
|
+
rexml
|
55
|
+
kramdown-parser-gfm (1.1.0)
|
56
|
+
kramdown (~> 2.0)
|
57
|
+
liquid (4.0.4)
|
58
|
+
listen (3.8.0)
|
59
|
+
rb-fsevent (~> 0.10, >= 0.10.3)
|
60
|
+
rb-inotify (~> 0.9, >= 0.9.10)
|
61
|
+
mercenary (0.4.0)
|
62
|
+
nokogiri (1.14.3-arm64-darwin)
|
63
|
+
racc (~> 1.4)
|
64
|
+
nokogiri (1.14.3-x86_64-linux)
|
65
|
+
racc (~> 1.4)
|
66
|
+
parallel (1.23.0)
|
67
|
+
parser (3.2.2.0)
|
68
|
+
ast (~> 2.4.1)
|
69
|
+
pathutil (0.16.2)
|
70
|
+
forwardable-extended (~> 2.6)
|
71
|
+
public_suffix (5.0.1)
|
72
|
+
racc (1.6.2)
|
73
|
+
rainbow (3.1.1)
|
74
|
+
rake (13.0.6)
|
75
|
+
rb-fsevent (0.11.2)
|
76
|
+
rb-inotify (0.10.1)
|
77
|
+
ffi (~> 1.0)
|
78
|
+
regexp_parser (2.8.0)
|
79
|
+
rexml (3.2.5)
|
80
|
+
rouge (4.1.0)
|
81
|
+
rspec (3.12.0)
|
82
|
+
rspec-core (~> 3.12.0)
|
83
|
+
rspec-expectations (~> 3.12.0)
|
84
|
+
rspec-mocks (~> 3.12.0)
|
85
|
+
rspec-core (3.12.2)
|
86
|
+
rspec-support (~> 3.12.0)
|
87
|
+
rspec-expectations (3.12.3)
|
88
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
89
|
+
rspec-support (~> 3.12.0)
|
90
|
+
rspec-mocks (3.12.5)
|
91
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
92
|
+
rspec-support (~> 3.12.0)
|
93
|
+
rspec-support (3.12.0)
|
94
|
+
rubocop (1.50.2)
|
95
|
+
json (~> 2.3)
|
96
|
+
parallel (~> 1.10)
|
97
|
+
parser (>= 3.2.0.0)
|
98
|
+
rainbow (>= 2.2.2, < 4.0)
|
99
|
+
regexp_parser (>= 1.8, < 3.0)
|
100
|
+
rexml (>= 3.2.5, < 4.0)
|
101
|
+
rubocop-ast (>= 1.28.0, < 2.0)
|
102
|
+
ruby-progressbar (~> 1.7)
|
103
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
104
|
+
rubocop-ast (1.28.0)
|
105
|
+
parser (>= 3.2.1.0)
|
106
|
+
rubocop-capybara (2.17.1)
|
107
|
+
rubocop (~> 1.41)
|
108
|
+
rubocop-rspec (2.20.0)
|
109
|
+
rubocop (~> 1.33)
|
110
|
+
rubocop-capybara (~> 2.17)
|
111
|
+
ruby-progressbar (1.13.0)
|
112
|
+
safe_yaml (1.0.5)
|
113
|
+
sass-embedded (1.62.0)
|
114
|
+
google-protobuf (~> 3.21)
|
115
|
+
rake (>= 10.0.0)
|
116
|
+
terminal-table (3.0.2)
|
117
|
+
unicode-display_width (>= 1.1.1, < 3)
|
118
|
+
unicode-display_width (2.4.2)
|
119
|
+
vcr (6.1.0)
|
120
|
+
w3c_validators (1.3.7)
|
121
|
+
json (>= 1.8)
|
122
|
+
nokogiri (~> 1.6)
|
123
|
+
rexml (~> 3.2)
|
124
|
+
webmock (3.18.1)
|
125
|
+
addressable (>= 2.8.0)
|
126
|
+
crack (>= 0.3.2)
|
127
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
128
|
+
webrick (1.8.1)
|
129
|
+
|
130
|
+
PLATFORMS
|
131
|
+
arm64-darwin-22
|
132
|
+
x86_64-linux
|
133
|
+
|
134
|
+
DEPENDENCIES
|
135
|
+
jekyll-validator!
|
136
|
+
rake (~> 13.0)
|
137
|
+
rspec (~> 3.0)
|
138
|
+
rubocop (~> 1.21)
|
139
|
+
rubocop-rspec (~> 2.20)
|
140
|
+
vcr (~> 6)
|
141
|
+
webmock (~> 3.18)
|
142
|
+
|
143
|
+
BUNDLED WITH
|
144
|
+
2.4.12
|
data/LICENSE
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
/*
|
2
|
+
* ----------------------------------------------------------------------------
|
3
|
+
* "THE BEER-WARE LICENSE" (Revision 42):
|
4
|
+
* <ngw@nofeed.org> wrote this file. As long as you retain this notice you
|
5
|
+
* can do whatever you want with this stuff. If we meet some day, and you think
|
6
|
+
* this stuff is worth it, you can buy me a beer in return ~ Nicholas Wieland
|
7
|
+
* ----------------------------------------------------------------------------
|
8
|
+
*/
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# JekyllValidator
|
2
|
+
|
3
|
+
JekyllValidator is a gem that helps you validate the output of your Jekyll website every time it's generated. I got the idea from my blog post ["Automating HTML Validation for a Happier Life"], which includes a simple bash script to automate the process. I created this plugin to enhance the platform I use with better functionality. I incorporated CSS Validation to achieve this, using a language that I adore.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Add the following to your site's Gemfile
|
8
|
+
|
9
|
+
gem 'jekyll-validator'
|
10
|
+
|
11
|
+
And add the following to your site's _config.yml
|
12
|
+
|
13
|
+
plugins:
|
14
|
+
- jekyll-validator
|
15
|
+
|
16
|
+
It is possible to exclude files from the validation process:
|
17
|
+
|
18
|
+
validator:
|
19
|
+
exclude:
|
20
|
+
- 'assets/css/main.css'
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
- Fork the project
|
25
|
+
- Create a descriptively named feature branch
|
26
|
+
- Add your feature
|
27
|
+
- Submit a pull request
|
28
|
+
|
29
|
+
## Code of Conduct
|
30
|
+
|
31
|
+
Everyone interacting in the Jekyll::Validator project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/jekyll-validator/blob/main/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "jekyll/validator"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
require "irb"
|
11
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/jekyll-validator/version"
|
4
|
+
|
5
|
+
# TODO
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jekyll-validator"
|
8
|
+
spec.version = Jekyll::Validator::VERSION
|
9
|
+
spec.authors = ["Nicholas Wieland"]
|
10
|
+
spec.email = ["ngw@nofeed.org"]
|
11
|
+
spec.homepage = "https://github.com/nofeed/jekyll-validator"
|
12
|
+
|
13
|
+
spec.summary = "Validates html against W3C Validator."
|
14
|
+
spec.description = "Calls the W3C Validator API with every page Jekyll generates and displays the validation errors."
|
15
|
+
# spec.homepage = "TODO: Put your gem's website or public repo URL here."
|
16
|
+
spec.required_ruby_version = ">= 2.6.0"
|
17
|
+
spec.licenses = ["Beerware"]
|
18
|
+
|
19
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
20
|
+
|
21
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
22
|
+
spec.metadata["source_code_uri"] = "https://github.com/nofeed/jekyll-validator"
|
23
|
+
spec.metadata["changelog_uri"] = "https://github.com/nofeed/jekyll-validator/blob/main/CHANGELOG.md"
|
24
|
+
|
25
|
+
spec.files = `git ls-files -z`.split("\x0")
|
26
|
+
spec.require_paths = ["lib"]
|
27
|
+
|
28
|
+
spec.add_dependency "jekyll", ">= 3.0", "< 5.0"
|
29
|
+
spec.add_dependency "rainbow", ">= 3.0", "< 4.0"
|
30
|
+
spec.add_dependency "w3c_validators", ">= 1.0", "< 2.0"
|
31
|
+
|
32
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
33
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rainbow/refinement"
|
4
|
+
require "w3c_validators"
|
5
|
+
|
6
|
+
require_relative "jekyll-validator/version"
|
7
|
+
|
8
|
+
module Jekyll
|
9
|
+
class Validator
|
10
|
+
class << self
|
11
|
+
def call(file)
|
12
|
+
Jekyll.logger.info "\nValidating #{file}"
|
13
|
+
|
14
|
+
results = validate(file)
|
15
|
+
|
16
|
+
Jekyll.logger.info "The file #{file} has #{results.errors.length} validation errors".red
|
17
|
+
results.errors.each { |err| Jekyll.logger.info err.to_s.red }
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def html_validator
|
23
|
+
@html_validator ||= ::W3CValidators::NuValidator.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def css_validator
|
27
|
+
@css_validator ||= ::W3CValidators::CSSValidator.new
|
28
|
+
end
|
29
|
+
|
30
|
+
def validate(file)
|
31
|
+
case File.extname(file)
|
32
|
+
when ".css"
|
33
|
+
css_validator.validate_file(file)
|
34
|
+
when ".html"
|
35
|
+
html_validator.validate_file(file)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
Jekyll::Hooks.register [:site], :post_write do |site|
|
43
|
+
excluded = site.config["validator"]["exclude"]
|
44
|
+
|
45
|
+
Dir.glob(File.join("_site", "**/*")).each do |file|
|
46
|
+
next if File.directory?(file)
|
47
|
+
next unless File.extname(file) =~ /.css|.html/
|
48
|
+
|
49
|
+
Jekyll::Validator.call(file) unless excluded.any? { |path| file.include?(path) }
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
url: "http://example.com" # the base hostname & protocol for your site, e.g. http://example.com
|
2
|
+
title: "Example Website" # the name of your site, e.g. ACME Corp.
|
3
|
+
source: "spec/fixtures"
|
4
|
+
quiet: true
|
5
|
+
|
6
|
+
plugins:
|
7
|
+
- jekyll-validator
|
8
|
+
|
9
|
+
validator:
|
10
|
+
exclude:
|
11
|
+
- 'excluded.css'
|
@@ -0,0 +1,83 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://jigsaw.w3.org/css-validator/validator
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "--349832898984244898448024464570528145\r\nContent-Disposition: form-data;
|
9
|
+
name=\"profile\"\r\n\r\ncss3\r\n--349832898984244898448024464570528145\r\nContent-Disposition:
|
10
|
+
form-data; name=\"text\"\r\n\r\nh1 {\n colour: blue;\n}\n\np {\n margin:
|
11
|
+
11px\n}\r\n--349832898984244898448024464570528145\r\nContent-Disposition:
|
12
|
+
form-data; name=\"output\"\r\n\r\nsoap12\r\n--349832898984244898448024464570528145--\r\n"
|
13
|
+
headers:
|
14
|
+
Content-Type:
|
15
|
+
- multipart/form-data; boundary=349832898984244898448024464570528145
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
User-Agent:
|
21
|
+
- Ruby
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Date:
|
28
|
+
- Thu, 20 Apr 2023 04:06:09 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/soap+xml;charset=utf-8
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache
|
37
|
+
Pragma:
|
38
|
+
- no-cache
|
39
|
+
Content-Language:
|
40
|
+
- en
|
41
|
+
Vary:
|
42
|
+
- Accept-Language
|
43
|
+
Access-Control-Allow-Origin:
|
44
|
+
- "*"
|
45
|
+
Access-Control-Allow-Headers:
|
46
|
+
- content-type,accept-charset
|
47
|
+
Access-Control-Allow-Methods:
|
48
|
+
- GET, HEAD, POST, OPTIONS
|
49
|
+
Access-Control-Max-Age:
|
50
|
+
- '600'
|
51
|
+
X-W3c-Validator-Errors:
|
52
|
+
- '1'
|
53
|
+
X-W3c-Validator-Status:
|
54
|
+
- Invalid
|
55
|
+
Strict-Transport-Security:
|
56
|
+
- max-age=15552015; includeSubDomains; preload
|
57
|
+
Public-Key-Pins:
|
58
|
+
- pin-sha256="cN0QSpPIkuwpT6iP2YjEo1bEwGpH/yiUn6yhdy+HNto="; pin-sha256="WGJkyYjx1QMdMe0UqlyOKXtydPDVrk7sl2fV+nNm1r4=";
|
59
|
+
pin-sha256="LrKdTxZLRTvyHM4/atX2nquX9BeHRZMCxg3cf4rhc2I="; max-age=864000
|
60
|
+
X-Frame-Options:
|
61
|
+
- deny
|
62
|
+
X-Xss-Protection:
|
63
|
+
- 1; mode=block
|
64
|
+
X-Request-Id:
|
65
|
+
- 7baa83551d4171d2
|
66
|
+
Cf-Cache-Status:
|
67
|
+
- DYNAMIC
|
68
|
+
Set-Cookie:
|
69
|
+
- __cf_bm=xVvvolB1lJzVVh.IG.CjM9ENlqLxWVSRHMXUYmweSnU-1681963569-0-AcOmGVvJuTkoUByZrN2ErW/iCBzB3+yFgfgP81rqoQ3/cLHS8VxJe0Jw0Xg3LJ7CzoNkvfeTuVT2w5462CQWewU=;
|
70
|
+
path=/; expires=Thu, 20-Apr-23 04:36:09 GMT; domain=.w3.org; HttpOnly; Secure;
|
71
|
+
SameSite=None
|
72
|
+
Server:
|
73
|
+
- cloudflare
|
74
|
+
Cf-Ray:
|
75
|
+
- 7baa83551d4171d2-LHR
|
76
|
+
Alt-Svc:
|
77
|
+
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
|
78
|
+
body:
|
79
|
+
encoding: ASCII-8BIT
|
80
|
+
string: !binary |-
|
81
|
+
PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0idXRmLTgiPz4KPGVudjpFbnZlbG9wZSB4bWxuczplbnY9Imh0dHA6Ly93d3cudzMub3JnLzIwMDMvMDUvc29hcC1lbnZlbG9wZSI+CiAgICA8ZW52OkJvZHk+CiAgICAgICAgPG06Y3NzdmFsaWRhdGlvbnJlc3BvbnNlCiAgICAgICAgICAgIGVudjplbmNvZGluZ1N0eWxlPSJodHRwOi8vd3d3LnczLm9yZy8yMDAzLzA1L3NvYXAtZW5jb2RpbmciCiAgICAgICAgICAgIHhtbG5zOm09Imh0dHA6Ly93d3cudzMub3JnLzIwMDUvMDcvY3NzLXZhbGlkYXRvciI+CiAgICAgICAgICAgIDxtOnVyaT5UZXh0QXJlYTwvbTp1cmk+CiAgICAgICAgICAgIDxtOmNoZWNrZWRieT5odHRwOi8vamlnc2F3LnczLm9yZy9jc3MtdmFsaWRhdG9yLzwvbTpjaGVja2VkYnk+CiAgICAgICAgICAgIDxtOmNzc2xldmVsPmNzczM8L206Y3NzbGV2ZWw+CiAgICAgICAgICAgIDxtOmRhdGU+MjAyMy0wNC0yMFQwNDowNjowOVo8L206ZGF0ZT4KICAgICAgICAgICAgPG06dmFsaWRpdHk+ZmFsc2U8L206dmFsaWRpdHk+CiAgICAgICAgICAgIDxtOnJlc3VsdD4KICAgICAgICAgICAgICAgIDxtOmVycm9ycyB4bWw6bGFuZz0iZW4iPgogICAgICAgICAgICAgICAgICAgIDxtOmVycm9yY291bnQ+MTwvbTplcnJvcmNvdW50PgogICAgICAgICAgICAKICAgICAgICAgICAgICAgIDxtOmVycm9ybGlzdD4KICAgICAgICAgICAgICAgICAgICA8bTp1cmk+ZmlsZTovL2xvY2FsaG9zdC9UZXh0QXJlYTwvbTp1cmk+CiAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgIDxtOmVycm9yPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPG06bGluZT4yPC9tOmxpbmU+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8bTplcnJvcnR5cGU+cGFyc2UtZXJyb3I8L206ZXJyb3J0eXBlPgo8bTpjb250ZXh0PmgxPC9tOmNvbnRleHQ+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8bTplcnJvcnN1YnR5cGU+CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZXhwCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L206ZXJyb3JzdWJ0eXBlPgogICAgICAgICAgICAgICAgICAgICAgICAgICAgPG06c2tpcHBlZHN0cmluZz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBibHVlCiAgICAgICAgICAgICAgICAgICAgICAgICAgICA8L206c2tpcHBlZHN0cmluZz4KICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxtOnR5cGU+bm9leGlzdGVuY2UtdHlwbzwvbTp0eXBlPgoKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDxtOm1lc3NhZ2U+CgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFByb3BlcnR5IOKAnGNvbG91cuKAnSBkb2VzbiZhcG9zO3QgZXhpc3QuIFRoZSBjbG9zZXN0IG1hdGNoaW5nIHByb3BlcnR5IG5hbWUgaXMg4oCcY29sb3LigJ0gOiAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIDwvbTptZXNzYWdlPgogICAgICAgICAgICAgICAgICAgICAgICA8L206ZXJyb3I+CiAgICAKICAgICAgICAgICAgICAgICAgICA8L206ZXJyb3JsaXN0PgogICAgCiAgICAgICAgICAgICAgICA8L206ZXJyb3JzPgogICAgICAgICAgICAgICAgPG06d2FybmluZ3MgeG1sOmxhbmc9ImVuIj4KICAgICAgICAgICAgICAgICAgICA8bTp3YXJuaW5nY291bnQ+MDwvbTp3YXJuaW5nY291bnQ+CiAgICAgICAgICAgICAgICA8L206d2FybmluZ3M+CiAgICAgICAgICAgIDwvbTpyZXN1bHQ+CiAgICAgICAgPC9tOmNzc3ZhbGlkYXRpb25yZXNwb25zZT4KICAgIDwvZW52OkJvZHk+CjwvZW52OkVudmVsb3BlPgoK
|
82
|
+
recorded_at: Thu, 20 Apr 2023 04:06:09 GMT
|
83
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,91 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://jigsaw.w3.org/css-validator/validator
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "--349832898984244898448024464570528145\r\nContent-Disposition: form-data;
|
9
|
+
name=\"profile\"\r\n\r\ncss3\r\n--349832898984244898448024464570528145\r\nContent-Disposition:
|
10
|
+
form-data; name=\"text\"\r\n\r\nh1 {\n color: blue;\n}\n\np {\n margin:
|
11
|
+
11px;\n}\r\n--349832898984244898448024464570528145\r\nContent-Disposition:
|
12
|
+
form-data; name=\"output\"\r\n\r\nsoap12\r\n--349832898984244898448024464570528145--\r\n"
|
13
|
+
headers:
|
14
|
+
Content-Type:
|
15
|
+
- multipart/form-data; boundary=349832898984244898448024464570528145
|
16
|
+
Accept-Encoding:
|
17
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
18
|
+
Accept:
|
19
|
+
- "*/*"
|
20
|
+
User-Agent:
|
21
|
+
- Ruby
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Date:
|
28
|
+
- Thu, 20 Apr 2023 04:06:10 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/soap+xml;charset=utf-8
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
Cache-Control:
|
36
|
+
- no-cache
|
37
|
+
Pragma:
|
38
|
+
- no-cache
|
39
|
+
Content-Language:
|
40
|
+
- en
|
41
|
+
Vary:
|
42
|
+
- Accept-Language
|
43
|
+
Access-Control-Allow-Origin:
|
44
|
+
- "*"
|
45
|
+
Access-Control-Allow-Headers:
|
46
|
+
- content-type,accept-charset
|
47
|
+
Access-Control-Allow-Methods:
|
48
|
+
- GET, HEAD, POST, OPTIONS
|
49
|
+
Access-Control-Max-Age:
|
50
|
+
- '600'
|
51
|
+
X-W3c-Validator-Errors:
|
52
|
+
- '0'
|
53
|
+
X-W3c-Validator-Status:
|
54
|
+
- Valid
|
55
|
+
Strict-Transport-Security:
|
56
|
+
- max-age=15552015; includeSubDomains; preload
|
57
|
+
Public-Key-Pins:
|
58
|
+
- pin-sha256="cN0QSpPIkuwpT6iP2YjEo1bEwGpH/yiUn6yhdy+HNto="; pin-sha256="WGJkyYjx1QMdMe0UqlyOKXtydPDVrk7sl2fV+nNm1r4=";
|
59
|
+
pin-sha256="LrKdTxZLRTvyHM4/atX2nquX9BeHRZMCxg3cf4rhc2I="; max-age=864000
|
60
|
+
X-Frame-Options:
|
61
|
+
- deny
|
62
|
+
X-Xss-Protection:
|
63
|
+
- 1; mode=block
|
64
|
+
X-Request-Id:
|
65
|
+
- 7baa835ceef871f3
|
66
|
+
Cf-Cache-Status:
|
67
|
+
- DYNAMIC
|
68
|
+
Set-Cookie:
|
69
|
+
- __cf_bm=x776Yf.tEyZqLFFYJeYKepk62Qx1PWokexWT8zFwP50-1681963570-0-AVKuCw2jmSpyxFm+5xOwPyjICus/ffaslqtVqdjR1SfrjIa2hfa5A0pgX6xRC7BxS8RnClSHNbPdiE44zLe6v1o=;
|
70
|
+
path=/; expires=Thu, 20-Apr-23 04:36:10 GMT; domain=.w3.org; HttpOnly; Secure;
|
71
|
+
SameSite=None
|
72
|
+
Server:
|
73
|
+
- cloudflare
|
74
|
+
Cf-Ray:
|
75
|
+
- 7baa835ceef871f3-LHR
|
76
|
+
Alt-Svc:
|
77
|
+
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
|
78
|
+
body:
|
79
|
+
encoding: UTF-8
|
80
|
+
string: "<?xml version='1.0' encoding=\"utf-8\"?>\n<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n
|
81
|
+
\ <env:Body>\n <m:cssvalidationresponse\n env:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\"\n
|
82
|
+
\ xmlns:m=\"http://www.w3.org/2005/07/css-validator\">\n <m:uri>TextArea</m:uri>\n
|
83
|
+
\ <m:checkedby>http://jigsaw.w3.org/css-validator/</m:checkedby>\n
|
84
|
+
\ <m:csslevel>css3</m:csslevel>\n <m:date>2023-04-20T04:06:10Z</m:date>\n
|
85
|
+
\ <m:validity>true</m:validity>\n <m:result>\n <m:errors
|
86
|
+
xml:lang=\"en\">\n <m:errorcount>0</m:errorcount>\n \n
|
87
|
+
\ </m:errors>\n <m:warnings xml:lang=\"en\">\n
|
88
|
+
\ <m:warningcount>0</m:warningcount>\n </m:warnings>\n
|
89
|
+
\ </m:result>\n </m:cssvalidationresponse>\n </env:Body>\n</env:Envelope>\n\n"
|
90
|
+
recorded_at: Thu, 20 Apr 2023 04:06:10 GMT
|
91
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,77 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://validator.w3.org/nu/?out=json&parser=html&showsource=yes
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "<!DOCTYPE html> \n<html lang=\"en\">\n<head> \n <meta charset=\"UTF-8\">\n
|
9
|
+
\ <title>Invalid HTML Example</title>\n <noscript><img src=\"https://example.com/image.gif\"></noscript>
|
10
|
+
\n</head> \n\n<body>\n <h1>This HTML is invalid</h1>\n \n <p>On this page
|
11
|
+
we will make some mistakes, to see the validator in action.\n <p>On the web
|
12
|
+
we can create links to the <a href=\"https://www.w3.org/\">W3C</a>, the group
|
13
|
+
that determines web technologies.</p>\n <p>The <a href=\"http://validator.w3.org/>validator</a>
|
14
|
+
is a tool that aids us in finding errors</p>\n</body>\n</html>"
|
15
|
+
headers:
|
16
|
+
Content-Type:
|
17
|
+
- text/html; charset=utf-8
|
18
|
+
Accept-Encoding:
|
19
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
20
|
+
Accept:
|
21
|
+
- "*/*"
|
22
|
+
User-Agent:
|
23
|
+
- Ruby
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 200
|
27
|
+
message: OK
|
28
|
+
headers:
|
29
|
+
Date:
|
30
|
+
- Thu, 20 Apr 2023 04:06:06 GMT
|
31
|
+
Content-Type:
|
32
|
+
- application/json;charset=utf-8
|
33
|
+
Transfer-Encoding:
|
34
|
+
- chunked
|
35
|
+
Connection:
|
36
|
+
- keep-alive
|
37
|
+
Accept-Encoding:
|
38
|
+
- gzip
|
39
|
+
Access-Control-Allow-Origin:
|
40
|
+
- "*"
|
41
|
+
Access-Control-Allow-Headers:
|
42
|
+
- content-type
|
43
|
+
Expires:
|
44
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
45
|
+
Cache-Control:
|
46
|
+
- no-cache
|
47
|
+
Vary:
|
48
|
+
- Accept-Encoding, User-Agent
|
49
|
+
Strict-Transport-Security:
|
50
|
+
- max-age=15552015; preload
|
51
|
+
Public-Key-Pins:
|
52
|
+
- pin-sha256="cN0QSpPIkuwpT6iP2YjEo1bEwGpH/yiUn6yhdy+HNto="; pin-sha256="WGJkyYjx1QMdMe0UqlyOKXtydPDVrk7sl2fV+nNm1r4=";
|
53
|
+
pin-sha256="LrKdTxZLRTvyHM4/atX2nquX9BeHRZMCxg3cf4rhc2I="; max-age=864000
|
54
|
+
X-Frame-Options:
|
55
|
+
- deny
|
56
|
+
X-Xss-Protection:
|
57
|
+
- 1; mode=block
|
58
|
+
X-Request-Id:
|
59
|
+
- 7baa833f4da023ef
|
60
|
+
Cf-Cache-Status:
|
61
|
+
- DYNAMIC
|
62
|
+
Set-Cookie:
|
63
|
+
- __cf_bm=kxRWjWHXxWMEnXIMQA4LvNQPN__JfChQecTKqSJENM0-1681963566-0-AWnhR+DoUt1HhiKXsTh+4v0M2+ZUfF5KzryyzdExbki9kz4cIgV7mjGeI4I/QNjdrFVmDD5JTtGZfvRxFwQPzVQ=;
|
64
|
+
path=/; expires=Thu, 20-Apr-23 04:36:06 GMT; domain=.w3.org; HttpOnly; Secure;
|
65
|
+
SameSite=None
|
66
|
+
Server:
|
67
|
+
- cloudflare
|
68
|
+
Cf-Ray:
|
69
|
+
- 7baa833f4da023ef-LHR
|
70
|
+
Alt-Svc:
|
71
|
+
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
|
72
|
+
body:
|
73
|
+
encoding: ASCII-8BIT
|
74
|
+
string: !binary |-
|
75
|
+
eyJtZXNzYWdlcyI6W3sidHlwZSI6ImVycm9yIiwibGFzdExpbmUiOjYsImxhc3RDb2x1bW4iOjUzLCJmaXJzdENvbHVtbiI6MTMsIm1lc3NhZ2UiOiJCYWQgc3RhcnQgdGFnIGluIOKAnGltZ+KAnSBpbiDigJxub3NjcmlwdOKAnSBpbiDigJxoZWFk4oCdLiIsImV4dHJhY3QiOiI8bm9zY3JpcHQ+PGltZyBzcmM9XCJodHRwczovL2V4YW1wbGUuY29tL2ltYWdlLmdpZlwiPjwvbm9zYyIsImhpbGl0ZVN0YXJ0IjoxMCwiaGlsaXRlTGVuZ3RoIjo0MX0seyJ0eXBlIjoiZXJyb3IiLCJsYXN0TGluZSI6NiwibGFzdENvbHVtbiI6NTMsImZpcnN0Q29sdW1uIjoxMywibWVzc2FnZSI6IkFuIOKAnGltZ+KAnSBlbGVtZW50IG11c3QgaGF2ZSBhbiDigJxhbHTigJ0gYXR0cmlidXRlLCBleGNlcHQgdW5kZXIgY2VydGFpbiBjb25kaXRpb25zLiBGb3IgZGV0YWlscywgY29uc3VsdCBndWlkYW5jZSBvbiBwcm92aWRpbmcgdGV4dCBhbHRlcm5hdGl2ZXMgZm9yIGltYWdlcy4iLCJleHRyYWN0IjoiPG5vc2NyaXB0PjxpbWcgc3JjPVwiaHR0cHM6Ly9leGFtcGxlLmNvbS9pbWFnZS5naWZcIj48L25vc2MiLCJoaWxpdGVTdGFydCI6MTAsImhpbGl0ZUxlbmd0aCI6NDF9LHsidHlwZSI6ImVycm9yIiwibGFzdExpbmUiOjYsImxhc3RDb2x1bW4iOjY0LCJmaXJzdENvbHVtbiI6NTQsIm1lc3NhZ2UiOiJTdHJheSBlbmQgdGFnIOKAnG5vc2NyaXB04oCdLiIsImV4dHJhY3QiOiJtYWdlLmdpZlwiPjwvbm9zY3JpcHQ+IFxuPC9oZSIsImhpbGl0ZVN0YXJ0IjoxMCwiaGlsaXRlTGVuZ3RoIjoxMX0seyJ0eXBlIjoiZXJyb3IiLCJsYXN0TGluZSI6NywibGFzdENvbHVtbiI6NywiZmlyc3RDb2x1bW4iOjEsIm1lc3NhZ2UiOiJTdHJheSBlbmQgdGFnIOKAnGhlYWTigJ0uIiwiZXh0cmFjdCI6Im9zY3JpcHQ+IFxuPC9oZWFkPiBcblxuPGJvIiwiaGlsaXRlU3RhcnQiOjEwLCJoaWxpdGVMZW5ndGgiOjd9LHsidHlwZSI6ImVycm9yIiwibGFzdExpbmUiOjksImxhc3RDb2x1bW4iOjYsImZpcnN0Q29sdW1uIjoxLCJtZXNzYWdlIjoiU3RhcnQgdGFnIOKAnGJvZHnigJ0gc2VlbiBidXQgYW4gZWxlbWVudCBvZiB0aGUgc2FtZSB0eXBlIHdhcyBhbHJlYWR5IG9wZW4uIiwiZXh0cmFjdCI6IjwvaGVhZD4gXG5cbjxib2R5PlxuICA8aDEiLCJoaWxpdGVTdGFydCI6MTAsImhpbGl0ZUxlbmd0aCI6Nn0seyJ0eXBlIjoiZXJyb3IiLCJsYXN0TGluZSI6MTYsImxhc3RDb2x1bW4iOjcsIm1lc3NhZ2UiOiJFbmQgb2YgZmlsZSByZWFjaGVkIHdoZW4gaW5zaWRlIGFuIGF0dHJpYnV0ZSB2YWx1ZS4gSWdub3JpbmcgdGFnLiIsImV4dHJhY3QiOiJcbjwvYm9keT5cbjwvaHRtbD4iLCJoaWxpdGVTdGFydCI6MTUsImhpbGl0ZUxlbmd0aCI6MX1dLCJzb3VyY2UiOnsidHlwZSI6InRleHQvaHRtbCIsImVuY29kaW5nIjoiVVRGLTgiLCJjb2RlIjoiPCFET0NUWVBFIGh0bWw+IFxuPGh0bWwgbGFuZz1cImVuXCI+XG48aGVhZD4gXG4gIDxtZXRhIGNoYXJzZXQ9XCJVVEYtOFwiPlxuICA8dGl0bGU+SW52YWxpZCBIVE1MIEV4YW1wbGU8L3RpdGxlPlxuICA8bm9zY3JpcHQ+PGltZyBzcmM9XCJodHRwczovL2V4YW1wbGUuY29tL2ltYWdlLmdpZlwiPjwvbm9zY3JpcHQ+IFxuPC9oZWFkPiBcblxuPGJvZHk+XG4gIDxoMT5UaGlzIEhUTUwgaXMgaW52YWxpZDwvaDE+XG4gIFxuICA8cD5PbiB0aGlzIHBhZ2Ugd2Ugd2lsbCBtYWtlIHNvbWUgbWlzdGFrZXMsIHRvIHNlZSB0aGUgdmFsaWRhdG9yIGluIGFjdGlvbi5cbiAgPHA+T24gdGhlIHdlYiB3ZSBjYW4gY3JlYXRlIGxpbmtzIHRvIHRoZSA8YSBocmVmPVwiaHR0cHM6Ly93d3cudzMub3JnL1wiPlczQzwvYT4sIHRoZSBncm91cCB0aGF0IGRldGVybWluZXMgd2ViIHRlY2hub2xvZ2llcy48L3A+XG4gIDxwPlRoZSA8YSBocmVmPVwiaHR0cDovL3ZhbGlkYXRvci53My5vcmcvPnZhbGlkYXRvcjwvYT4gaXMgYSB0b29sIHRoYXQgYWlkcyB1cyBpbiBmaW5kaW5nIGVycm9yczwvcD5cbjwvYm9keT5cbjwvaHRtbD4ifX0K
|
76
|
+
recorded_at: Thu, 20 Apr 2023 04:06:06 GMT
|
77
|
+
recorded_with: VCR 6.1.0
|
@@ -0,0 +1,83 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://validator.w3.org/nu/?out=json&parser=html&showsource=yes
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "<!DOCTYPE html> \n<html lang=\"en\">\n<head> \n <meta charset=\"UTF-8\">\n
|
9
|
+
\ <title>Valid HTML Example</title>\n</head> \n\n<body>\n <h1>This HTML is
|
10
|
+
invalid</h1>\n \n <p>On this page we will make some mistakes, to see the
|
11
|
+
validator in action.</p>\n <p>On the web we can create links to the <a href=\"https://www.w3.org/\">W3C</a>,
|
12
|
+
the group that determines web technologies.</p>\n <p>The <a href=\"http://validator.w3.org/\">validator</a>
|
13
|
+
is a tool that aids us in finding errors</p>\n</body>\n</html>"
|
14
|
+
headers:
|
15
|
+
Content-Type:
|
16
|
+
- text/html; charset=utf-8
|
17
|
+
Accept-Encoding:
|
18
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
19
|
+
Accept:
|
20
|
+
- "*/*"
|
21
|
+
User-Agent:
|
22
|
+
- Ruby
|
23
|
+
response:
|
24
|
+
status:
|
25
|
+
code: 200
|
26
|
+
message: OK
|
27
|
+
headers:
|
28
|
+
Date:
|
29
|
+
- Thu, 20 Apr 2023 04:06:08 GMT
|
30
|
+
Content-Type:
|
31
|
+
- application/json;charset=utf-8
|
32
|
+
Transfer-Encoding:
|
33
|
+
- chunked
|
34
|
+
Connection:
|
35
|
+
- keep-alive
|
36
|
+
Accept-Encoding:
|
37
|
+
- gzip
|
38
|
+
Access-Control-Allow-Origin:
|
39
|
+
- "*"
|
40
|
+
Access-Control-Allow-Headers:
|
41
|
+
- content-type
|
42
|
+
Expires:
|
43
|
+
- Thu, 01 Jan 1970 00:00:00 GMT
|
44
|
+
Cache-Control:
|
45
|
+
- no-cache
|
46
|
+
Vary:
|
47
|
+
- Accept-Encoding, User-Agent
|
48
|
+
Strict-Transport-Security:
|
49
|
+
- max-age=15552015; preload
|
50
|
+
Public-Key-Pins:
|
51
|
+
- pin-sha256="cN0QSpPIkuwpT6iP2YjEo1bEwGpH/yiUn6yhdy+HNto="; pin-sha256="WGJkyYjx1QMdMe0UqlyOKXtydPDVrk7sl2fV+nNm1r4=";
|
52
|
+
pin-sha256="LrKdTxZLRTvyHM4/atX2nquX9BeHRZMCxg3cf4rhc2I="; max-age=864000
|
53
|
+
X-Frame-Options:
|
54
|
+
- deny
|
55
|
+
X-Xss-Protection:
|
56
|
+
- 1; mode=block
|
57
|
+
X-Request-Id:
|
58
|
+
- 7baa834ace4d887a
|
59
|
+
Cf-Cache-Status:
|
60
|
+
- DYNAMIC
|
61
|
+
Set-Cookie:
|
62
|
+
- __cf_bm=Jj2wYqfRAvwONmpGOPS1PLbWjmnwoK_n4mycpZkZahw-1681963568-0-AQ21YzKap60LKcqgWHbD47qi83YpH8yW22KVTkw5+ReZo7HK8HoTpcdcOcIr4TeU7FTjJux+ApY5iBXS4emBKqU=;
|
63
|
+
path=/; expires=Thu, 20-Apr-23 04:36:08 GMT; domain=.w3.org; HttpOnly; Secure;
|
64
|
+
SameSite=None
|
65
|
+
Server:
|
66
|
+
- cloudflare
|
67
|
+
Cf-Ray:
|
68
|
+
- 7baa834ace4d887a-LHR
|
69
|
+
Alt-Svc:
|
70
|
+
- h3=":443"; ma=86400, h3-29=":443"; ma=86400
|
71
|
+
body:
|
72
|
+
encoding: ASCII-8BIT
|
73
|
+
string: '{"messages":[],"source":{"type":"text/html","encoding":"UTF-8","code":"<!DOCTYPE
|
74
|
+
html> \n<html lang=\"en\">\n<head> \n <meta charset=\"UTF-8\">\n <title>Valid
|
75
|
+
HTML Example</title>\n</head> \n\n<body>\n <h1>This HTML is invalid</h1>\n \n <p>On
|
76
|
+
this page we will make some mistakes, to see the validator in action.</p>\n <p>On
|
77
|
+
the web we can create links to the <a href=\"https://www.w3.org/\">W3C</a>,
|
78
|
+
the group that determines web technologies.</p>\n <p>The <a href=\"http://validator.w3.org/\">validator</a>
|
79
|
+
is a tool that aids us in finding errors</p>\n</body>\n</html>"}}
|
80
|
+
|
81
|
+
'
|
82
|
+
recorded_at: Thu, 20 Apr 2023 04:06:08 GMT
|
83
|
+
recorded_with: VCR 6.1.0
|
File without changes
|
File without changes
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>Invalid HTML Example</title>
|
6
|
+
<noscript><img src="https://example.com/image.gif"></noscript>
|
7
|
+
</head>
|
8
|
+
|
9
|
+
<body>
|
10
|
+
<h1>This HTML is invalid</h1>
|
11
|
+
|
12
|
+
<p>On this page we will make some mistakes, to see the validator in action.
|
13
|
+
<p>On the web we can create links to the <a href="https://www.w3.org/">W3C</a>, the group that determines web technologies.</p>
|
14
|
+
<p>The <a href="http://validator.w3.org/>validator</a> is a tool that aids us in finding errors</p>
|
15
|
+
</body>
|
16
|
+
</html>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<title>Valid HTML Example</title>
|
6
|
+
</head>
|
7
|
+
|
8
|
+
<body>
|
9
|
+
<h1>This HTML is invalid</h1>
|
10
|
+
|
11
|
+
<p>On this page we will make some mistakes, to see the validator in action.</p>
|
12
|
+
<p>On the web we can create links to the <a href="https://www.w3.org/">W3C</a>, the group that determines web technologies.</p>
|
13
|
+
<p>The <a href="http://validator.w3.org/">validator</a> is a tool that aids us in finding errors</p>
|
14
|
+
</body>
|
15
|
+
</html>
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe Jekyll::Validator do
|
4
|
+
let(:config) do
|
5
|
+
config = YAML.safe_load(File.read(File.join(__dir__, "../fixtures", "_config.yml")))
|
6
|
+
Jekyll.configuration(config)
|
7
|
+
end
|
8
|
+
let(:site) { Jekyll::Site.new(config) }
|
9
|
+
|
10
|
+
it "has a version number" do
|
11
|
+
expect(Jekyll::Validator::VERSION).not_to be_nil
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when on a website" do
|
15
|
+
let(:validator) { class_double(described_class, call: nil) }
|
16
|
+
let(:logger) { instance_double(Logger, info: nil) }
|
17
|
+
|
18
|
+
context "when validating the site" do
|
19
|
+
before do
|
20
|
+
stub_const "Jekyll::Validator", validator
|
21
|
+
site.process
|
22
|
+
end
|
23
|
+
|
24
|
+
it "is called for all included css anf html" do
|
25
|
+
expect(validator).to have_received(:call).exactly(4).times
|
26
|
+
end
|
27
|
+
|
28
|
+
it "excludes excluded files" do
|
29
|
+
expect(validator).not_to have_received(:call).with("_site/files/excluded.css")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
context "with HTML" do
|
34
|
+
before do
|
35
|
+
site.process
|
36
|
+
end
|
37
|
+
|
38
|
+
it "logs errors" do
|
39
|
+
VCR.use_cassette("html_invalid") do
|
40
|
+
allow(Jekyll).to receive(:logger).and_return(logger)
|
41
|
+
described_class.call(File.join(__dir__, "../../_site/files", "invalid.html"))
|
42
|
+
expect(logger).to have_received(:info).exactly(8).times
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
it "does not log errors when valid" do
|
47
|
+
VCR.use_cassette("html_valid") do
|
48
|
+
allow(Jekyll).to receive(:logger).and_return(logger)
|
49
|
+
described_class.call(File.join(__dir__, "../../_site/files", "valid.html"))
|
50
|
+
expect(logger).to have_received(:info).exactly(2).times
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
context "with CSS" do
|
56
|
+
before do
|
57
|
+
site.process
|
58
|
+
end
|
59
|
+
|
60
|
+
it "logs errors" do
|
61
|
+
VCR.use_cassette("css_invalid") do
|
62
|
+
allow(Jekyll).to receive(:logger).and_return(logger)
|
63
|
+
described_class.call(File.join(__dir__, "../../_site/files", "invalid.css"))
|
64
|
+
expect(logger).to have_received(:info).exactly(3).times
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
it "does not log errors when valid" do
|
69
|
+
VCR.use_cassette("css_valid") do
|
70
|
+
allow(Jekyll).to receive(:logger).and_return(logger)
|
71
|
+
described_class.call(File.join(__dir__, "../../_site/files", "valid.css"))
|
72
|
+
expect(logger).to have_received(:info).exactly(2).times
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "jekyll"
|
4
|
+
require "vcr"
|
5
|
+
|
6
|
+
require File.join(__dir__, "../lib/jekyll-validator")
|
7
|
+
|
8
|
+
VCR.configure do |config|
|
9
|
+
config.allow_http_connections_when_no_cassette = true
|
10
|
+
config.cassette_library_dir = File.join(__dir__, "fixtures/cassettes")
|
11
|
+
config.hook_into :webmock
|
12
|
+
config.configure_rspec_metadata!
|
13
|
+
end
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
17
|
+
|
18
|
+
config.disable_monkey_patching!
|
19
|
+
|
20
|
+
config.expect_with :rspec do |c|
|
21
|
+
c.syntax = :expect
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-validator
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nicholas Wieland
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2023-04-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '5.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '5.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: rainbow
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.0'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '4.0'
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.0'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '4.0'
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: w3c_validators
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '1.0'
|
60
|
+
- - "<"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '2.0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '1.0'
|
70
|
+
- - "<"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '2.0'
|
73
|
+
description: Calls the W3C Validator API with every page Jekyll generates and displays
|
74
|
+
the validation errors.
|
75
|
+
email:
|
76
|
+
- ngw@nofeed.org
|
77
|
+
executables: []
|
78
|
+
extensions: []
|
79
|
+
extra_rdoc_files: []
|
80
|
+
files:
|
81
|
+
- ".github/workflows/main.yml"
|
82
|
+
- ".gitignore"
|
83
|
+
- ".rspec"
|
84
|
+
- ".rubocop.yml"
|
85
|
+
- CHANGELOG.md
|
86
|
+
- CODE_OF_CONDUCT.md
|
87
|
+
- Gemfile
|
88
|
+
- Gemfile.lock
|
89
|
+
- LICENSE
|
90
|
+
- README.md
|
91
|
+
- Rakefile
|
92
|
+
- bin/console
|
93
|
+
- bin/setup
|
94
|
+
- jekyll-validator.gemspec
|
95
|
+
- lib/jekyll-validator.rb
|
96
|
+
- lib/jekyll-validator/version.rb
|
97
|
+
- spec/fixtures/_config.yml
|
98
|
+
- spec/fixtures/cassettes/css_invalid.yml
|
99
|
+
- spec/fixtures/cassettes/css_valid.yml
|
100
|
+
- spec/fixtures/cassettes/html_invalid.yml
|
101
|
+
- spec/fixtures/cassettes/html_valid.yml
|
102
|
+
- spec/fixtures/files/excluded.css
|
103
|
+
- spec/fixtures/files/excluded.txt
|
104
|
+
- spec/fixtures/files/invalid.css
|
105
|
+
- spec/fixtures/files/invalid.html
|
106
|
+
- spec/fixtures/files/valid.css
|
107
|
+
- spec/fixtures/files/valid.html
|
108
|
+
- spec/jekyll-validator/validator_spec.rb
|
109
|
+
- spec/spec_helper.rb
|
110
|
+
homepage: https://github.com/nofeed/jekyll-validator
|
111
|
+
licenses:
|
112
|
+
- Beerware
|
113
|
+
metadata:
|
114
|
+
allowed_push_host: https://rubygems.org
|
115
|
+
homepage_uri: https://github.com/nofeed/jekyll-validator
|
116
|
+
source_code_uri: https://github.com/nofeed/jekyll-validator
|
117
|
+
changelog_uri: https://github.com/nofeed/jekyll-validator/blob/main/CHANGELOG.md
|
118
|
+
rubygems_mfa_required: 'true'
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: 2.6.0
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
requirements: []
|
134
|
+
rubygems_version: 3.3.7
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: Validates html against W3C Validator.
|
138
|
+
test_files: []
|