Skip to content

Commit b7cce84

Browse files
committed
Remove trailing whitespace (fixes html5lib#18).
1 parent caec8e9 commit b7cce84

36 files changed

+460
-460
lines changed

html5lib/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import absolute_import, division, unicode_literals
22

3-
"""
3+
"""
44
HTML parsing library based on the WHATWG "HTML5"
55
specification. The parser is designed to be compatible with existing
66
HTML found in the wild and implements well-defined error recovery that
@@ -10,7 +10,7 @@
1010
1111
import html5lib
1212
f = open("my_document.html")
13-
tree = html5lib.parse(f)
13+
tree = html5lib.parse(f)
1414
"""
1515
__version__ = "0.95-dev"
1616
from .html5parser import HTMLParser, parse, parseFragment

html5lib/constants.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
EOF = None
77

88
E = {
9-
"null-character":
9+
"null-character":
1010
_("Null character in input stream, replaced with U+FFFD."),
11-
"invalid-codepoint":
11+
"invalid-codepoint":
1212
_("Invalid codepoint in stream."),
1313
"incorrectly-placed-solidus":
1414
_("Solidus (/) incorrectly placed in tag."),
@@ -378,7 +378,7 @@
378378
(namespaces["html"], "iframe"),
379379
# Note that image is commented out in the spec as "this isn't an
380380
# element that can end up on the stack, so it doesn't matter,"
381-
(namespaces["html"], "image"),
381+
(namespaces["html"], "image"),
382382
(namespaces["html"], "img"),
383383
(namespaces["html"], "input"),
384384
(namespaces["html"], "isindex"),
@@ -3069,7 +3069,7 @@
30693069
"ParseError":7
30703070
}
30713071

3072-
tagTokenTypes = frozenset((tokenTypes["StartTag"], tokenTypes["EndTag"],
3072+
tagTokenTypes = frozenset((tokenTypes["StartTag"], tokenTypes["EndTag"],
30733073
tokenTypes["EmptyTag"]))
30743074

30753075

html5lib/filters/optionaltags.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __iter__(self):
1616
for previous, token, next in self.slider():
1717
type = token["type"]
1818
if type == "StartTag":
19-
if (token["data"] or
19+
if (token["data"] or
2020
not self.is_optional_start(token["name"], previous, next)):
2121
yield token
2222
elif type == "EndTag":
@@ -123,10 +123,10 @@ def is_optional_end(self, tagname, next):
123123
# there is no more content in the parent element.
124124
if type in ("StartTag", "EmptyTag"):
125125
return next["name"] in ('address', 'article', 'aside',
126-
'blockquote', 'datagrid', 'dialog',
126+
'blockquote', 'datagrid', 'dialog',
127127
'dir', 'div', 'dl', 'fieldset', 'footer',
128128
'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6',
129-
'header', 'hr', 'menu', 'nav', 'ol',
129+
'header', 'hr', 'menu', 'nav', 'ol',
130130
'p', 'pre', 'section', 'table', 'ul')
131131
else:
132132
return type == "EndTag" or type is None

html5lib/html5parser.py

Lines changed: 50 additions & 50 deletions
Large diffs are not rendered by default.

html5lib/ihatexml.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
letter = " | ".join([baseChar, ideographic])
1919

20-
#Without the
21-
name = " | ".join([letter, digit, ".", "-", "_", combiningCharacter,
20+
#Without the
21+
name = " | ".join([letter, digit, ".", "-", "_", combiningCharacter,
2222
extender])
2323
nameFirst = " | ".join([letter, "_"])
2424

@@ -40,7 +40,7 @@ def charStringToList(chars):
4040
break
4141
if not foundMatch:
4242
assert len(item) == 1
43-
43+
4444
rv.append([ord(item)] * 2)
4545
rv = normaliseCharList(rv)
4646
return rv
@@ -62,7 +62,7 @@ def normaliseCharList(charList):
6262

6363
#We don't really support characters above the BMP :(
6464
max_unicode = int("FFFF", 16)
65-
65+
6666
def missingRanges(charList):
6767
rv = []
6868
if charList[0] != 0:
@@ -103,8 +103,8 @@ def escapeRegexp(string):
103103

104104
class InfosetFilter(object):
105105
replacementRegexp = re.compile(r"U[\dA-F]{5,5}")
106-
def __init__(self, replaceChars = None,
107-
dropXmlnsLocalName = False,
106+
def __init__(self, replaceChars = None,
107+
dropXmlnsLocalName = False,
108108
dropXmlnsAttrNs = False,
109109
preventDoubleDashComments = False,
110110
preventDashAtCommentEnd = False,
@@ -124,7 +124,7 @@ def coerceAttribute(self, name, namespace=None):
124124
if self.dropXmlnsLocalName and name.startswith("xmlns:"):
125125
warnings.warn("Attributes cannot begin with xmlns", DataLossWarning)
126126
return None
127-
elif (self.dropXmlnsAttrNs and
127+
elif (self.dropXmlnsAttrNs and
128128
namespace == "http://www.w3.org/2000/xmlns/"):
129129
warnings.warn("Attributes cannot be in the xml namespace", DataLossWarning)
130130
return None
@@ -140,7 +140,7 @@ def coerceComment(self, data):
140140
warnings.warn("Comments cannot contain adjacent dashes", DataLossWarning)
141141
data = data.replace("--", "- -")
142142
return data
143-
143+
144144
def coerceCharacters(self, data):
145145
if self.replaceFormFeedCharacters:
146146
for i in range(data.count("\x0C")):
@@ -166,7 +166,7 @@ def toXmlName(self, name):
166166
replacement = self.getReplacementCharacter(char)
167167
nameRestOutput = nameRestOutput.replace(char, replacement)
168168
return nameFirstOutput + nameRestOutput
169-
169+
170170
def getReplacementCharacter(self, char):
171171
if char in self.replaceCache:
172172
replacement = self.replaceCache[char]

0 commit comments

Comments
 (0)