Skip to content

Commit

Permalink
first commit with everything
Browse files Browse the repository at this point in the history
  • Loading branch information
RonenNess committed Sep 11, 2017
0 parents commit 036a51e
Show file tree
Hide file tree
Showing 18 changed files with 547 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Byte-compiled / optimized / DLL files
idea/*

__pycache__/
*.py[cod]
*$py.class

/site/
.idea/

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

#Ipython Notebook
.ipynb_checkpoints
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Ronen Ness

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# file GENERATED by distutils, do NOT edit
setup.cfg
setup.py
html_validator\README.md
html_validator\__init__.py
html_validator\html_validator.py
59 changes: 59 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# html_validator
An **offline** HTML validator in Python, using the standard [v.Nu Html Validator](https://github.com/validator/validator).

Source at [GitHub](https://github.com/RonenNess/html_validator).
Docs at [PythonHosted.org](http://pythonhosted.org/html_validator/).

## Install

Install html_validator via pip:

```python
pip install html_validator
```

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).

## How to use

```html_validator``` provide a single function, ```validate```, which receieve an HTML file path or a list of HTML files and validate them:

```py
from html_validator import validate

errors = validate("test.html")
for err in errors:
print("Type: %s, File: %s, Line: %d, Description: %s" % (err.type, err.file, err.line, err.description))
```

Example output:

```
Type: error, File: test.html, Line: 18, Description: Stray end tag "dv".
Type: error, File: test.html, Line: 15, Description: End tag for "body" seen, but there were unclosed elements.
```

## How it works

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).

## Run Tests

From ```html_validator``` root dir:

```shell
cd tests
python test_all.py
```

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).

## Changes

.

## Contact

For bugs please use [GitHub issues](https://github.com/RonenNess/html_validator/issues).
For other matters feel free to contact me at ronenness@gmail.com.

59 changes: 59 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# html_validator
An **offline** HTML validator in Python, using the standard [v.Nu Html Validator](https://github.com/validator/validator).

Source at [GitHub](https://github.com/RonenNess/html_validator).
Docs at [PythonHosted.org](http://pythonhosted.org/html_validator/).

## Install

Install html_validator via pip:

```python
pip install html_validator
```

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).

## How to use

```html_validator``` provide a single function, ```validate```, which receieve an HTML file path or a list of HTML files and validate them:

```py
from html_validator import validate

errors = validate("test.html")
for err in errors:
print("Type: %s, File: %s, Line: %d, Description: %s" % (err.type, err.file, err.line, err.description))
```

Example output:

```
Type: error, File: test.html, Line: 18, Description: Stray end tag "dv".
Type: error, File: test.html, Line: 15, Description: End tag for "body" seen, but there were unclosed elements.
```

## How it works

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).

## Run Tests

From ```html_validator``` root dir:

```shell
cd tests
python test_all.py
```

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).

## Changes

.

## Contact

For bugs please use [GitHub issues](https://github.com/RonenNess/html_validator/issues).
For other matters feel free to contact me at ronenness@gmail.com.

4 changes: 4 additions & 0 deletions html_validator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This package wraps the v.Nu HTML validator for Python.

For more info:
https://github.com/RonenNess/html_validator
12 changes: 12 additions & 0 deletions html_validator/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
__all__ = ['validate', 'MissingValidatorOrJava', 'MissingHtmlFile', 'ValidationError']

__title__ = 'html_validator'
__version__ = '1.0.1'
__author__ = 'Ronen Ness'
__license__ = 'MIT'

from html_validator import validate, MissingValidatorOrJava, MissingHtmlFile, ValidationError


Loading

0 comments on commit 036a51e

Please sign in to comment.