w3c-validator
The w3c-validator.py
script uses the curl(1)
command to submit
HTML files and URLs to the W3C Markup Validation Service
and CSS files and URLs to the W3C CSS Validation Service.
The script parses and reports the JSON results returned by validators.
Requirements
- Python 3
- Curl
- An Internet connection
Usage
The script command syntax is:
python w3c-validator.py [--verbose] FILE|URL...
- The optional
--verbose
option will print information about what is going on internally. - Names with a
.css
extension are treated as CSS, all other names are assumed to contain HTML. - Names starting with
https://
are assumed to be publically accessible URLs, all other names are assumed to be local file names. - Any mix of one or more local files or HTTP URLs can be specified.
- If one or more files fail validation then the exit status will be 1, if no errors occurs the exits status will be zero.
Examples:
$ python w3c-validator.py tests/data/something-html5-file.html
validating: tests/data/something-html5-file.html ...
error: line 822: The tt element is obsolete. Use CSS instead.
$ python w3c-validator.py https://www.methods.co.nz/asciidoc/layout1.css
validating: https://www.methods.co.nz/asciidoc/layout1.css ...
References
License
This work is licensed under the GNU GPLv3+