No project description provided
Project description
# Online W3C Validator
Pure Python command line for HTML validation using W3C online validator. It could be very handy for using it in a CI pipline.
## Installation
```bash
pip install -U Online-W3C-Validator
```
## How to use
You can user the CLI command:
```bash
w3c_validator http://www.google.com some_file.html
```
Example output:
```
INFO:w3c_validator.validator:Files to validate:
http://www.google.com
INFO:w3c_validator.validator:Number of files: 1
INFO:w3c_validator.validator:validating: http://www.google.com ...
error: line 2: CSS: “display”: “inline-box” is not a “display” value in “inline-box” in “.ds”.
error: line 2: The “bgcolor” attribute on the “body” element is obsolete. Use CSS instead.
error: line 5: Element “nobr” not allowed as child of element “div” in this context. (Suppressing further errors from this subtree.)
error: line 5: Attribute “width” not allowed on element “div” at this point.
error: line 5: Element “nobr” not allowed as child of element “div” in this context. (Suppressing further errors from this subtree.)
error: line 5: The “center” element is obsolete. Use CSS instead.
error: line 5: The “clear” attribute on the “br” element is obsolete. Use CSS instead.
```
Or you can use the fuction **validdate** provied by the package, that thakes either HTML file name or URL as a single parameter an returns JSON object with the validation output.
```py
from w3c_validator import validate
messages = validate("http://www.google.com")["messages"]
for m in messages:
print("Type: %(type)s, Line: %(lastLine)d, Description: %(message)s" % m)
```
Example output:
```
Type: error, Line: 2, Description: CSS: “display”: “inline-box” is not a “display” value in “inline-box” in “.ds”.
Type: error, Line: 2, Description: The “bgcolor” attribute on the “body” element is obsolete. Use CSS instead.
Type: error, Line: 5, Description: Element “nobr” not allowed as child of element “div” in this context. (Suppressing further errors from this subtree.)
Type: error, Line: 5, Description: Attribute “width” not allowed on element “div” at this point.
Type: error, Line: 5, Description: Element “nobr” not allowed as child of element “div” in this context. (Suppressing further errors from this subtree.)
Type: error, Line: 5, Description: The “center” element is obsolete. Use CSS instead.
Type: error, Line: 5, Description: The “clear” attribute on the “br” element is obsolete. Use CSS instead.
Type: error, Line: 5, Description: The “align” attribute on the “div” element is obsolete. Use CSS instead.
Type: error, Line: 5, Description: Attribute “nowrap” not allowed on element “div” at this point.
...
```
## Contact
For bugs please use [GitHub issues](https://github.com/RonenNess/html_validator/issues).
For other matters feel free to contact me at nad2000@gmail.com.
Pure Python command line for HTML validation using W3C online validator. It could be very handy for using it in a CI pipline.
## Installation
```bash
pip install -U Online-W3C-Validator
```
## How to use
You can user the CLI command:
```bash
w3c_validator http://www.google.com some_file.html
```
Example output:
```
INFO:w3c_validator.validator:Files to validate:
http://www.google.com
INFO:w3c_validator.validator:Number of files: 1
INFO:w3c_validator.validator:validating: http://www.google.com ...
error: line 2: CSS: “display”: “inline-box” is not a “display” value in “inline-box” in “.ds”.
error: line 2: The “bgcolor” attribute on the “body” element is obsolete. Use CSS instead.
error: line 5: Element “nobr” not allowed as child of element “div” in this context. (Suppressing further errors from this subtree.)
error: line 5: Attribute “width” not allowed on element “div” at this point.
error: line 5: Element “nobr” not allowed as child of element “div” in this context. (Suppressing further errors from this subtree.)
error: line 5: The “center” element is obsolete. Use CSS instead.
error: line 5: The “clear” attribute on the “br” element is obsolete. Use CSS instead.
```
Or you can use the fuction **validdate** provied by the package, that thakes either HTML file name or URL as a single parameter an returns JSON object with the validation output.
```py
from w3c_validator import validate
messages = validate("http://www.google.com")["messages"]
for m in messages:
print("Type: %(type)s, Line: %(lastLine)d, Description: %(message)s" % m)
```
Example output:
```
Type: error, Line: 2, Description: CSS: “display”: “inline-box” is not a “display” value in “inline-box” in “.ds”.
Type: error, Line: 2, Description: The “bgcolor” attribute on the “body” element is obsolete. Use CSS instead.
Type: error, Line: 5, Description: Element “nobr” not allowed as child of element “div” in this context. (Suppressing further errors from this subtree.)
Type: error, Line: 5, Description: Attribute “width” not allowed on element “div” at this point.
Type: error, Line: 5, Description: Element “nobr” not allowed as child of element “div” in this context. (Suppressing further errors from this subtree.)
Type: error, Line: 5, Description: The “center” element is obsolete. Use CSS instead.
Type: error, Line: 5, Description: The “clear” attribute on the “br” element is obsolete. Use CSS instead.
Type: error, Line: 5, Description: The “align” attribute on the “div” element is obsolete. Use CSS instead.
Type: error, Line: 5, Description: Attribute “nowrap” not allowed on element “div” at this point.
...
```
## Contact
For bugs please use [GitHub issues](https://github.com/RonenNess/html_validator/issues).
For other matters feel free to contact me at nad2000@gmail.com.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file Online-W3C-Validator-0.3a0.tar.gz.
File metadata
- Download URL: Online-W3C-Validator-0.3a0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c429e7d3ac22f1d191c5bc8c115b2452545fa8156125b79132f226c65a83730d
|
|
| MD5 |
094cb0afe8838105f33be6bbfe7b2960
|
|
| BLAKE2b-256 |
4898d69cba72d123fa8d8c9eb9bd3caa0a0e7ad5e60efabed871cf0130eda17a
|