Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
Added support for python 3.5
Browse files Browse the repository at this point in the history
It replaces the use of attrfind in favor of attrfind_tolerant, as
the former was removed in python 3.5.

Fixes deezer#8.
  • Loading branch information
sk- committed Dec 12, 2015
1 parent 4fc1fab commit d06e4fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "pypy"
- "pypy3"
# command to install dependencies
Expand Down
7 changes: 4 additions & 3 deletions html_linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ def get_attribute_line_column(tag_definition, line, column, attribute):
Return:
A (line, column) tuple representing the position of the attribute.
"""
for match in HTMLParser.attrfind.finditer(tag_definition):
for match in HTMLParser.attrfind_tolerant.finditer(tag_definition):
if match.group(1).lower() == attribute:
return get_line_column(tag_definition, line, column, match.start(1))

Expand All @@ -480,7 +480,7 @@ def get_value_line_column(tag_definition, line, column, attribute):
Return:
A (line, column) tuple representing the position of the value.
"""
for match in HTMLParser.attrfind.finditer(tag_definition):
for match in HTMLParser.attrfind_tolerant.finditer(tag_definition):
if match.group(1).lower() == attribute:
if not match.group(3):
pos = match.end(1)
Expand Down Expand Up @@ -797,7 +797,8 @@ def _check_starttag_capitalization(self, tag):

def _check_attributes_case_quotation_entities(self, tag, unused_attrs):
original_def = self.get_starttag_text()
for match in HTMLParser.attrfind.finditer(original_def, len(tag) + 1):
for match in HTMLParser.attrfind_tolerant.finditer(original_def,
len(tag) + 1):
# We do not use islower() due to http://bugs.python.org/issue13822.
if match.group(1) != match.group(1).lower():
line, column = self.get_attribute_line_column(
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

setup(
name='html-linter',
version='0.1.9',
version='0.2.0',
description='Lints an HTML5 file using Google\'s style guide',
long_description=open('README.rst').read(),
author='Sebastian Kreft',
Expand All @@ -39,6 +39,7 @@
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Software Development',
],
Expand Down

0 comments on commit d06e4fc

Please sign in to comment.