Skip to content

Commit

Permalink
Rename filters._base to .base to reflect public status
Browse files Browse the repository at this point in the history
  • Loading branch information
gsnedders committed Jul 13, 2016
1 parent 19891c5 commit 7bbde54
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions html5lib/filters/alphabeticalattributes.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from __future__ import absolute_import, division, unicode_literals

from . import _base
from . import base

try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict


class Filter(_base.Filter):
class Filter(base.Filter):
def __iter__(self):
for token in _base.Filter.__iter__(self):
for token in base.Filter.__iter__(self):
if token["type"] in ("StartTag", "EmptyTag"):
attrs = OrderedDict()
for name, value in sorted(token["data"].items(),
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions html5lib/filters/inject_meta_charset.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
from __future__ import absolute_import, division, unicode_literals

from . import _base
from . import base


class Filter(_base.Filter):
class Filter(base.Filter):
def __init__(self, source, encoding):
_base.Filter.__init__(self, source)
base.Filter.__init__(self, source)
self.encoding = encoding

def __iter__(self):
state = "pre_head"
meta_found = (self.encoding is None)
pending = []

for token in _base.Filter.__iter__(self):
for token in base.Filter.__iter__(self):
type = token["type"]
if type == "StartTag":
if token["name"].lower() == "head":
Expand Down
6 changes: 3 additions & 3 deletions html5lib/filters/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

from six import text_type

from . import _base
from . import base
from ..constants import namespaces, voidElements

from ..constants import spaceCharacters
spaceCharacters = "".join(spaceCharacters)


class Filter(_base.Filter):
class Filter(base.Filter):
def __init__(self, source, require_matching_tags=True):
super(Filter, self).__init__(source)
self.require_matching_tags = require_matching_tags

def __iter__(self):
open_elements = []
for token in _base.Filter.__iter__(self):
for token in base.Filter.__iter__(self):
type = token["type"]
if type in ("StartTag", "EmptyTag"):
namespace = token["namespace"]
Expand Down
4 changes: 2 additions & 2 deletions html5lib/filters/optionaltags.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from __future__ import absolute_import, division, unicode_literals

from . import _base
from . import base


class Filter(_base.Filter):
class Filter(base.Filter):
def slider(self):
previous1 = previous2 = None
for token in self.source:
Expand Down
6 changes: 3 additions & 3 deletions html5lib/filters/sanitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from six.moves import urllib_parse as urlparse

from . import _base
from . import base
from ..constants import namespaces, prefixes

__all__ = ["Filter"]
Expand Down Expand Up @@ -712,7 +712,7 @@
re.VERBOSE)


class Filter(_base.Filter):
class Filter(base.Filter):
""" sanitization of XHTML+MathML+SVG and of inline style attributes."""
def __init__(self,
source,
Expand All @@ -739,7 +739,7 @@ def __init__(self,
self.svg_allow_local_href = svg_allow_local_href

def __iter__(self):
for token in _base.Filter.__iter__(self):
for token in base.Filter.__iter__(self):
token = self.sanitize_token(token)
if token:
yield token
Expand Down
6 changes: 3 additions & 3 deletions html5lib/filters/whitespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

import re

from . import _base
from . import base
from ..constants import rcdataElements, spaceCharacters
spaceCharacters = "".join(spaceCharacters)

SPACES_REGEX = re.compile("[%s]+" % spaceCharacters)


class Filter(_base.Filter):
class Filter(base.Filter):

spacePreserveElements = frozenset(["pre", "textarea"] + list(rcdataElements))

def __iter__(self):
preserve = 0
for token in _base.Filter.__iter__(self):
for token in base.Filter.__iter__(self):
type = token["type"]
if type == "StartTag" \
and (preserve or token["name"] in self.spacePreserveElements):
Expand Down

0 comments on commit 7bbde54

Please sign in to comment.