Skip to content

Commit

Permalink
update vnu.jar to 17.3.0 (#31)
Browse files Browse the repository at this point in the history
* update vnu.jar to 17.3.0

* lint
  • Loading branch information
svenkreiss committed Apr 10, 2017
1 parent 20d7039 commit 53c2831
Show file tree
Hide file tree
Showing 11 changed files with 305 additions and 105 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ before_install:

install:
- "pip install .[tests]"
script: nosetests -vv
script: flake8 && nosetests -vv
1 change: 1 addition & 0 deletions html5validator/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Validate HTML5 files."""
# flake8: noqa

__version__ = "0.2.6"

Expand Down
14 changes: 8 additions & 6 deletions html5validator/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@

from __future__ import unicode_literals

import sys
import logging
from .validator import Validator
import argparse
import logging
import sys

from .validator import Validator
from . import __version__ as VERSION

LOGGER = logging.getLogger(__name__)


def main():
parser = argparse.ArgumentParser(description='[v'+VERSION+'] '+__doc__,
prog='html5validator')
parser = argparse.ArgumentParser(
description='[v' + VERSION + '] ' + __doc__,
prog='html5validator'
)
parser.add_argument('--root', default='.',
help='start directory to search for files to validate')
parser.add_argument('--match', default='*.html',
Expand Down Expand Up @@ -52,7 +54,7 @@ def main():
help=('log level: DEBUG, INFO or WARNING '
'(default: WARNING)'))
parser.add_argument('--version', action='version',
version='%(prog)s '+VERSION)
version='%(prog)s ' + VERSION)
args = parser.parse_args()

logging.basicConfig(level=getattr(logging, args.log))
Expand Down
12 changes: 7 additions & 5 deletions html5validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

from __future__ import unicode_literals

import fnmatch
import logging
import os
import re
import subprocess
import sys
import vnujar
import fnmatch
import logging
import subprocess

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -41,15 +41,17 @@ def __init__(self, directory='.', match='*.html', blacklist=None,
'__init__.py', 'vnu.jar'
)
if sys.platform == 'cygwin':
self.vnu_jar_location = self._cygwin_path_convert(self.vnu_jar_location)
self.vnu_jar_location = self._cygwin_path_convert(
self.vnu_jar_location)

def _normalize_string(self, s):
s = s.replace('“', '"')
s = s.replace('”', '"')
return s

def _cygwin_path_convert(self, filepath):
return subprocess.check_output(['cygpath', '-w', filepath]).strip().decode('utf8')
return subprocess.check_output(
['cygpath', '-w', filepath]).strip().decode('utf8')

def all_files(self, skip_invisible=True):
files = []
Expand Down
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[flake8]
ignore = H301
exclude = venv*/,docs,build,dist,pypy
13 changes: 4 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
import re
import sys

# workaround: nosetests don't exit cleanly with older
# python version (<=2.6 and even <2.7.4)
try:
import multiprocessing
except ImportError:
pass


INSTALL_REQUIRES = []


Expand Down Expand Up @@ -41,7 +33,10 @@

install_requires=INSTALL_REQUIRES,
extras_require={
'tests': ['nose'],
'tests': [
'hacking',
'nose',
],
},
entry_points={
'console_scripts': [
Expand Down
14 changes: 10 additions & 4 deletions tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ def test_valid():
def test_invalid():
assert subprocess.call(['html5validator', '--root=tests/invalid/']) == 1


def test_return_value():
assert subprocess.call(['html5validator', '--root=tests/return_value/', '--match=254.html']) == 254
assert subprocess.call(['html5validator', '--root=tests/return_value/', '--match=255.html']) == 255
assert subprocess.call(['html5validator', '--root=tests/return_value/', '--match=256.html']) == 255
assert subprocess.call(['html5validator', '--root=tests/return_value/',
'--match=254.html']) == 254
assert subprocess.call(['html5validator', '--root=tests/return_value/',
'--match=255.html']) == 255
assert subprocess.call(['html5validator', '--root=tests/return_value/',
'--match=256.html']) == 255


def test_angularjs():
assert subprocess.call([
Expand All @@ -36,7 +41,8 @@ def test_multiple_ignoreres():
o = subprocess.call([
'html5validator',
'--root=tests/multiple_ignores/',
'--ignore-re', 'Attribute “ng-[a-z-]+” not allowed', 'Start tag seen without seeing a doctype first',
'--ignore-re', 'Attribute “ng-[a-z-]+” not allowed',
'Start tag seen without seeing a doctype first',
])
assert o == 0

Expand Down
90 changes: 90 additions & 0 deletions vnujar/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,96 @@ With a few exceptions, this is a record of mainly just user-facing
changes—that is, either changes to the actual behavior of the checker, or
changes to any options/interfaces the checker exposes for developers.

# 17.3.0
26 March 2017
- Allow “color” attribute with link[rel="mask-icon"]
- Allow `meta[name]` to have `itemref`/`itemscope`/`itemtype`/`itemid`
- Allow `allow-top-navigation-by-user-activation` in `iframe[sandbox]`
- Stop hiding “sectioning roots” headings in “Heading-level outline”
- Change error for `role=none` with `img[alt=""]` to warning
- Fix from @xfq for longstanding bug in “Show source” behavior in Web UI
- Fix from @xfq for controlling some runtime params for HTTP behavior
- Fix from @zcorpan to drop unneeded warning for `<menu type=toolbar>`
- Make “Corrupt GZIP trailer” a non-error
- Add `--asciiquotes` option to vnu.jar command-line checker
- Skip lang detection of elements w/ lang attributes not matching `html[lang]`
- Drop Bulgarian lang detection, to prevent Russian misidentification
- Update Estonian/Catalan lang profiles, to prevent Russian misidentification
- Update ICU4J to 58.2

# 17.2.1
06 February 2017
- Fix bug in language detector that when running the vnu.jar command-line
checker on a list of documents caused it to sometimes misidentify the
language of the 2nd, 3rd, 4th, etc., documents. The bug also caused the
memory used by the checker to increase as the number of documents
checked at the same time increased, and caused performance to degrade.
- Allow `aria-required` attribute everywhere `required` attribute is allowed
- Add `--exit-zero-always` option to vnu.jar command-line checker
- Fix longstanding bug around code for identifying overlapping cells in
table-integrity checker (the bug somewhat frequently gets hit when checking
Wikipedia pages but otherwise in the wild gets hit only extremely rarely)

# 17.2.0
30 January 2017
- Fix bug that broke vnu.jar command-line checking of URLs
- Fix bug in `rel="shortcut icon"` checking
- Add `nu.client.EmbeddedValidator` for use as library by other Java apps
- Disallow `tfoot` before `tbody`

# 17.1.0
15 January 2017
This release adds the following changes to the vnu.jar command-line
checker that had already been made available in the Web-based checker in
the 17.0.1 release.
- Allow **custom elements** (names containing “-”; e.g., `<foo-bar>`)
- Allow anything in `template` element subtrees (exclude from checking)

# 17.0.1
08 January 2017
- New language-detection feature; warns for missing/wrong `html[lang]`
- New option `--no-langdetect` for `vnu.jar` disables language detection
- Allow **custom elements** (names containing “-”; e.g., `<foo-bar>`)
- Allow the `is` attribute (for custom elements)
- Allow **ARIA 1.1** roles/states/properties
- Warn for viewport values that restrict resizing
- Allow `div` in `dl`, to group `dt`+`dd` sets
- Allow anything in `template` element subtrees (exclude from checking)
- Allow `link[rel=preload]` in body
- Disallow `sizes` attribute on non-icon `link`
- Allow `<link rel=apple-touch-icon sizes=…>`
- Allow comments before doctype (warning dropped)
- Allow `<video playsinline>`
- Allow `<iframe allowusermedia>`
- Warn for `sandbox="allow-scripts allow-same-origin"`
- New option to check error pages (404s and other non-200 responses)
- Allow `link[nonce]`
- Disallow `input[datetime]`
- Disallow `mediagroup` attribute
- Allow `menu[type=popup]`, disallow `menu[type=context]`
- Disallow non-http/https URLs in `a[ping]`
- Allow `referrerpolicy` attribute
- Warn for `html[manifest]` (obsolete)
- Disallow `keygen` (obsolete)
- Warn for `about:legacy-compat` in doctype
- Align SVG+ARIA checking with ARIA requirements in current SVG spec
- Allow `h1`-`h6` & `hgroup` in `legend`
- Ignore SSL errors when checking remote documents
- Allow `script[type=module]` (supported in Edge but not in other UAs yet)
- Disallow content in `iframe` (must be empty)
- Make `vnu.jar` check `.xhtml` files using XML-specific RelaxNG grammar
- Allow `th[abbr]`
- Allow any value in SVG `class` attribute (not just XML-compatible names)
- Disallow HTML4/XHTML1 Transitional doctype
- Allow CSP `require-sri-for` directive (updated to Salvation 2.2.0)
- Allow any element or text as content of SVG `desc`
- Allow SVG `vector-effect=non-scaling-stroke`
- Allow only text in `rp`
- Disallow multiple `meta[name=description]`
- Disallow URLs with port values greater than 65535
- Disallow `<input name=isindex>`
- Disallow empty `autocomplete` attribute

# 16.6.29
29 June 2016
- JSON/gnu message formats updated to ensure doc URL is always included
Expand Down
Loading

0 comments on commit 53c2831

Please sign in to comment.