Skip to content

Commit 036a51e

Browse files
committed
first commit with everything
0 parents  commit 036a51e

18 files changed

Lines changed: 547 additions & 0 deletions

.gitignore

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Byte-compiled / optimized / DLL files
2+
idea/*
3+
4+
__pycache__/
5+
*.py[cod]
6+
*$py.class
7+
8+
/site/
9+
.idea/
10+
11+
# C extensions
12+
*.so
13+
14+
# Distribution / packaging
15+
.Python
16+
env/
17+
build/
18+
develop-eggs/
19+
dist/
20+
downloads/
21+
eggs/
22+
.eggs/
23+
lib/
24+
lib64/
25+
parts/
26+
sdist/
27+
var/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
32+
# PyInstaller
33+
# Usually these files are written by a python script from a template
34+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
35+
*.manifest
36+
*.spec
37+
38+
# Installer logs
39+
pip-log.txt
40+
pip-delete-this-directory.txt
41+
42+
# Unit test / coverage reports
43+
htmlcov/
44+
.tox/
45+
.coverage
46+
.coverage.*
47+
.cache
48+
nosetests.xml
49+
coverage.xml
50+
*,cover
51+
.hypothesis/
52+
53+
# Translations
54+
*.mo
55+
*.pot
56+
57+
# Django stuff:
58+
*.log
59+
60+
# Sphinx documentation
61+
docs/_build/
62+
63+
# PyBuilder
64+
target/
65+
66+
#Ipython Notebook
67+
.ipynb_checkpoints

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Ronen Ness
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

MANIFEST

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# file GENERATED by distutils, do NOT edit
2+
setup.cfg
3+
setup.py
4+
html_validator\README.md
5+
html_validator\__init__.py
6+
html_validator\html_validator.py

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# html_validator
2+
An **offline** HTML validator in Python, using the standard [v.Nu Html Validator](https://github.com/validator/validator).
3+
4+
Source at [GitHub](https://github.com/RonenNess/html_validator).
5+
Docs at [PythonHosted.org](http://pythonhosted.org/html_validator/).
6+
7+
## Install
8+
9+
Install html_validator via pip:
10+
11+
```python
12+
pip install html_validator
13+
```
14+
15+
In addition you'll need to have Java installed on your machine and Java path properly set (so you can execute jar files from shell / cmd prompt).
16+
17+
## How to use
18+
19+
```html_validator``` provide a single function, ```validate```, which receieve an HTML file path or a list of HTML files and validate them:
20+
21+
```py
22+
from html_validator import validate
23+
24+
errors = validate("test.html")
25+
for err in errors:
26+
print("Type: %s, File: %s, Line: %d, Description: %s" % (err.type, err.file, err.line, err.description))
27+
```
28+
29+
Example output:
30+
31+
```
32+
Type: error, File: test.html, Line: 18, Description: Stray end tag "dv".
33+
Type: error, File: test.html, Line: 15, Description: End tag for "body" seen, but there were unclosed elements.
34+
```
35+
36+
## How it works
37+
38+
There's not much magic here, this package just invokes a pre-compiled ```vnu.jar``` file from Python and parse its output (eg break it into nice Python objects).
39+
40+
## Run Tests
41+
42+
From ```html_validator``` root dir:
43+
44+
```shell
45+
cd tests
46+
python test_all.py
47+
```
48+
49+
Note that the tests are not included in the pypi package, so to run them please clone the git repository from [GitHub](https://github.com/RonenNess/html_validator).
50+
51+
## Changes
52+
53+
.
54+
55+
## Contact
56+
57+
For bugs please use [GitHub issues](https://github.com/RonenNess/html_validator/issues).
58+
For other matters feel free to contact me at ronenness@gmail.com.
59+

docs/index.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# html_validator
2+
An **offline** HTML validator in Python, using the standard [v.Nu Html Validator](https://github.com/validator/validator).
3+
4+
Source at [GitHub](https://github.com/RonenNess/html_validator).
5+
Docs at [PythonHosted.org](http://pythonhosted.org/html_validator/).
6+
7+
## Install
8+
9+
Install html_validator via pip:
10+
11+
```python
12+
pip install html_validator
13+
```
14+
15+
In addition you'll need to have Java installed on your machine and Java path properly set (so you can execute jar files from shell / cmd prompt).
16+
17+
## How to use
18+
19+
```html_validator``` provide a single function, ```validate```, which receieve an HTML file path or a list of HTML files and validate them:
20+
21+
```py
22+
from html_validator import validate
23+
24+
errors = validate("test.html")
25+
for err in errors:
26+
print("Type: %s, File: %s, Line: %d, Description: %s" % (err.type, err.file, err.line, err.description))
27+
```
28+
29+
Example output:
30+
31+
```
32+
Type: error, File: test.html, Line: 18, Description: Stray end tag "dv".
33+
Type: error, File: test.html, Line: 15, Description: End tag for "body" seen, but there were unclosed elements.
34+
```
35+
36+
## How it works
37+
38+
There's not much magic here, this package just invokes a pre-compiled ```vnu.jar``` file from Python and parse its output (eg break it into nice Python objects).
39+
40+
## Run Tests
41+
42+
From ```html_validator``` root dir:
43+
44+
```shell
45+
cd tests
46+
python test_all.py
47+
```
48+
49+
Note that the tests are not included in the pypi package, so to run them please clone the git repository from [GitHub](https://github.com/RonenNess/html_validator).
50+
51+
## Changes
52+
53+
.
54+
55+
## Contact
56+
57+
For bugs please use [GitHub issues](https://github.com/RonenNess/html_validator/issues).
58+
For other matters feel free to contact me at ronenness@gmail.com.
59+

html_validator/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This package wraps the v.Nu HTML validator for Python.
2+
3+
For more info:
4+
https://github.com/RonenNess/html_validator

html_validator/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/python
2+
# -*- coding: utf-8 -*-
3+
__all__ = ['validate', 'MissingValidatorOrJava', 'MissingHtmlFile', 'ValidationError']
4+
5+
__title__ = 'html_validator'
6+
__version__ = '1.0.1'
7+
__author__ = 'Ronen Ness'
8+
__license__ = 'MIT'
9+
10+
from html_validator import validate, MissingValidatorOrJava, MissingHtmlFile, ValidationError
11+
12+

0 commit comments

Comments
 (0)