Skip to content

Commit d0f1027

Browse files
committed
fixup! Preserve attribute order when parsing
Make sure 2.6 support works
1 parent 29dbf97 commit d0f1027

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

README.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ functionality:
117117
be determined; ``chardet``, from which it was forked, can also be used
118118
on Python 2.
119119

120-
- ``ordereddict`` can be used under Python 2.6
121-
(``collections.OrderedDict`` is used instead on later versions) to
122-
serialize attributes in alphabetical order.
123-
124120

125121
Bugs
126122
----

html5lib/html5parser.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
from six import with_metaclass, viewkeys
33

44
import types
5-
from collections import OrderedDict
5+
6+
try:
7+
from collections import OrderedDict
8+
except ImportError:
9+
from ordereddict import OrderedDict
610

711
from . import inputstream
812
from . import tokenizer

requirements-optional.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,3 @@ lxml ; platform_python_implementation == 'CPython'
1515
# DATrie can be used in place of our Python trie implementation for
1616
# slightly better parsing performance.
1717
datrie ; platform_python_implementation == 'CPython'
18-
19-
# Can be used to force attributes to be serialized in alphabetical
20-
# order.
21-
ordereddict ; python_version < '2.7'

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
six
22
webencodings
3+
ordereddict ; python_version < '2.7'

0 commit comments

Comments
 (0)