Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita8ba43e

Browse files
authored
Merge pull request#270 from gsnedders/rename_stuff
2 parents945911b +8cb144b commita8ba43e

40 files changed

+219
-275
lines changed

‎CHANGES.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ Released on XXX
5050
with a set of keyword arguments: override_encoding, transport_encoding,
5151
same_origin_parent_encoding, likely_encoding, and default_encoding.**
5252

53+
* **Move filters._base, treebuilder._base, and treewalkers._base to .base
54+
to clarify their status as public.**
55+
56+
* **Get rid of the sanitizer package. Merge sanitizer.sanitize into the
57+
sanitizer.htmlsanitizer module and move that to saniziter. This means
58+
anyone who used sanitizer.sanitize or sanitizer.HTMLSanitizer needs no
59+
code changes.**
60+
61+
* **Rename treewalkers.lxmletree to .etree_lxml and
62+
treewalkers.genshistream to .genshi to have a consistent API.**
63+
64+
* Move a whole load of stuff (inputstream, ihatexml, trie, tokenizer,
65+
utils) to be underscore prefixed to clarify their status as private.
66+
5367

5468
0.9999999/1.0b8
5569
~~~~~~~~~~~~~~~

‎doc/html5lib.filters.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
filters Package
22
===============
33

4-
:mod:`_base` Module
4+
:mod:`base` Module
55
-------------------
66

7-
..automodule::html5lib.filters._base
7+
..automodule::html5lib.filters.base
88
:members:
99
:undoc-members:
1010
:show-inheritance:

‎doc/html5lib.rst

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,42 +25,10 @@ html5lib Package
2525
:undoc-members:
2626
:show-inheritance:
2727

28-
:mod:`ihatexml` Module
28+
:mod:`serializer` Module
2929
----------------------
3030

31-
..automodule::html5lib.ihatexml
32-
:members:
33-
:undoc-members:
34-
:show-inheritance:
35-
36-
:mod:`inputstream` Module
37-
-------------------------
38-
39-
..automodule::html5lib.inputstream
40-
:members:
41-
:undoc-members:
42-
:show-inheritance:
43-
44-
:mod:`sanitizer` Module
45-
-----------------------
46-
47-
..automodule::html5lib.sanitizer
48-
:members:
49-
:undoc-members:
50-
:show-inheritance:
51-
52-
:mod:`tokenizer` Module
53-
-----------------------
54-
55-
..automodule::html5lib.tokenizer
56-
:members:
57-
:undoc-members:
58-
:show-inheritance:
59-
60-
:mod:`utils` Module
61-
-------------------
62-
63-
..automodule::html5lib.utils
31+
..automodule::html5lib.serializer
6432
:members:
6533
:undoc-members:
6634
:show-inheritance:
@@ -71,7 +39,6 @@ Subpackages
7139
..toctree::
7240

7341
html5lib.filters
74-
html5lib.serializer
7542
html5lib.treebuilders
7643
html5lib.treewalkers
7744

‎doc/html5lib.serializer.rst

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎doc/html5lib.treebuilders.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ treebuilders Package
99
:undoc-members:
1010
:show-inheritance:
1111

12-
:mod:`_base` Module
12+
:mod:`base` Module
1313
-------------------
1414

15-
..automodule::html5lib.treebuilders._base
15+
..automodule::html5lib.treebuilders.base
1616
:members:
1717
:undoc-members:
1818
:show-inheritance:

‎doc/html5lib.treewalkers.rst

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ treewalkers Package
99
:undoc-members:
1010
:show-inheritance:
1111

12-
:mod:`_base` Module
12+
:mod:`base` Module
1313
-------------------
1414

15-
..automodule::html5lib.treewalkers._base
15+
..automodule::html5lib.treewalkers.base
1616
:members:
1717
:undoc-members:
1818
:show-inheritance:
@@ -33,18 +33,19 @@ treewalkers Package
3333
:undoc-members:
3434
:show-inheritance:
3535

36-
:mod:`genshistream` Module
37-
--------------------------
36+
:mod:`etree_lxml` Module
37+
-----------------------
3838

39-
..automodule::html5lib.treewalkers.genshistream
39+
..automodule::html5lib.treewalkers.etree_lxml
4040
:members:
4141
:undoc-members:
4242
:show-inheritance:
4343

44-
:mod:`lxmletree` Module
45-
-----------------------
4644

47-
..automodule::html5lib.treewalkers.lxmletree
45+
:mod:`genshi` Module
46+
--------------------------
47+
48+
..automodule::html5lib.treewalkers.genshi
4849
:members:
4950
:undoc-members:
50-
:show-inheritance:
51+
:show-inheritance:
File renamed without changes.

‎html5lib/inputstream.pyrenamed to‎html5lib/_inputstream.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from .constantsimportEOF,spaceCharacters,asciiLetters,asciiUppercase
1212
from .constantsimportReparseException
13-
from .importutils
13+
from .import_utils
1414

1515
fromioimportStringIO
1616

@@ -28,7 +28,7 @@
2828

2929
invalid_unicode_no_surrogate="[\u0001-\u0008\u000B\u000E-\u001F\u007F-\u009F\uFDD0-\uFDEF\uFFFE\uFFFF\U0001FFFE\U0001FFFF\U0002FFFE\U0002FFFF\U0003FFFE\U0003FFFF\U0004FFFE\U0004FFFF\U0005FFFE\U0005FFFF\U0006FFFE\U0006FFFF\U0007FFFE\U0007FFFF\U0008FFFE\U0008FFFF\U0009FFFE\U0009FFFF\U000AFFFE\U000AFFFF\U000BFFFE\U000BFFFF\U000CFFFE\U000CFFFF\U000DFFFE\U000DFFFF\U000EFFFE\U000EFFFF\U000FFFFE\U000FFFFF\U0010FFFE\U0010FFFF]"# noqa
3030

31-
ifutils.supports_lone_surrogates:
31+
if_utils.supports_lone_surrogates:
3232
# Use one extra step of indirection and create surrogates with
3333
# eval. Not using this indirection would introduce an illegal
3434
# unicode literal on platforms not supporting such lone
@@ -176,7 +176,7 @@ def __init__(self, source):
176176
177177
"""
178178

179-
ifnotutils.supports_lone_surrogates:
179+
ifnot_utils.supports_lone_surrogates:
180180
# Such platforms will have already checked for such
181181
# surrogate errors, so no need to do this checking.
182182
self.reportCharacterErrors=None
@@ -304,9 +304,9 @@ def characterErrorsUCS2(self, data):
304304
codepoint=ord(match.group())
305305
pos=match.start()
306306
# Pretty sure there should be endianness issues here
307-
ifutils.isSurrogatePair(data[pos:pos+2]):
307+
if_utils.isSurrogatePair(data[pos:pos+2]):
308308
# We have a surrogate pair!
309-
char_val=utils.surrogatePairToCodepoint(data[pos:pos+2])
309+
char_val=_utils.surrogatePairToCodepoint(data[pos:pos+2])
310310
ifchar_valinnon_bmp_invalid_codepoints:
311311
self.errors.append("invalid-codepoint")
312312
skip=True

‎html5lib/tokenizer.pyrenamed to‎html5lib/_tokenizer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
from .constantsimporttokenTypes,tagTokenTypes
1212
from .constantsimportreplacementCharacters
1313

14-
from .inputstreamimportHTMLInputStream
14+
from ._inputstreamimportHTMLInputStream
1515

16-
from .trieimportTrie
16+
from ._trieimportTrie
1717

1818
entitiesTrie=Trie(entities)
1919

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎html5lib/filters/alphabeticalattributes.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
from __future__importabsolute_import,division,unicode_literals
22

3-
from .import_base
3+
from .importbase
44

55
try:
66
fromcollectionsimportOrderedDict
77
exceptImportError:
88
fromordereddictimportOrderedDict
99

1010

11-
classFilter(_base.Filter):
11+
classFilter(base.Filter):
1212
def__iter__(self):
13-
fortokenin_base.Filter.__iter__(self):
13+
fortokeninbase.Filter.__iter__(self):
1414
iftoken["type"]in ("StartTag","EmptyTag"):
1515
attrs=OrderedDict()
1616
forname,valueinsorted(token["data"].items(),
File renamed without changes.

‎html5lib/filters/inject_meta_charset.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
from __future__importabsolute_import,division,unicode_literals
22

3-
from .import_base
3+
from .importbase
44

55

6-
classFilter(_base.Filter):
6+
classFilter(base.Filter):
77
def__init__(self,source,encoding):
8-
_base.Filter.__init__(self,source)
8+
base.Filter.__init__(self,source)
99
self.encoding=encoding
1010

1111
def__iter__(self):
1212
state="pre_head"
1313
meta_found= (self.encodingisNone)
1414
pending= []
1515

16-
fortokenin_base.Filter.__iter__(self):
16+
fortokeninbase.Filter.__iter__(self):
1717
type=token["type"]
1818
iftype=="StartTag":
1919
iftoken["name"].lower()=="head":

‎html5lib/filters/lint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22

33
fromsiximporttext_type
44

5-
from .import_base
5+
from .importbase
66
from ..constantsimportnamespaces,voidElements
77

88
from ..constantsimportspaceCharacters
99
spaceCharacters="".join(spaceCharacters)
1010

1111

12-
classFilter(_base.Filter):
12+
classFilter(base.Filter):
1313
def__init__(self,source,require_matching_tags=True):
1414
super(Filter,self).__init__(source)
1515
self.require_matching_tags=require_matching_tags
1616

1717
def__iter__(self):
1818
open_elements= []
19-
fortokenin_base.Filter.__iter__(self):
19+
fortokeninbase.Filter.__iter__(self):
2020
type=token["type"]
2121
iftypein ("StartTag","EmptyTag"):
2222
namespace=token["namespace"]

‎html5lib/filters/optionaltags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from __future__importabsolute_import,division,unicode_literals
22

3-
from .import_base
3+
from .importbase
44

55

6-
classFilter(_base.Filter):
6+
classFilter(base.Filter):
77
defslider(self):
88
previous1=previous2=None
99
fortokeninself.source:

‎html5lib/filters/sanitizer.py

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55

66
fromsix.movesimporturllib_parseasurlparse
77

8-
from .import_base
8+
from .importbase
99
from ..constantsimportnamespaces,prefixes
1010

1111
__all__= ["Filter"]
1212

1313

14-
acceptable_elements=frozenset((
14+
allowed_elements=frozenset((
1515
(namespaces['html'],'a'),
1616
(namespaces['html'],'abbr'),
1717
(namespaces['html'],'acronym'),
@@ -175,7 +175,7 @@
175175
(namespaces['svg'],'use'),
176176
))
177177

178-
acceptable_attributes=frozenset((
178+
allowed_attributes=frozenset((
179179
# HTML attributes
180180
(None,'abbr'),
181181
(None,'accept'),
@@ -552,7 +552,7 @@
552552
(None,'use')
553553
))
554554

555-
acceptable_css_properties=frozenset((
555+
allowed_css_properties=frozenset((
556556
'azimuth',
557557
'background-color',
558558
'border-bottom-color',
@@ -601,7 +601,7 @@
601601
'width',
602602
))
603603

604-
acceptable_css_keywords=frozenset((
604+
allowed_css_keywords=frozenset((
605605
'auto',
606606
'aqua',
607607
'black',
@@ -643,7 +643,7 @@
643643
'yellow',
644644
))
645645

646-
acceptable_svg_properties=frozenset((
646+
allowed_svg_properties=frozenset((
647647
'fill',
648648
'fill-opacity',
649649
'fill-rule',
@@ -654,7 +654,7 @@
654654
'stroke-opacity',
655655
))
656656

657-
acceptable_protocols=frozenset((
657+
allowed_protocols=frozenset((
658658
'ed2k',
659659
'ftp',
660660
'http',
@@ -680,7 +680,7 @@
680680
'data',
681681
))
682682

683-
acceptable_content_types=frozenset((
683+
allowed_content_types=frozenset((
684684
'image/png',
685685
'image/jpeg',
686686
'image/gif',
@@ -689,14 +689,6 @@
689689
'text/plain',
690690
))
691691

692-
allowed_elements=acceptable_elements
693-
allowed_attributes=acceptable_attributes
694-
allowed_css_properties=acceptable_css_properties
695-
allowed_css_keywords=acceptable_css_keywords
696-
allowed_svg_properties=acceptable_svg_properties
697-
allowed_protocols=acceptable_protocols
698-
allowed_content_types=acceptable_content_types
699-
700692

701693
data_content_type=re.compile(r'''
702694
^
@@ -712,7 +704,7 @@
712704
re.VERBOSE)
713705

714706

715-
classFilter(_base.Filter):
707+
classFilter(base.Filter):
716708
""" sanitization of XHTML+MathML+SVG and of inline style attributes."""
717709
def__init__(self,
718710
source,
@@ -739,7 +731,7 @@ def __init__(self,
739731
self.svg_allow_local_href=svg_allow_local_href
740732

741733
def__iter__(self):
742-
fortokenin_base.Filter.__iter__(self):
734+
fortokeninbase.Filter.__iter__(self):
743735
token=self.sanitize_token(token)
744736
iftoken:
745737
yieldtoken

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp