blob: d772ffb96e8a09b54173862e21750c0e9e39455c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# w3c-validator
The `w3c-validator.py` script uses the `curl(1)` command to submit
HTML files and URLs to the [W3C Markup Validation Service](https://validator.w3.org/)
and CSS files and URLs to the [W3C CSS Validation Service](https://jigsaw.w3.org/css-validator/).
The script parses and reports the JSON results returned by validators.
## Requirements
- Python
- 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:
```bash
$ w3c-validator tests/data/something-html5-file.html
validating: tests/data/something-html5-file.html ...
error: line 822: The tt element is obsolete. Use CSS instead.
```
```bash
$ w3c-validator https://www.methods.co.nz/asciidoc/layout1.css
validating: https://www.methods.co.nz/asciidoc/layout1.css ...
```
## References
- [User's guide for the W3C Markup Validator](https://validator.w3.org/docs/users.html)
- [CSS Validator User's Manual](https://jigsaw.w3.org/css-validator/manual.html)
## License
This work is licensed under the [GNU GPLv3+](LICENSE)
|