From 402c82d84f7bd51353348bea7d1a876ad9ecc5b1 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Wed, 1 Dec 2021 15:47:00 -0500 Subject: Upgraded some embedded dependencies to be ready for Python 3.10. This doesn't mean that it's fully supported right now. --- libs/babelfish/__init__.py | 6 - libs/babelfish/converters/__init__.py | 13 +- libs/babelfish/converters/opensubtitles.py | 4 +- libs/babelfish/country.py | 1 + libs/babelfish/data/get_files.py | 45 - libs/babelfish/language.py | 1 + libs/babelfish/script.py | 1 + libs/babelfish/tests.py | 377 - libs/flask_restful/__init__.py | 17 +- libs/flask_restful/__version__.py | 2 +- libs/flask_restful/fields.py | 5 +- libs/flask_restful/inputs.py | 2 +- libs/flask_restful/reqparse.py | 9 +- libs/flask_restful/utils/__init__.py | 4 +- libs/future/__init__.py | 10 +- libs/future/backports/__init__.py | 2 +- libs/future/backports/email/message.py | 6 +- libs/future/backports/http/client.py | 22 +- libs/future/backports/http/cookiejar.py | 5 +- libs/future/backports/http/cookies.py | 3 +- libs/future/backports/misc.py | 8 +- libs/future/backports/test/pystone.py | 0 libs/future/backports/urllib/request.py | 10 +- libs/future/builtins/__init__.py | 4 +- libs/future/builtins/misc.py | 17 +- libs/future/builtins/new_min_max.py | 59 + libs/future/builtins/newround.py | 11 +- libs/future/moves/__init__.py | 2 +- libs/future/moves/copyreg.py | 6 +- libs/future/moves/urllib/request.py | 23 +- libs/future/tests/base.py | 10 +- libs/future/types/newbytes.py | 8 +- libs/future/types/newint.py | 6 +- libs/future/types/newmemoryview.py | 8 +- libs/future/types/newobject.py | 1 + libs/future/types/newrange.py | 7 +- libs/future/types/newstr.py | 14 +- libs/future/utils/__init__.py | 76 +- libs/html5lib/__init__.py | 2 +- libs/html5lib/_ihatexml.py | 5 +- libs/html5lib/_inputstream.py | 55 +- libs/html5lib/_tokenizer.py | 16 +- libs/html5lib/_trie/__init__.py | 13 +- libs/html5lib/_trie/_base.py | 5 +- libs/html5lib/_trie/datrie.py | 44 - libs/html5lib/_utils.py | 49 +- libs/html5lib/constants.py | 9 +- libs/html5lib/filters/sanitizer.py | 20 + libs/html5lib/html5parser.py | 734 +- libs/html5lib/serializer.py | 2 +- libs/html5lib/tests/sanitizer-testdata/tests1.dat | 433 + libs/html5lib/tests/sanitizer.py | 17 +- libs/html5lib/tests/serializer-testdata/core.test | 395 + .../tests/serializer-testdata/injectmeta.test | 350 + .../tests/serializer-testdata/optionaltags.test | 3254 ++ .../tests/serializer-testdata/options.test | 334 + .../tests/serializer-testdata/whitespace.test | 198 + libs/html5lib/tests/support.py | 3 +- libs/html5lib/tests/test_encoding.py | 21 +- libs/html5lib/tests/test_meta.py | 4 +- libs/html5lib/tests/test_parser2.py | 40 +- libs/html5lib/tests/test_sanitizer.py | 62 +- libs/html5lib/tests/test_serializer.py | 51 +- libs/html5lib/tests/test_stream.py | 8 +- libs/html5lib/tests/test_tokenizer2.py | 66 + libs/html5lib/tests/test_treewalkers.py | 107 +- libs/html5lib/tests/testdata/AUTHORS.rst | 34 - libs/html5lib/tests/testdata/LICENSE | 21 - .../tests/testdata/encoding/chardet/test_big5.txt | 51 - .../tests/testdata/encoding/test-yahoo-jp.dat | 10 - libs/html5lib/tests/testdata/encoding/tests1.dat | 394 - libs/html5lib/tests/testdata/encoding/tests2.dat | 115 - libs/html5lib/tests/testdata/serializer/core.test | 125 - .../tests/testdata/serializer/injectmeta.test | 66 - .../tests/testdata/serializer/optionaltags.test | 965 - .../tests/testdata/serializer/options.test | 60 - .../tests/testdata/serializer/whitespace.test | 51 - libs/html5lib/tests/testdata/tokenizer/README.md | 104 - .../testdata/tokenizer/contentModelFlags.test | 81 - libs/html5lib/tests/testdata/tokenizer/domjs.test | 96 - .../tests/testdata/tokenizer/entities.test | 283 - .../tests/testdata/tokenizer/escapeFlag.test | 33 - .../tests/testdata/tokenizer/namedEntities.test | 42210 ------------------- .../tests/testdata/tokenizer/numericEntities.test | 1349 - .../testdata/tokenizer/pendingSpecChanges.test | 7 - libs/html5lib/tests/testdata/tokenizer/test1.test | 196 - libs/html5lib/tests/testdata/tokenizer/test2.test | 179 - libs/html5lib/tests/testdata/tokenizer/test3.test | 6047 --- libs/html5lib/tests/testdata/tokenizer/test4.test | 344 - .../tests/testdata/tokenizer/unicodeChars.test | 1295 - .../tokenizer/unicodeCharsProblematic.test | 31 - .../tests/testdata/tokenizer/xmlViolation.test | 22 - .../tests/testdata/tree-construction/README.md | 104 - .../testdata/tree-construction/adoption01.dat | 354 - .../testdata/tree-construction/adoption02.dat | 39 - .../testdata/tree-construction/comments01.dat | 178 - .../tests/testdata/tree-construction/doctype01.dat | 424 - .../testdata/tree-construction/domjs-unsafe.dat | Bin 9884 -> 0 bytes .../testdata/tree-construction/entities01.dat | 795 - .../testdata/tree-construction/entities02.dat | 293 - .../tree-construction/foreign-fragment.dat | 549 - .../testdata/tree-construction/html5test-com.dat | 291 - .../tests/testdata/tree-construction/inbody01.dat | 54 - .../tests/testdata/tree-construction/isindex.dat | 49 - .../testdata/tree-construction/main-element.dat | 46 - .../tests/testdata/tree-construction/math.dat | 81 - .../tree-construction/menuitem-element.dat | 229 - .../tree-construction/namespace-sensitivity.dat | 16 - .../testdata/tree-construction/noscript01.dat | 237 - .../pending-spec-changes-plain-text-unsafe.dat | Bin 816 -> 0 bytes .../tree-construction/pending-spec-changes.dat | 46 - .../tree-construction/plain-text-unsafe.dat | Bin 7925 -> 0 bytes .../tests/testdata/tree-construction/ruby.dat | 301 - .../testdata/tree-construction/scriptdata01.dat | 365 - .../tree-construction/scripted/adoption01.dat | 15 - .../testdata/tree-construction/scripted/ark.dat | 26 - .../tree-construction/scripted/webkit01.dat | 28 - .../tests/testdata/tree-construction/tables01.dat | 286 - .../tests/testdata/tree-construction/template.dat | 1604 - .../tests/testdata/tree-construction/tests1.dat | 1957 - .../tests/testdata/tree-construction/tests10.dat | 847 - .../tests/testdata/tree-construction/tests11.dat | 523 - .../tests/testdata/tree-construction/tests12.dat | 62 - .../tests/testdata/tree-construction/tests14.dat | 75 - .../tests/testdata/tree-construction/tests15.dat | 216 - .../tests/testdata/tree-construction/tests16.dat | 2460 -- .../tests/testdata/tree-construction/tests17.dat | 179 - .../tests/testdata/tree-construction/tests18.dat | 322 - .../tests/testdata/tree-construction/tests19.dat | 1454 - .../tests/testdata/tree-construction/tests2.dat | 780 - .../tests/testdata/tree-construction/tests20.dat | 582 - .../tests/testdata/tree-construction/tests21.dat | 305 - .../tests/testdata/tree-construction/tests22.dat | 190 - .../tests/testdata/tree-construction/tests23.dat | 168 - .../tests/testdata/tree-construction/tests24.dat | 79 - .../tests/testdata/tree-construction/tests25.dat | 221 - .../tests/testdata/tree-construction/tests26.dat | 388 - .../tests/testdata/tree-construction/tests3.dat | 305 - .../tests/testdata/tree-construction/tests4.dat | 58 - .../tests/testdata/tree-construction/tests5.dat | 210 - .../tests/testdata/tree-construction/tests6.dat | 659 - .../tests/testdata/tree-construction/tests7.dat | 418 - .../tests/testdata/tree-construction/tests8.dat | 151 - .../tests/testdata/tree-construction/tests9.dat | 472 - .../tree-construction/tests_innerHTML_1.dat | 887 - .../tests/testdata/tree-construction/tricky01.dat | 336 - .../tests/testdata/tree-construction/webkit01.dat | 720 - .../tests/testdata/tree-construction/webkit02.dat | 301 - libs/html5lib/tests/tokenizer.py | 5 +- libs/html5lib/tests/tokenizertotree.py | 1 + libs/html5lib/tests/tree_construction.py | 13 +- libs/html5lib/tests/us-ascii.html | 3 + libs/html5lib/tests/utf-8-bom.html | 3 + libs/html5lib/treebuilders/base.py | 8 +- libs/html5lib/treebuilders/dom.py | 5 +- libs/html5lib/treebuilders/etree.py | 27 +- libs/html5lib/treebuilders/etree_lxml.py | 64 +- libs/html5lib/treewalkers/__init__.py | 6 +- libs/html5lib/treewalkers/etree.py | 1 + libs/html5lib/treewalkers/etree_lxml.py | 4 +- libs/libfuturize/fixes/__init__.py | 3 +- ...add__future__imports_except_unicode_literals.py | 4 +- libs/libfuturize/fixes/fix_division_safe.py | 55 +- libs/libfuturize/fixes/fix_input.py | 32 + libs/libfuturize/fixes/fix_raise.py | 82 +- libs/past/__init__.py | 8 +- libs/past/builtins/misc.py | 13 +- libs/past/builtins/noniterators.py | 2 +- libs/past/tests/__init__.py | 0 libs/past/translation/__init__.py | 24 +- libs/past/types/oldstr.py | 5 +- libs/past/utils/__init__.py | 2 +- libs/pkg_resources.py | 2891 -- libs/pkg_resources/__init__.py | 3142 -- libs/pkg_resources/_vendor/__init__.py | 0 libs/pkg_resources/_vendor/appdirs.py | 608 - libs/pkg_resources/_vendor/packaging/__about__.py | 21 - libs/pkg_resources/_vendor/packaging/__init__.py | 14 - libs/pkg_resources/_vendor/packaging/_compat.py | 30 - .../pkg_resources/_vendor/packaging/_structures.py | 68 - libs/pkg_resources/_vendor/packaging/markers.py | 301 - .../_vendor/packaging/requirements.py | 127 - libs/pkg_resources/_vendor/packaging/specifiers.py | 774 - libs/pkg_resources/_vendor/packaging/utils.py | 14 - libs/pkg_resources/_vendor/packaging/version.py | 393 - libs/pkg_resources/_vendor/pyparsing.py | 5720 --- libs/pkg_resources/_vendor/six.py | 868 - libs/pkg_resources/extern/__init__.py | 73 - libs/pkg_resources/py31compat.py | 23 - libs/pysubs2/cli.py | 5 +- libs/pysubs2/common.py | 2 +- libs/pysubs2/mpl2.py | 2 +- libs/pysubs2/ssaevent.py | 24 +- libs/pysubs2/ssafile.py | 52 +- libs/pysubs2/ssastyle.py | 2 +- libs/pysubs2/subrip.py | 4 +- libs/pysubs2/substation.py | 15 +- libs/socks.py | 127 +- libs/tqdm/__init__.py | 21 +- libs/tqdm/__main__.py | 1 + libs/tqdm/_main.py | 4 +- libs/tqdm/_monitor.py | 32 +- libs/tqdm/_tqdm.py | 4 +- libs/tqdm/_tqdm_gui.py | 4 +- libs/tqdm/_tqdm_notebook.py | 4 +- libs/tqdm/_tqdm_pandas.py | 38 +- libs/tqdm/_utils.py | 10 +- libs/tqdm/_version.py | 59 - libs/tqdm/asyncio.py | 93 + libs/tqdm/auto.py | 40 +- libs/tqdm/autonotebook.py | 16 +- libs/tqdm/cli.py | 155 +- libs/tqdm/completion.sh | 4 +- libs/tqdm/contrib/__init__.py | 80 +- libs/tqdm/contrib/bells.py | 24 + libs/tqdm/contrib/concurrent.py | 66 +- libs/tqdm/contrib/discord.py | 121 + libs/tqdm/contrib/itertools.py | 8 +- libs/tqdm/contrib/logging.py | 128 + libs/tqdm/contrib/telegram.py | 153 +- libs/tqdm/contrib/utils_worker.py | 40 + libs/tqdm/dask.py | 46 + libs/tqdm/gui.py | 216 +- libs/tqdm/keras.py | 47 +- libs/tqdm/notebook.py | 201 +- libs/tqdm/rich.py | 152 + libs/tqdm/std.py | 581 +- libs/tqdm/tests/tests_concurrent.py | 58 - libs/tqdm/tests/tests_contrib.py | 61 - libs/tqdm/tests/tests_itertools.py | 27 - libs/tqdm/tests/tests_keras.py | 97 - libs/tqdm/tests/tests_main.py | 172 - libs/tqdm/tests/tests_notebook.py | 9 - libs/tqdm/tests/tests_pandas.py | 264 - libs/tqdm/tests/tests_perf.py | 367 - libs/tqdm/tests/tests_synchronisation.py | 213 - libs/tqdm/tests/tests_tqdm.py | 1966 - libs/tqdm/tests/tests_version.py | 12 - libs/tqdm/tk.py | 207 + libs/tqdm/tqdm.1 | 74 +- libs/tqdm/utils.py | 227 +- libs/tqdm/version.py | 9 + libs/version.txt | 9 +- 243 files changed, 8215 insertions(+), 96581 deletions(-) delete mode 100644 libs/babelfish/data/get_files.py delete mode 100644 libs/babelfish/tests.py mode change 100644 => 100755 libs/future/backports/test/pystone.py create mode 100644 libs/future/builtins/new_min_max.py delete mode 100644 libs/html5lib/_trie/datrie.py create mode 100644 libs/html5lib/tests/sanitizer-testdata/tests1.dat create mode 100644 libs/html5lib/tests/serializer-testdata/core.test create mode 100644 libs/html5lib/tests/serializer-testdata/injectmeta.test create mode 100644 libs/html5lib/tests/serializer-testdata/optionaltags.test create mode 100644 libs/html5lib/tests/serializer-testdata/options.test create mode 100644 libs/html5lib/tests/serializer-testdata/whitespace.test create mode 100644 libs/html5lib/tests/test_tokenizer2.py delete mode 100644 libs/html5lib/tests/testdata/AUTHORS.rst delete mode 100644 libs/html5lib/tests/testdata/LICENSE delete mode 100644 libs/html5lib/tests/testdata/encoding/chardet/test_big5.txt delete mode 100644 libs/html5lib/tests/testdata/encoding/test-yahoo-jp.dat delete mode 100644 libs/html5lib/tests/testdata/encoding/tests1.dat delete mode 100644 libs/html5lib/tests/testdata/encoding/tests2.dat delete mode 100644 libs/html5lib/tests/testdata/serializer/core.test delete mode 100644 libs/html5lib/tests/testdata/serializer/injectmeta.test delete mode 100644 libs/html5lib/tests/testdata/serializer/optionaltags.test delete mode 100644 libs/html5lib/tests/testdata/serializer/options.test delete mode 100644 libs/html5lib/tests/testdata/serializer/whitespace.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/README.md delete mode 100644 libs/html5lib/tests/testdata/tokenizer/contentModelFlags.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/domjs.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/entities.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/escapeFlag.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/namedEntities.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/numericEntities.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/pendingSpecChanges.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/test1.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/test2.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/test3.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/test4.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/unicodeChars.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/unicodeCharsProblematic.test delete mode 100644 libs/html5lib/tests/testdata/tokenizer/xmlViolation.test delete mode 100644 libs/html5lib/tests/testdata/tree-construction/README.md delete mode 100644 libs/html5lib/tests/testdata/tree-construction/adoption01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/adoption02.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/comments01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/doctype01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/domjs-unsafe.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/entities01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/entities02.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/foreign-fragment.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/html5test-com.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/inbody01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/isindex.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/main-element.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/math.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/menuitem-element.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/namespace-sensitivity.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/noscript01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/pending-spec-changes-plain-text-unsafe.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/pending-spec-changes.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/plain-text-unsafe.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/ruby.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/scriptdata01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/scripted/adoption01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/scripted/ark.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/scripted/webkit01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tables01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/template.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests1.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests10.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests11.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests12.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests14.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests15.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests16.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests17.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests18.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests19.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests2.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests20.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests21.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests22.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests23.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests24.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests25.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests26.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests3.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests4.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests5.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests6.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests7.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests8.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests9.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tests_innerHTML_1.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/tricky01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/webkit01.dat delete mode 100644 libs/html5lib/tests/testdata/tree-construction/webkit02.dat create mode 100644 libs/html5lib/tests/us-ascii.html create mode 100644 libs/html5lib/tests/utf-8-bom.html create mode 100644 libs/libfuturize/fixes/fix_input.py delete mode 100644 libs/past/tests/__init__.py delete mode 100644 libs/pkg_resources.py delete mode 100644 libs/pkg_resources/__init__.py delete mode 100644 libs/pkg_resources/_vendor/__init__.py delete mode 100644 libs/pkg_resources/_vendor/appdirs.py delete mode 100644 libs/pkg_resources/_vendor/packaging/__about__.py delete mode 100644 libs/pkg_resources/_vendor/packaging/__init__.py delete mode 100644 libs/pkg_resources/_vendor/packaging/_compat.py delete mode 100644 libs/pkg_resources/_vendor/packaging/_structures.py delete mode 100644 libs/pkg_resources/_vendor/packaging/markers.py delete mode 100644 libs/pkg_resources/_vendor/packaging/requirements.py delete mode 100644 libs/pkg_resources/_vendor/packaging/specifiers.py delete mode 100644 libs/pkg_resources/_vendor/packaging/utils.py delete mode 100644 libs/pkg_resources/_vendor/packaging/version.py delete mode 100644 libs/pkg_resources/_vendor/pyparsing.py delete mode 100644 libs/pkg_resources/_vendor/six.py delete mode 100644 libs/pkg_resources/extern/__init__.py delete mode 100644 libs/pkg_resources/py31compat.py delete mode 100644 libs/tqdm/_version.py create mode 100644 libs/tqdm/asyncio.py mode change 100644 => 100755 libs/tqdm/completion.sh create mode 100644 libs/tqdm/contrib/bells.py create mode 100644 libs/tqdm/contrib/discord.py create mode 100644 libs/tqdm/contrib/logging.py create mode 100644 libs/tqdm/contrib/utils_worker.py create mode 100644 libs/tqdm/dask.py create mode 100644 libs/tqdm/rich.py delete mode 100644 libs/tqdm/tests/tests_concurrent.py delete mode 100644 libs/tqdm/tests/tests_contrib.py delete mode 100644 libs/tqdm/tests/tests_itertools.py delete mode 100644 libs/tqdm/tests/tests_keras.py delete mode 100644 libs/tqdm/tests/tests_main.py delete mode 100644 libs/tqdm/tests/tests_notebook.py delete mode 100644 libs/tqdm/tests/tests_pandas.py delete mode 100644 libs/tqdm/tests/tests_perf.py delete mode 100644 libs/tqdm/tests/tests_synchronisation.py delete mode 100644 libs/tqdm/tests/tests_tqdm.py delete mode 100644 libs/tqdm/tests/tests_version.py create mode 100644 libs/tqdm/tk.py create mode 100644 libs/tqdm/version.py (limited to 'libs') diff --git a/libs/babelfish/__init__.py b/libs/babelfish/__init__.py index 559705a25..082f1551f 100644 --- a/libs/babelfish/__init__.py +++ b/libs/babelfish/__init__.py @@ -4,12 +4,6 @@ # Use of this source code is governed by the 3-clause BSD license # that can be found in the LICENSE file. # -__title__ = 'babelfish' -__version__ = '0.5.5-dev' -__author__ = 'Antoine Bertin' -__license__ = 'BSD' -__copyright__ = 'Copyright 2015 the BabelFish authors' - import sys if sys.version_info[0] >= 3: diff --git a/libs/babelfish/converters/__init__.py b/libs/babelfish/converters/__init__.py index feb687b0e..d27f84900 100644 --- a/libs/babelfish/converters/__init__.py +++ b/libs/babelfish/converters/__init__.py @@ -2,17 +2,22 @@ # Use of this source code is governed by the 3-clause BSD license # that can be found in the LICENSE file. # -import collections from pkg_resources import iter_entry_points, EntryPoint from ..exceptions import LanguageConvertError, LanguageReverseError +try: + # Python 3.3+ + from collections.abc import Mapping, MutableMapping +except ImportError: + from collections import Mapping, MutableMapping + # from https://github.com/kennethreitz/requests/blob/master/requests/structures.py -class CaseInsensitiveDict(collections.MutableMapping): +class CaseInsensitiveDict(MutableMapping): """A case-insensitive ``dict``-like object. Implements all methods and operations of - ``collections.MutableMapping`` as well as dict's ``copy``. Also + ``collections.abc.MutableMapping`` as well as dict's ``copy``. Also provides ``lower_items``. All keys are expected to be strings. The structure remembers the @@ -63,7 +68,7 @@ class CaseInsensitiveDict(collections.MutableMapping): ) def __eq__(self, other): - if isinstance(other, collections.Mapping): + if isinstance(other, Mapping): other = CaseInsensitiveDict(other) else: return NotImplemented diff --git a/libs/babelfish/converters/opensubtitles.py b/libs/babelfish/converters/opensubtitles.py index 5b18e648c..3f68b683a 100644 --- a/libs/babelfish/converters/opensubtitles.py +++ b/libs/babelfish/converters/opensubtitles.py @@ -14,9 +14,9 @@ class OpenSubtitlesConverter(LanguageReverseConverter): def __init__(self): self.alpha3b_converter = language_converters['alpha3b'] self.alpha2_converter = language_converters['alpha2'] - self.to_opensubtitles = {('por', 'BR'): 'pob', ('gre', None): 'ell', ('srp', None): 'scc', ('srp', 'ME'): 'mne'} + self.to_opensubtitles = {('por', 'BR'): 'pob', ('gre', None): 'ell', ('srp', None): 'scc', ('srp', 'ME'): 'mne', ('chi', 'TW'): 'zht'} self.from_opensubtitles = CaseInsensitiveDict({'pob': ('por', 'BR'), 'pb': ('por', 'BR'), 'ell': ('ell', None), - 'scc': ('srp', None), 'mne': ('srp', 'ME')}) + 'scc': ('srp', None), 'mne': ('srp', 'ME'), 'zht': ('zho', 'TW')}) self.codes = (self.alpha2_converter.codes | self.alpha3b_converter.codes | set(self.from_opensubtitles.keys())) def convert(self, alpha3, country=None, script=None): diff --git a/libs/babelfish/country.py b/libs/babelfish/country.py index dbc14ce61..4c24b52b2 100644 --- a/libs/babelfish/country.py +++ b/libs/babelfish/country.py @@ -4,6 +4,7 @@ # Use of this source code is governed by the 3-clause BSD license # that can be found in the LICENSE file. # +from __future__ import unicode_literals from collections import namedtuple from functools import partial from pkg_resources import resource_stream # @UnresolvedImport diff --git a/libs/babelfish/data/get_files.py b/libs/babelfish/data/get_files.py deleted file mode 100644 index aaa090ccc..000000000 --- a/libs/babelfish/data/get_files.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2013 the BabelFish authors. All rights reserved. -# Use of this source code is governed by the 3-clause BSD license -# that can be found in the LICENSE file. -# -from __future__ import unicode_literals -import os.path -import tempfile -import zipfile -import requests - - -DATA_DIR = os.path.dirname(__file__) - -# iso-3166-1.txt -print('Downloading ISO-3166-1 standard (ISO country codes)...') -with open(os.path.join(DATA_DIR, 'iso-3166-1.txt'), 'w') as f: - r = requests.get('http://www.iso.org/iso/home/standards/country_codes/country_names_and_code_elements_txt.htm') - f.write(r.content.strip()) - -# iso-639-3.tab -print('Downloading ISO-639-3 standard (ISO language codes)...') -with tempfile.TemporaryFile() as f: - r = requests.get('http://www-01.sil.org/iso639-3/iso-639-3_Code_Tables_20130531.zip') - f.write(r.content) - with zipfile.ZipFile(f) as z: - z.extract('iso-639-3.tab', DATA_DIR) - -# iso-15924 -print('Downloading ISO-15924 standard (ISO script codes)...') -with tempfile.TemporaryFile() as f: - r = requests.get('http://www.unicode.org/iso15924/iso15924.txt.zip') - f.write(r.content) - with zipfile.ZipFile(f) as z: - z.extract('iso15924-utf8-20131012.txt', DATA_DIR) - -# opensubtitles supported languages -print('Downloading OpenSubtitles supported languages...') -with open(os.path.join(DATA_DIR, 'opensubtitles_languages.txt'), 'w') as f: - r = requests.get('http://www.opensubtitles.org/addons/export_languages.php') - f.write(r.content) - -print('Done!') diff --git a/libs/babelfish/language.py b/libs/babelfish/language.py index 6c98fb602..b4b251937 100644 --- a/libs/babelfish/language.py +++ b/libs/babelfish/language.py @@ -4,6 +4,7 @@ # Use of this source code is governed by the 3-clause BSD license # that can be found in the LICENSE file. # +from __future__ import unicode_literals from collections import namedtuple from functools import partial from pkg_resources import resource_stream # @UnresolvedImport diff --git a/libs/babelfish/script.py b/libs/babelfish/script.py index 52258c95a..4b59ce016 100644 --- a/libs/babelfish/script.py +++ b/libs/babelfish/script.py @@ -4,6 +4,7 @@ # Use of this source code is governed by the 3-clause BSD license # that can be found in the LICENSE file. # +from __future__ import unicode_literals from collections import namedtuple from pkg_resources import resource_stream # @UnresolvedImport from . import basestr diff --git a/libs/babelfish/tests.py b/libs/babelfish/tests.py deleted file mode 100644 index b72ec284c..000000000 --- a/libs/babelfish/tests.py +++ /dev/null @@ -1,377 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -# Copyright (c) 2013 the BabelFish authors. All rights reserved. -# Use of this source code is governed by the 3-clause BSD license -# that can be found in the LICENSE file. -# -from __future__ import unicode_literals -import re -import sys -import pickle -from unittest import TestCase, TestSuite, TestLoader, TextTestRunner -from pkg_resources import resource_stream # @UnresolvedImport -from babelfish import (LANGUAGES, Language, Country, Script, language_converters, country_converters, - LanguageReverseConverter, LanguageConvertError, LanguageReverseError, CountryReverseError) - - -if sys.version_info[:2] <= (2, 6): - _MAX_LENGTH = 80 - - def safe_repr(obj, short=False): - try: - result = repr(obj) - except Exception: - result = object.__repr__(obj) - if not short or len(result) < _MAX_LENGTH: - return result - return result[:_MAX_LENGTH] + ' [truncated]...' - - class _AssertRaisesContext(object): - """A context manager used to implement TestCase.assertRaises* methods.""" - - def __init__(self, expected, test_case, expected_regexp=None): - self.expected = expected - self.failureException = test_case.failureException - self.expected_regexp = expected_regexp - - def __enter__(self): - return self - - def __exit__(self, exc_type, exc_value, tb): - if exc_type is None: - try: - exc_name = self.expected.__name__ - except AttributeError: - exc_name = str(self.expected) - raise self.failureException( - "{0} not raised".format(exc_name)) - if not issubclass(exc_type, self.expected): - # let unexpected exceptions pass through - return False - self.exception = exc_value # store for later retrieval - if self.expected_regexp is None: - return True - - expected_regexp = self.expected_regexp - if isinstance(expected_regexp, basestring): - expected_regexp = re.compile(expected_regexp) - if not expected_regexp.search(str(exc_value)): - raise self.failureException('"%s" does not match "%s"' % - (expected_regexp.pattern, str(exc_value))) - return True - - class _Py26FixTestCase(object): - def assertIsNone(self, obj, msg=None): - """Same as self.assertTrue(obj is None), with a nicer default message.""" - if obj is not None: - standardMsg = '%s is not None' % (safe_repr(obj),) - self.fail(self._formatMessage(msg, standardMsg)) - - def assertIsNotNone(self, obj, msg=None): - """Included for symmetry with assertIsNone.""" - if obj is None: - standardMsg = 'unexpectedly None' - self.fail(self._formatMessage(msg, standardMsg)) - - def assertIn(self, member, container, msg=None): - """Just like self.assertTrue(a in b), but with a nicer default message.""" - if member not in container: - standardMsg = '%s not found in %s' % (safe_repr(member), - safe_repr(container)) - self.fail(self._formatMessage(msg, standardMsg)) - - def assertNotIn(self, member, container, msg=None): - """Just like self.assertTrue(a not in b), but with a nicer default message.""" - if member in container: - standardMsg = '%s unexpectedly found in %s' % (safe_repr(member), - safe_repr(container)) - self.fail(self._formatMessage(msg, standardMsg)) - - def assertIs(self, expr1, expr2, msg=None): - """Just like self.assertTrue(a is b), but with a nicer default message.""" - if expr1 is not expr2: - standardMsg = '%s is not %s' % (safe_repr(expr1), - safe_repr(expr2)) - self.fail(self._formatMessage(msg, standardMsg)) - - def assertIsNot(self, expr1, expr2, msg=None): - """Just like self.assertTrue(a is not b), but with a nicer default message.""" - if expr1 is expr2: - standardMsg = 'unexpectedly identical: %s' % (safe_repr(expr1),) - self.fail(self._formatMessage(msg, standardMsg)) - -else: - class _Py26FixTestCase(object): - pass - - -class TestScript(TestCase, _Py26FixTestCase): - def test_wrong_script(self): - self.assertRaises(ValueError, lambda: Script('Azer')) - - def test_eq(self): - self.assertEqual(Script('Latn'), Script('Latn')) - - def test_ne(self): - self.assertNotEqual(Script('Cyrl'), Script('Latn')) - - def test_hash(self): - self.assertEqual(hash(Script('Hira')), hash('Hira')) - - def test_pickle(self): - self.assertEqual(pickle.loads(pickle.dumps(Script('Latn'))), Script('Latn')) - - -class TestCountry(TestCase, _Py26FixTestCase): - def test_wrong_country(self): - self.assertRaises(ValueError, lambda: Country('ZZ')) - - def test_eq(self): - self.assertEqual(Country('US'), Country('US')) - - def test_ne(self): - self.assertNotEqual(Country('GB'), Country('US')) - self.assertIsNotNone(Country('US')) - - def test_hash(self): - self.assertEqual(hash(Country('US')), hash('US')) - - def test_pickle(self): - for country in [Country('GB'), Country('US')]: - self.assertEqual(pickle.loads(pickle.dumps(country)), country) - - def test_converter_name(self): - self.assertEqual(Country('US').name, 'UNITED STATES') - self.assertEqual(Country.fromname('UNITED STATES'), Country('US')) - self.assertEqual(Country.fromcode('UNITED STATES', 'name'), Country('US')) - self.assertRaises(CountryReverseError, lambda: Country.fromname('ZZZZZ')) - self.assertEqual(len(country_converters['name'].codes), 249) - - -class TestLanguage(TestCase, _Py26FixTestCase): - def test_languages(self): - self.assertEqual(len(LANGUAGES), 7874) - - def test_wrong_language(self): - self.assertRaises(ValueError, lambda: Language('zzz')) - - def test_unknown_language(self): - self.assertEqual(Language('zzzz', unknown='und'), Language('und')) - - def test_converter_alpha2(self): - self.assertEqual(Language('eng').alpha2, 'en') - self.assertEqual(Language.fromalpha2('en'), Language('eng')) - self.assertEqual(Language.fromcode('en', 'alpha2'), Language('eng')) - self.assertRaises(LanguageReverseError, lambda: Language.fromalpha2('zz')) - self.assertRaises(LanguageConvertError, lambda: Language('aaa').alpha2) - self.assertEqual(len(language_converters['alpha2'].codes), 184) - - def test_converter_alpha3b(self): - self.assertEqual(Language('fra').alpha3b, 'fre') - self.assertEqual(Language.fromalpha3b('fre'), Language('fra')) - self.assertEqual(Language.fromcode('fre', 'alpha3b'), Language('fra')) - self.assertRaises(LanguageReverseError, lambda: Language.fromalpha3b('zzz')) - self.assertRaises(LanguageConvertError, lambda: Language('aaa').alpha3b) - self.assertEqual(len(language_converters['alpha3b'].codes), 418) - - def test_converter_alpha3t(self): - self.assertEqual(Language('fra').alpha3t, 'fra') - self.assertEqual(Language.fromalpha3t('fra'), Language('fra')) - self.assertEqual(Language.fromcode('fra', 'alpha3t'), Language('fra')) - self.assertRaises(LanguageReverseError, lambda: Language.fromalpha3t('zzz')) - self.assertRaises(LanguageConvertError, lambda: Language('aaa').alpha3t) - self.assertEqual(len(language_converters['alpha3t'].codes), 418) - - def test_converter_name(self): - self.assertEqual(Language('eng').name, 'English') - self.assertEqual(Language.fromname('English'), Language('eng')) - self.assertEqual(Language.fromcode('English', 'name'), Language('eng')) - self.assertRaises(LanguageReverseError, lambda: Language.fromname('Zzzzzzzzz')) - self.assertEqual(len(language_converters['name'].codes), 7874) - - def test_converter_scope(self): - self.assertEqual(language_converters['scope'].codes, set(['I', 'S', 'M'])) - self.assertEqual(Language('eng').scope, 'individual') - self.assertEqual(Language('und').scope, 'special') - - def test_converter_type(self): - self.assertEqual(language_converters['type'].codes, set(['A', 'C', 'E', 'H', 'L', 'S'])) - self.assertEqual(Language('eng').type, 'living') - self.assertEqual(Language('und').type, 'special') - - def test_converter_opensubtitles(self): - self.assertEqual(Language('fra').opensubtitles, Language('fra').alpha3b) - self.assertEqual(Language('por', 'BR').opensubtitles, 'pob') - self.assertEqual(Language.fromopensubtitles('fre'), Language('fra')) - self.assertEqual(Language.fromopensubtitles('pob'), Language('por', 'BR')) - self.assertEqual(Language.fromopensubtitles('pb'), Language('por', 'BR')) - # Montenegrin is not recognized as an ISO language (yet?) but for now it is - # unofficially accepted as Serbian from Montenegro - self.assertEqual(Language.fromopensubtitles('mne'), Language('srp', 'ME')) - self.assertEqual(Language.fromcode('pob', 'opensubtitles'), Language('por', 'BR')) - self.assertRaises(LanguageReverseError, lambda: Language.fromopensubtitles('zzz')) - self.assertRaises(LanguageConvertError, lambda: Language('aaa').opensubtitles) - self.assertEqual(len(language_converters['opensubtitles'].codes), 607) - - # test with all the LANGUAGES from the opensubtitles api - # downloaded from: http://www.opensubtitles.org/addons/export_languages.php - f = resource_stream('babelfish', 'data/opensubtitles_languages.txt') - f.readline() - for l in f: - idlang, alpha2, _, upload_enabled, web_enabled = l.decode('utf-8').strip().split('\t') - if not int(upload_enabled) and not int(web_enabled): - # do not test LANGUAGES that are too esoteric / not widely available - continue - self.assertEqual(Language.fromopensubtitles(idlang).opensubtitles, idlang) - if alpha2: - self.assertEqual(Language.fromopensubtitles(idlang), Language.fromopensubtitles(alpha2)) - f.close() - - def test_converter_opensubtitles_codes(self): - for code in language_converters['opensubtitles'].from_opensubtitles.keys(): - self.assertIn(code, language_converters['opensubtitles'].codes) - - def test_fromietf_country_script(self): - language = Language.fromietf('fra-FR-Latn') - self.assertEqual(language.alpha3, 'fra') - self.assertEqual(language.country, Country('FR')) - self.assertEqual(language.script, Script('Latn')) - - def test_fromietf_country_no_script(self): - language = Language.fromietf('fra-FR') - self.assertEqual(language.alpha3, 'fra') - self.assertEqual(language.country, Country('FR')) - self.assertIsNone(language.script) - - def test_fromietf_no_country_no_script(self): - language = Language.fromietf('fra-FR') - self.assertEqual(language.alpha3, 'fra') - self.assertEqual(language.country, Country('FR')) - self.assertIsNone(language.script) - - def test_fromietf_no_country_script(self): - language = Language.fromietf('fra-Latn') - self.assertEqual(language.alpha3, 'fra') - self.assertIsNone(language.country) - self.assertEqual(language.script, Script('Latn')) - - def test_fromietf_alpha2_language(self): - language = Language.fromietf('fr-Latn') - self.assertEqual(language.alpha3, 'fra') - self.assertIsNone(language.country) - self.assertEqual(language.script, Script('Latn')) - - def test_fromietf_wrong_language(self): - self.assertRaises(ValueError, lambda: Language.fromietf('xyz-FR')) - - def test_fromietf_wrong_country(self): - self.assertRaises(ValueError, lambda: Language.fromietf('fra-YZ')) - - def test_fromietf_wrong_script(self): - self.assertRaises(ValueError, lambda: Language.fromietf('fra-FR-Wxyz')) - - def test_eq(self): - self.assertEqual(Language('eng'), Language('eng')) - - def test_ne(self): - self.assertNotEqual(Language('fra'), Language('eng')) - self.assertIsNotNone(Language('fra')) - - def test_nonzero(self): - self.assertFalse(bool(Language('und'))) - self.assertTrue(bool(Language('eng'))) - - def test_language_hasattr(self): - self.assertTrue(hasattr(Language('fra'), 'alpha3')) - self.assertTrue(hasattr(Language('fra'), 'alpha2')) - self.assertFalse(hasattr(Language('bej'), 'alpha2')) - - def test_country_hasattr(self): - self.assertTrue(hasattr(Country('US'), 'name')) - self.assertTrue(hasattr(Country('FR'), 'alpha2')) - self.assertFalse(hasattr(Country('BE'), 'none')) - - def test_country(self): - self.assertEqual(Language('por', 'BR').country, Country('BR')) - self.assertEqual(Language('eng', Country('US')).country, Country('US')) - - def test_eq_with_country(self): - self.assertEqual(Language('eng', 'US'), Language('eng', Country('US'))) - - def test_ne_with_country(self): - self.assertNotEqual(Language('eng', 'US'), Language('eng', Country('GB'))) - - def test_script(self): - self.assertEqual(Language('srp', script='Latn').script, Script('Latn')) - self.assertEqual(Language('srp', script=Script('Cyrl')).script, Script('Cyrl')) - - def test_eq_with_script(self): - self.assertEqual(Language('srp', script='Latn'), Language('srp', script=Script('Latn'))) - - def test_ne_with_script(self): - self.assertNotEqual(Language('srp', script='Latn'), Language('srp', script=Script('Cyrl'))) - - def test_eq_with_country_and_script(self): - self.assertEqual(Language('srp', 'SR', 'Latn'), Language('srp', Country('SR'), Script('Latn'))) - - def test_ne_with_country_and_script(self): - self.assertNotEqual(Language('srp', 'SR', 'Latn'), Language('srp', Country('SR'), Script('Cyrl'))) - - def test_hash(self): - self.assertEqual(hash(Language('fra')), hash('fr')) - self.assertEqual(hash(Language('ace')), hash('ace')) - self.assertEqual(hash(Language('por', 'BR')), hash('pt-BR')) - self.assertEqual(hash(Language('srp', script='Cyrl')), hash('sr-Cyrl')) - self.assertEqual(hash(Language('eng', 'US', 'Latn')), hash('en-US-Latn')) - - def test_pickle(self): - for lang in [Language('fra'), - Language('eng', 'US'), - Language('srp', script='Latn'), - Language('eng', 'US', 'Latn')]: - self.assertEqual(pickle.loads(pickle.dumps(lang)), lang) - - def test_str(self): - self.assertEqual(Language.fromietf(str(Language('eng', 'US', 'Latn'))), Language('eng', 'US', 'Latn')) - self.assertEqual(Language.fromietf(str(Language('fra', 'FR'))), Language('fra', 'FR')) - self.assertEqual(Language.fromietf(str(Language('bel'))), Language('bel')) - - def test_register_converter(self): - class TestConverter(LanguageReverseConverter): - def __init__(self): - self.to_test = {'fra': 'test1', 'eng': 'test2'} - self.from_test = {'test1': 'fra', 'test2': 'eng'} - - def convert(self, alpha3, country=None, script=None): - if alpha3 not in self.to_test: - raise LanguageConvertError(alpha3, country, script) - return self.to_test[alpha3] - - def reverse(self, test): - if test not in self.from_test: - raise LanguageReverseError(test) - return (self.from_test[test], None) - language = Language('fra') - self.assertFalse(hasattr(language, 'test')) - language_converters['test'] = TestConverter() - self.assertTrue(hasattr(language, 'test')) - self.assertIn('test', language_converters) - self.assertEqual(Language('fra').test, 'test1') - self.assertEqual(Language.fromtest('test2').alpha3, 'eng') - del language_converters['test'] - self.assertNotIn('test', language_converters) - self.assertRaises(KeyError, lambda: Language.fromtest('test1')) - self.assertRaises(AttributeError, lambda: Language('fra').test) - - -def suite(): - suite = TestSuite() - suite.addTest(TestLoader().loadTestsFromTestCase(TestScript)) - suite.addTest(TestLoader().loadTestsFromTestCase(TestCountry)) - suite.addTest(TestLoader().loadTestsFromTestCase(TestLanguage)) - return suite - - -if __name__ == '__main__': - TextTestRunner().run(suite()) diff --git a/libs/flask_restful/__init__.py b/libs/flask_restful/__init__.py index 365c068ad..e9f9d9f6f 100644 --- a/libs/flask_restful/__init__.py +++ b/libs/flask_restful/__init__.py @@ -11,10 +11,12 @@ from werkzeug.wrappers import Response as ResponseBase from flask_restful.utils import http_status_message, unpack, OrderedDict from flask_restful.representations.json import output_json import sys -from flask.helpers import _endpoint_from_view_func from types import MethodType import operator -from collections import Mapping +try: + from collections.abc import Mapping +except ImportError: + from collections import Mapping __all__ = ('Api', 'Resource', 'marshal', 'marshal_with', 'marshal_with_field', 'abort') @@ -58,7 +60,7 @@ class Api(object): to handle 404 errors throughout your app :param serve_challenge_on_401: Whether to serve a challenge response to clients on receiving 401. This usually leads to a username/password - popup in web browers. + popup in web browsers. :param url_part_order: A string that controls the order that the pieces of the url are concatenated when the full url is constructed. 'b' is the blueprint (or blueprint registration) prefix, 'a' is the api @@ -153,7 +155,7 @@ class Api(object): rule = blueprint_setup.url_prefix + rule options.setdefault('subdomain', blueprint_setup.subdomain) if endpoint is None: - endpoint = _endpoint_from_view_func(view_func) + endpoint = view_func.__name__ defaults = blueprint_setup.url_defaults if 'defaults' in options: defaults = dict(defaults, **options.pop('defaults')) @@ -287,6 +289,13 @@ class Api(object): headers = Headers() if isinstance(e, HTTPException): + if e.response is not None: + # If HTTPException is initialized with a response, then return e.get_response(). + # This prevents specified error response from being overridden. + # eg. HTTPException(response=Response("Hello World")) + resp = e.get_response() + return resp + code = e.code default_data = { 'message': getattr(e, 'description', http_status_message(code)) diff --git a/libs/flask_restful/__version__.py b/libs/flask_restful/__version__.py index ebac6ac55..d0ecbea71 100644 --- a/libs/flask_restful/__version__.py +++ b/libs/flask_restful/__version__.py @@ -1,3 +1,3 @@ #!/usr/bin/env python -__version__ = '0.3.7' +__version__ = '0.3.9' diff --git a/libs/flask_restful/fields.py b/libs/flask_restful/fields.py index 27531d2cb..70a54060c 100644 --- a/libs/flask_restful/fields.py +++ b/libs/flask_restful/fields.py @@ -1,6 +1,4 @@ -from datetime import datetime from calendar import timegm -import pytz from decimal import Decimal as MyDecimal, ROUND_HALF_EVEN from email.utils import formatdate import six @@ -9,8 +7,7 @@ try: except ImportError: # python3 from urllib.parse import urlparse, urlunparse - -from flask_restful import inputs, marshal +from flask_restful import marshal from flask import url_for, request __all__ = ["String", "FormattedString", "Url", "DateTime", "Float", diff --git a/libs/flask_restful/inputs.py b/libs/flask_restful/inputs.py index 141fa9ad4..1b36c85e0 100644 --- a/libs/flask_restful/inputs.py +++ b/libs/flask_restful/inputs.py @@ -269,7 +269,7 @@ def datetime_from_rfc822(datetime_str): def datetime_from_iso8601(datetime_str): - """Turns an ISO8601 formatted date into a datetime object. + """Turns an ISO8601 formatted datetime into a datetime object. Example:: diff --git a/libs/flask_restful/reqparse.py b/libs/flask_restful/reqparse.py index 754f14c1e..9bb309914 100644 --- a/libs/flask_restful/reqparse.py +++ b/libs/flask_restful/reqparse.py @@ -1,6 +1,9 @@ from copy import deepcopy -import collections +try: + from collections.abc import MutableSequence +except ImportError: + from collections import MutableSequence from flask import current_app, request from werkzeug.datastructures import MultiDict, FileStorage from werkzeug import exceptions @@ -146,7 +149,7 @@ class Argument(object): except TypeError: try: if self.type is decimal.Decimal: - return self.type(str(value), self.name) + return self.type(str(value)) else: return self.type(value, self.name) except TypeError: @@ -194,7 +197,7 @@ class Argument(object): values = source.getlist(name) else: values = source.get(name) - if not (isinstance(values, collections.MutableSequence) and self.action == 'append'): + if not (isinstance(values, MutableSequence) and self.action == 'append'): values = [values] for value in values: diff --git a/libs/flask_restful/utils/__init__.py b/libs/flask_restful/utils/__init__.py index 7d6baecb0..8f267b9d2 100644 --- a/libs/flask_restful/utils/__init__.py +++ b/libs/flask_restful/utils/__init__.py @@ -1,9 +1,9 @@ import sys try: - from collections import OrderedDict + from collections.abc import OrderedDict except ImportError: - from ordereddict import OrderedDict + from collections import OrderedDict from werkzeug.http import HTTP_STATUS_CODES diff --git a/libs/future/__init__.py b/libs/future/__init__.py index 211fb43bc..ad419d67e 100644 --- a/libs/future/__init__.py +++ b/libs/future/__init__.py @@ -68,7 +68,7 @@ See: http://python-future.org Credits ------- -:Author: Ed Schofield +:Author: Ed Schofield, Jordan M. Adler, et al :Sponsor: Python Charmers Pty Ltd, Australia, and Python Charmers Pte Ltd, Singapore. http://pythoncharmers.com :Others: See docs/credits.rst or http://python-future.org/credits.html @@ -76,7 +76,7 @@ Credits Licensing --------- -Copyright 2013-2018 Python Charmers Pty Ltd, Australia. +Copyright 2013-2019 Python Charmers Pty Ltd, Australia. The software is distributed under an MIT licence. See LICENSE.txt. """ @@ -84,10 +84,10 @@ The software is distributed under an MIT licence. See LICENSE.txt. __title__ = 'future' __author__ = 'Ed Schofield' __license__ = 'MIT' -__copyright__ = 'Copyright 2013-2018 Python Charmers Pty Ltd' +__copyright__ = 'Copyright 2013-2019 Python Charmers Pty Ltd' __ver_major__ = 0 -__ver_minor__ = 17 -__ver_patch__ = 0 +__ver_minor__ = 18 +__ver_patch__ = 2 __ver_sub__ = '' __version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__, __ver_patch__, __ver_sub__) diff --git a/libs/future/backports/__init__.py b/libs/future/backports/__init__.py index 68291141c..c71e06535 100644 --- a/libs/future/backports/__init__.py +++ b/libs/future/backports/__init__.py @@ -10,7 +10,7 @@ __future_module__ = True from future.standard_library import import_top_level_modules -if sys.version_info[0] == 3: +if sys.version_info[0] >= 3: import_top_level_modules() diff --git a/libs/future/backports/email/message.py b/libs/future/backports/email/message.py index 99715fcc6..d8d9615d7 100644 --- a/libs/future/backports/email/message.py +++ b/libs/future/backports/email/message.py @@ -800,7 +800,7 @@ class Message(object): # There was no Content-Type header, and we don't know what type # to set it to, so raise an exception. raise errors.HeaderParseError('No Content-Type header found') - newparams = [] + newparams = list() foundp = False for pk, pv in params: if pk.lower() == 'boundary': @@ -814,10 +814,10 @@ class Message(object): # instead??? newparams.append(('boundary', '"%s"' % boundary)) # Replace the existing Content-Type header with the new value - newheaders = [] + newheaders = list() for h, v in self._headers: if h.lower() == 'content-type': - parts = [] + parts = list() for k, v in newparams: if v == '': parts.append(k) diff --git a/libs/future/backports/http/client.py b/libs/future/backports/http/client.py index 5dd983d80..e663d125c 100644 --- a/libs/future/backports/http/client.py +++ b/libs/future/backports/http/client.py @@ -79,11 +79,15 @@ from future.backports.misc import create_connection as socket_create_connection import io import os import socket -import collections from future.backports.urllib.parse import urlsplit import warnings from array import array +if PY2: + from collections import Iterable +else: + from collections.abc import Iterable + __all__ = ["HTTPResponse", "HTTPConnection", "HTTPException", "NotConnected", "UnknownProtocol", "UnknownTransferEncoding", "UnimplementedFileMode", @@ -696,9 +700,19 @@ class HTTPResponse(io.RawIOBase): while total_bytes < len(b): if MAXAMOUNT < len(mvb): temp_mvb = mvb[0:MAXAMOUNT] - n = self.fp.readinto(temp_mvb) + if PY2: + data = self.fp.read(len(temp_mvb)) + n = len(data) + temp_mvb[:n] = data + else: + n = self.fp.readinto(temp_mvb) else: - n = self.fp.readinto(mvb) + if PY2: + data = self.fp.read(len(mvb)) + n = len(data) + mvb[:n] = data + else: + n = self.fp.readinto(mvb) if not n: raise IncompleteRead(bytes(mvb[0:total_bytes]), len(b)) mvb = mvb[n:] @@ -892,7 +906,7 @@ class HTTPConnection(object): try: self.sock.sendall(data) except TypeError: - if isinstance(data, collections.Iterable): + if isinstance(data, Iterable): for d in data: self.sock.sendall(d) else: diff --git a/libs/future/backports/http/cookiejar.py b/libs/future/backports/http/cookiejar.py index cad72f9b4..af3ef4151 100644 --- a/libs/future/backports/http/cookiejar.py +++ b/libs/future/backports/http/cookiejar.py @@ -33,7 +33,7 @@ from __future__ import print_function from __future__ import division from __future__ import absolute_import from future.builtins import filter, int, map, open, str -from future.utils import as_native_str +from future.utils import as_native_str, PY2 __all__ = ['Cookie', 'CookieJar', 'CookiePolicy', 'DefaultCookiePolicy', 'FileCookieJar', 'LWPCookieJar', 'LoadError', 'MozillaCookieJar'] @@ -41,7 +41,8 @@ __all__ = ['Cookie', 'CookieJar', 'CookiePolicy', 'DefaultCookiePolicy', import copy import datetime import re -re.ASCII = 0 +if PY2: + re.ASCII = 0 import time from future.backports.urllib.parse import urlparse, urlsplit, quote from future.backports.http.client import HTTP_PORT diff --git a/libs/future/backports/http/cookies.py b/libs/future/backports/http/cookies.py index ae32ed7e7..8bb61e22c 100644 --- a/libs/future/backports/http/cookies.py +++ b/libs/future/backports/http/cookies.py @@ -138,7 +138,8 @@ from future.utils import PY2, as_native_str # Import our required modules # import re -re.ASCII = 0 # for py2 compatibility +if PY2: + re.ASCII = 0 # for py2 compatibility import string __all__ = ["CookieError", "BaseCookie", "SimpleCookie"] diff --git a/libs/future/backports/misc.py b/libs/future/backports/misc.py index ef7520788..098a0667e 100644 --- a/libs/future/backports/misc.py +++ b/libs/future/backports/misc.py @@ -16,7 +16,6 @@ from __future__ import absolute_import import subprocess from math import ceil as oldceil -from collections import Mapping, MutableMapping from operator import itemgetter as _itemgetter, eq as _eq import sys @@ -25,7 +24,12 @@ from _weakref import proxy as _proxy from itertools import repeat as _repeat, chain as _chain, starmap as _starmap from socket import getaddrinfo, SOCK_STREAM, error, socket -from future.utils import iteritems, itervalues, PY26, PY3 +from future.utils import iteritems, itervalues, PY2, PY26, PY3 + +if PY2: + from collections import Mapping, MutableMapping +else: + from collections.abc import Mapping, MutableMapping def ceil(x): diff --git a/libs/future/backports/test/pystone.py b/libs/future/backports/test/pystone.py old mode 100644 new mode 100755 diff --git a/libs/future/backports/urllib/request.py b/libs/future/backports/urllib/request.py index b1545ca0f..baee5401a 100644 --- a/libs/future/backports/urllib/request.py +++ b/libs/future/backports/urllib/request.py @@ -109,11 +109,17 @@ import re import socket import sys import time -import collections import tempfile import contextlib import warnings +from future.utils import PY2 + +if PY2: + from collections import Iterable +else: + from collections.abc import Iterable + # check for SSL try: import ssl @@ -1221,7 +1227,7 @@ class AbstractHTTPHandler(BaseHandler): mv = memoryview(data) size = len(mv) * mv.itemsize except TypeError: - if isinstance(data, collections.Iterable): + if isinstance(data, Iterable): raise ValueError("Content-Length should be specified " "for iterable data of type %r %r" % (type(data), data)) diff --git a/libs/future/builtins/__init__.py b/libs/future/builtins/__init__.py index 216465a15..8bc1649d2 100644 --- a/libs/future/builtins/__init__.py +++ b/libs/future/builtins/__init__.py @@ -11,7 +11,7 @@ from future.builtins.iterators import (filter, map, zip) # The isinstance import is no longer needed. We provide it only for # backward-compatibility with future v0.8.2. It will be removed in future v1.0. from future.builtins.misc import (ascii, chr, hex, input, isinstance, next, - oct, open, pow, round, super) + oct, open, pow, round, super, max, min) from future.utils import PY3 if PY3: @@ -43,7 +43,7 @@ if not utils.PY3: __all__ = ['filter', 'map', 'zip', 'ascii', 'chr', 'hex', 'input', 'next', 'oct', 'open', 'pow', 'round', 'super', - 'bytes', 'dict', 'int', 'list', 'object', 'range', 'str', + 'bytes', 'dict', 'int', 'list', 'object', 'range', 'str', 'max', 'min' ] else: diff --git a/libs/future/builtins/misc.py b/libs/future/builtins/misc.py index 90dc384ad..f86ce5f34 100644 --- a/libs/future/builtins/misc.py +++ b/libs/future/builtins/misc.py @@ -13,6 +13,8 @@ The builtin functions are: - ``open`` (equivalent to io.open on Py2) - ``super`` (backport of Py3's magic zero-argument super() function - ``round`` (new "Banker's Rounding" behaviour from Py3) +- ``max`` (new default option from Py3.4) +- ``min`` (new default option from Py3.4) ``isinstance`` is also currently exported for backwards compatibility with v0.8.2, although this has been deprecated since v0.9. @@ -59,6 +61,8 @@ if utils.PY2: from future.builtins.newnext import newnext as next from future.builtins.newround import newround as round from future.builtins.newsuper import newsuper as super + from future.builtins.new_min_max import newmax as max + from future.builtins.new_min_max import newmin as min from future.types.newint import newint _SENTINEL = object() @@ -89,11 +93,12 @@ if utils.PY2: else: return _builtin_pow(x+0j, y, z) + # ``future`` doesn't support Py3.0/3.1. If we ever did, we'd add this: # callable = __builtin__.callable __all__ = ['ascii', 'chr', 'hex', 'input', 'isinstance', 'next', 'oct', - 'open', 'pow', 'round', 'super'] + 'open', 'pow', 'round', 'super', 'max', 'min'] else: import builtins @@ -109,8 +114,14 @@ else: pow = builtins.pow round = builtins.round super = builtins.super - - __all__ = [] + if utils.PY34_PLUS: + max = builtins.max + min = builtins.min + __all__ = [] + else: + from future.builtins.new_min_max import newmax as max + from future.builtins.new_min_max import newmin as min + __all__ = ['min', 'max'] # The callable() function was removed from Py3.0 and 3.1 and # reintroduced into Py3.2+. ``future`` doesn't support Py3.0/3.1. If we ever diff --git a/libs/future/builtins/new_min_max.py b/libs/future/builtins/new_min_max.py new file mode 100644 index 000000000..6f0c2a86f --- /dev/null +++ b/libs/future/builtins/new_min_max.py @@ -0,0 +1,59 @@ +import itertools + +from future import utils +if utils.PY2: + from __builtin__ import max as _builtin_max, min as _builtin_min +else: + from builtins import max as _builtin_max, min as _builtin_min + +_SENTINEL = object() + + +def newmin(*args, **kwargs): + return new_min_max(_builtin_min, *args, **kwargs) + + +def newmax(*args, **kwargs): + return new_min_max(_builtin_max, *args, **kwargs) + + +def new_min_max(_builtin_func, *args, **kwargs): + """ + To support the argument "default" introduced in python 3.4 for min and max + :param _builtin_func: builtin min or builtin max + :param args: + :param kwargs: + :return: returns the min or max based on the arguments passed + """ + + for key, _ in kwargs.items(): + if key not in set(['key', 'default']): + raise TypeError('Illegal argument %s', key) + + if len(args) == 0: + raise TypeError + + if len(args) != 1 and kwargs.get('default', _SENTINEL) is not _SENTINEL: + raise TypeError + + if len(args) == 1: + iterator = iter(args[0]) + try: + first = next(iterator) + except StopIteration: + if kwargs.get('default', _SENTINEL) is not _SENTINEL: + return kwargs.get('default') + else: + raise ValueError('{}() arg is an empty sequence'.format(_builtin_func.__name__)) + else: + iterator = itertools.chain([first], iterator) + if kwargs.get('key') is not None: + return _builtin_func(iterator, key=kwargs.get('key')) + else: + return _builtin_func(iterator) + + if len(args) > 1: + if kwargs.get('key') is not None: + return _builtin_func(args, key=kwargs.get('key')) + else: + return _builtin_func(args) diff --git a/libs/future/builtins/newround.py b/libs/future/builtins/newround.py index 3943ebb6e..394a2c63c 100644 --- a/libs/future/builtins/newround.py +++ b/libs/future/builtins/newround.py @@ -38,11 +38,14 @@ def newround(number, ndigits=None): if 'numpy' in repr(type(number)): number = float(number) - if not PY26: - d = Decimal.from_float(number).quantize(exponent, - rounding=ROUND_HALF_EVEN) + if isinstance(number, Decimal): + d = number else: - d = from_float_26(number).quantize(exponent, rounding=ROUND_HALF_EVEN) + if not PY26: + d = Decimal.from_float(number).quantize(exponent, + rounding=ROUND_HALF_EVEN) + else: + d = from_float_26(number).quantize(exponent, rounding=ROUND_HALF_EVEN) if return_int: return int(d) diff --git a/libs/future/moves/__init__.py b/libs/future/moves/__init__.py index 040fdcf01..0cd60d3d5 100644 --- a/libs/future/moves/__init__.py +++ b/libs/future/moves/__init__.py @@ -4,5 +4,5 @@ import sys __future_module__ = True from future.standard_library import import_top_level_modules -if sys.version_info[0] == 3: +if sys.version_info[0] >= 3: import_top_level_modules() diff --git a/libs/future/moves/copyreg.py b/libs/future/moves/copyreg.py index 21c7a42f2..9d08cdc5e 100644 --- a/libs/future/moves/copyreg.py +++ b/libs/future/moves/copyreg.py @@ -2,7 +2,11 @@ from __future__ import absolute_import from future.utils import PY3 if PY3: - from copyreg import * + import copyreg, sys + # A "*" import uses Python 3's copyreg.__all__ which does not include + # all public names in the API surface for copyreg, this avoids that + # problem by just making our module _be_ a reference to the actual module. + sys.modules['future.moves.copyreg'] = copyreg else: __future_module__ = True from copy_reg import * diff --git a/libs/future/moves/urllib/request.py b/libs/future/moves/urllib/request.py index 60e440a77..972aa4ab5 100644 --- a/libs/future/moves/urllib/request.py +++ b/libs/future/moves/urllib/request.py @@ -11,19 +11,8 @@ if PY3: proxy_bypass, quote, request_host, - splitattr, - splithost, - splitpasswd, - splitport, - splitquery, - splittag, - splittype, - splituser, - splitvalue, thishost, - to_bytes, unquote, - unwrap, url2pathname, urlcleanup, urljoin, @@ -32,6 +21,18 @@ if PY3: urlretrieve, urlsplit, urlunparse) + + from urllib.parse import (splitattr, + splithost, + splitpasswd, + splitport, + splitquery, + splittag, + splittype, + splituser, + splitvalue, + to_bytes, + unwrap) else: __future_module__ = True with suspend_hooks(): diff --git a/libs/future/tests/base.py b/libs/future/tests/base.py index 9f4607b69..4ef437baa 100644 --- a/libs/future/tests/base.py +++ b/libs/future/tests/base.py @@ -272,7 +272,11 @@ class CodeHandler(unittest.TestCase): else: headers = '' - self.compare(output, headers + reformat_code(expected), + reformatted = reformat_code(expected) + if headers in reformatted: + headers = '' + + self.compare(output, headers + reformatted, ignore_imports=ignore_imports) def unchanged(self, code, **kwargs): @@ -338,6 +342,10 @@ class CodeHandler(unittest.TestCase): '----\n%s\n----' % f.read(), ) ErrorClass = (FuturizeError if 'futurize' in script else PasteurizeError) + + if not hasattr(e, 'output'): + # The attribute CalledProcessError.output doesn't exist on Py2.6 + e.output = None raise ErrorClass(msg, e.returncode, e.cmd, output=e.output) return output diff --git a/libs/future/types/newbytes.py b/libs/future/types/newbytes.py index 2a337c864..c9d584a7c 100644 --- a/libs/future/types/newbytes.py +++ b/libs/future/types/newbytes.py @@ -5,15 +5,19 @@ Why do this? Without it, the Python 2 bytes object is a very, very different beast to the Python 3 bytes object. """ -from collections import Iterable from numbers import Integral import string import copy -from future.utils import istext, isbytes, PY3, with_metaclass +from future.utils import istext, isbytes, PY2, PY3, with_metaclass from future.types import no, issubset from future.types.newobject import newobject +if PY2: + from collections import Iterable +else: + from collections.abc import Iterable + _builtin_bytes = bytes diff --git a/libs/future/types/newint.py b/libs/future/types/newint.py index 705b8fa95..748dba9d2 100644 --- a/libs/future/types/newint.py +++ b/libs/future/types/newint.py @@ -8,7 +8,6 @@ They are very similar. The most notable difference is: from __future__ import division import struct -import collections from future.types.newbytes import newbytes from future.types.newobject import newobject @@ -17,6 +16,9 @@ from future.utils import PY3, isint, istext, isbytes, with_metaclass, native if PY3: long = int + from collections.abc import Iterable +else: + from collections import Iterable class BaseNewInt(type): @@ -356,7 +358,7 @@ class newint(with_metaclass(BaseNewInt, long)): raise TypeError("cannot convert unicode objects to bytes") # mybytes can also be passed as a sequence of integers on Py3. # Test for this: - elif isinstance(mybytes, collections.Iterable): + elif isinstance(mybytes, Iterable): mybytes = newbytes(mybytes) b = mybytes if byteorder == 'big' else mybytes[::-1] if len(b) == 0: diff --git a/libs/future/types/newmemoryview.py b/libs/future/types/newmemoryview.py index 72c6990a7..09f804dcf 100644 --- a/libs/future/types/newmemoryview.py +++ b/libs/future/types/newmemoryview.py @@ -1,14 +1,16 @@ """ A pretty lame implementation of a memoryview object for Python 2.6. """ - -from collections import Iterable from numbers import Integral import string -from future.utils import istext, isbytes, PY3, with_metaclass +from future.utils import istext, isbytes, PY2, with_metaclass from future.types import no, issubset +if PY2: + from collections import Iterable +else: + from collections.abc import Iterable # class BaseNewBytes(type): # def __instancecheck__(cls, instance): diff --git a/libs/future/types/newobject.py b/libs/future/types/newobject.py index 776d47664..31b84fc12 100644 --- a/libs/future/types/newobject.py +++ b/libs/future/types/newobject.py @@ -112,5 +112,6 @@ class newobject(object): """ return object(self) + __slots__ = [] __all__ = ['newobject'] diff --git a/libs/future/types/newrange.py b/libs/future/types/newrange.py index 9173b0509..eda01a5a5 100644 --- a/libs/future/types/newrange.py +++ b/libs/future/types/newrange.py @@ -19,7 +19,12 @@ From Dan Crosta's README: """ from __future__ import absolute_import -from collections import Sequence, Iterator +from future.utils import PY2 + +if PY2: + from collections import Sequence, Iterator +else: + from collections.abc import Sequence, Iterator from itertools import islice from future.backports.misc import count # with step parameter on Py2.6 diff --git a/libs/future/types/newstr.py b/libs/future/types/newstr.py index e6272fb90..8ca191f97 100644 --- a/libs/future/types/newstr.py +++ b/libs/future/types/newstr.py @@ -40,7 +40,6 @@ representations of your objects portably across Py3 and Py2, use the """ -from collections import Iterable from numbers import Number from future.utils import PY3, istext, with_metaclass, isnewbytes @@ -51,6 +50,9 @@ from future.types.newobject import newobject if PY3: # We'll probably never use newstr on Py3 anyway... unicode = str + from collections.abc import Iterable +else: + from collections import Iterable class BaseNewStr(type): @@ -105,6 +107,7 @@ class newstr(with_metaclass(BaseNewStr, unicode)): """ Without the u prefix """ + value = super(newstr, self).__repr__() # assert value[0] == u'u' return value[1:] @@ -290,7 +293,14 @@ class newstr(with_metaclass(BaseNewStr, unicode)): isinstance(other, bytes) and not isnewbytes(other)): return super(newstr, self).__eq__(other) else: - return False + return NotImplemented + + def __hash__(self): + if (isinstance(self, unicode) or + isinstance(self, bytes) and not isnewbytes(self)): + return super(newstr, self).__hash__() + else: + raise NotImplementedError() def __ne__(self, other): if (isinstance(other, unicode) or diff --git a/libs/future/utils/__init__.py b/libs/future/utils/__init__.py index 906f1e464..46bd96def 100644 --- a/libs/future/utils/__init__.py +++ b/libs/future/utils/__init__.py @@ -18,8 +18,10 @@ This module exports useful functions for 2/3 compatible code: * types: * text_type: unicode in Python 2, str in Python 3 - * binary_type: str in Python 2, bytes in Python 3 * string_types: basestring in Python 2, str in Python 3 + * binary_type: str in Python 2, bytes in Python 3 + * integer_types: (int, long) in Python 2, int in Python 3 + * class_types: (type, types.ClassType) in Python 2, type in Python 3 * bchr(c): Take an integer and make a 1-character byte string @@ -55,7 +57,8 @@ import copy import inspect -PY3 = sys.version_info[0] == 3 +PY3 = sys.version_info[0] >= 3 +PY34_PLUS = sys.version_info[0:2] >= (3, 4) PY35_PLUS = sys.version_info[0:2] >= (3, 5) PY36_PLUS = sys.version_info[0:2] >= (3, 6) PY2 = sys.version_info[0] == 2 @@ -405,12 +408,34 @@ if PY3: allows re-raising exceptions with the cls value and traceback on Python 2 and 3. """ - if value is not None and isinstance(tp, Exception): - raise TypeError("instance exception may not have a separate value") - if value is not None: - exc = tp(value) - else: + if isinstance(tp, BaseException): + # If the first object is an instance, the type of the exception + # is the class of the instance, the instance itself is the value, + # and the second object must be None. + if value is not None: + raise TypeError("instance exception may not have a separate value") exc = tp + elif isinstance(tp, type) and not issubclass(tp, BaseException): + # If the first object is a class, it becomes the type of the + # exception. + raise TypeError("class must derive from BaseException, not %s" % tp.__name__) + else: + # The second object is used to determine the exception value: If it + # is an instance of the class, the instance becomes the exception + # value. If the second object is a tuple, it is used as the argument + # list for the class constructor; if it is None, an empty argument + # list is used, and any other object is treated as a single argument + # to the constructor. The instance so created by calling the + # constructor is used as the exception value. + if isinstance(value, tp): + exc = value + elif isinstance(value, tuple): + exc = tp(*value) + elif value is None: + exc = tp() + else: + exc = tp(value) + if exc.__traceback__ is not tb: raise exc.with_traceback(tb) raise exc @@ -443,12 +468,14 @@ else: e.__suppress_context__ = False if isinstance(cause, type) and issubclass(cause, Exception): e.__cause__ = cause() + e.__cause__.__traceback__ = sys.exc_info()[2] e.__suppress_context__ = True elif cause is None: e.__cause__ = None e.__suppress_context__ = True elif isinstance(cause, BaseException): e.__cause__ = cause + object.__setattr__(e.__cause__, '__traceback__', sys.exc_info()[2]) e.__suppress_context__ = True else: raise TypeError("exception causes must derive from BaseException") @@ -552,15 +579,14 @@ def isbytes(obj): def isnewbytes(obj): """ - Equivalent to the result of ``isinstance(obj, newbytes)`` were - ``__instancecheck__`` not overridden on the newbytes subclass. In - other words, it is REALLY a newbytes instance, not a Py2 native str + Equivalent to the result of ``type(obj) == type(newbytes)`` + in other words, it is REALLY a newbytes instance, not a Py2 native str object? + + Note that this does not cover subclasses of newbytes, and it is not + equivalent to ininstance(obj, newbytes) """ - # TODO: generalize this so that it works with subclasses of newbytes - # Import is here to avoid circular imports: - from future.types.newbytes import newbytes - return type(obj) == newbytes + return type(obj).__name__ == 'newbytes' def isint(obj): @@ -726,16 +752,16 @@ else: __all__ = ['PY2', 'PY26', 'PY3', 'PYPY', - 'as_native_str', 'bind_method', 'bord', 'bstr', - 'bytes_to_native_str', 'encode_filename', 'ensure_new_type', - 'exec_', 'get_next', 'getexception', 'implements_iterator', - 'is_new_style', 'isbytes', 'isidentifier', 'isint', - 'isnewbytes', 'istext', 'iteritems', 'iterkeys', 'itervalues', - 'lfilter', 'listitems', 'listvalues', 'lmap', 'lrange', - 'lzip', 'native', 'native_bytes', 'native_str', + 'as_native_str', 'binary_type', 'bind_method', 'bord', 'bstr', + 'bytes_to_native_str', 'class_types', 'encode_filename', + 'ensure_new_type', 'exec_', 'get_next', 'getexception', + 'implements_iterator', 'integer_types', 'is_new_style', 'isbytes', + 'isidentifier', 'isint', 'isnewbytes', 'istext', 'iteritems', + 'iterkeys', 'itervalues', 'lfilter', 'listitems', 'listvalues', + 'lmap', 'lrange', 'lzip', 'native', 'native_bytes', 'native_str', 'native_str_to_bytes', 'old_div', 'python_2_unicode_compatible', 'raise_', - 'raise_with_traceback', 'reraise', 'text_to_native_str', - 'tobytes', 'viewitems', 'viewkeys', 'viewvalues', - 'with_metaclass' - ] + 'raise_with_traceback', 'reraise', 'string_types', + 'text_to_native_str', 'text_type', 'tobytes', 'viewitems', + 'viewkeys', 'viewvalues', 'with_metaclass' + ] diff --git a/libs/html5lib/__init__.py b/libs/html5lib/__init__.py index ba01065ef..320e0c3b4 100644 --- a/libs/html5lib/__init__.py +++ b/libs/html5lib/__init__.py @@ -32,4 +32,4 @@ __all__ = ["HTMLParser", "parse", "parseFragment", "getTreeBuilder", # this has to be at the top level, see how setup.py parses this #: Distribution version number. -__version__ = "1.0.1" +__version__ = "1.1" diff --git a/libs/html5lib/_ihatexml.py b/libs/html5lib/_ihatexml.py index 4c77717bb..3ff803c19 100644 --- a/libs/html5lib/_ihatexml.py +++ b/libs/html5lib/_ihatexml.py @@ -136,6 +136,7 @@ def normaliseCharList(charList): i += j return rv + # We don't really support characters above the BMP :( max_unicode = int("FFFF", 16) @@ -254,7 +255,7 @@ class InfosetFilter(object): nameRest = name[1:] m = nonXmlNameFirstBMPRegexp.match(nameFirst) if m: - warnings.warn("Coercing non-XML name", DataLossWarning) + warnings.warn("Coercing non-XML name: %s" % name, DataLossWarning) nameFirstOutput = self.getReplacementCharacter(nameFirst) else: nameFirstOutput = nameFirst @@ -262,7 +263,7 @@ class InfosetFilter(object): nameRestOutput = nameRest replaceChars = set(nonXmlNameBMPRegexp.findall(nameRest)) for char in replaceChars: - warnings.warn("Coercing non-XML name", DataLossWarning) + warnings.warn("Coercing non-XML name: %s" % name, DataLossWarning) replacement = self.getReplacementCharacter(char) nameRestOutput = nameRestOutput.replace(char, replacement) return nameFirstOutput + nameRestOutput diff --git a/libs/html5lib/_inputstream.py b/libs/html5lib/_inputstream.py index 177f0ab9e..0207dd211 100644 --- a/libs/html5lib/_inputstream.py +++ b/libs/html5lib/_inputstream.py @@ -1,10 +1,11 @@ from __future__ import absolute_import, division, unicode_literals -from six import text_type, binary_type +from six import text_type from six.moves import http_client, urllib import codecs import re +from io import BytesIO, StringIO import webencodings @@ -12,13 +13,6 @@ from .constants import EOF, spaceCharacters, asciiLetters, asciiUppercase from .constants import _ReparseException from . import _utils -from io import StringIO - -try: - from io import BytesIO -except ImportError: - BytesIO = StringIO - # Non-unicode versions of constants for use in the pre-parser spaceCharactersBytes = frozenset([item.encode("ascii") for item in spaceCharacters]) asciiLettersBytes = frozenset([item.encode("ascii") for item in asciiLetters]) @@ -40,13 +34,13 @@ if _utils.supports_lone_surrogates: else: invalid_unicode_re = re.compile(invalid_unicode_no_surrogate) -non_bmp_invalid_codepoints = set([0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, - 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE, 0x5FFFF, - 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, - 0x8FFFF, 0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, - 0xBFFFE, 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE, - 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF, - 0x10FFFE, 0x10FFFF]) +non_bmp_invalid_codepoints = {0x1FFFE, 0x1FFFF, 0x2FFFE, 0x2FFFF, 0x3FFFE, + 0x3FFFF, 0x4FFFE, 0x4FFFF, 0x5FFFE, 0x5FFFF, + 0x6FFFE, 0x6FFFF, 0x7FFFE, 0x7FFFF, 0x8FFFE, + 0x8FFFF, 0x9FFFE, 0x9FFFF, 0xAFFFE, 0xAFFFF, + 0xBFFFE, 0xBFFFF, 0xCFFFE, 0xCFFFF, 0xDFFFE, + 0xDFFFF, 0xEFFFE, 0xEFFFF, 0xFFFFE, 0xFFFFF, + 0x10FFFE, 0x10FFFF} ascii_punctuation_re = re.compile("[\u0009-\u000D\u0020-\u002F\u003A-\u0040\u005C\u005B-\u0060\u007B-\u007E]") @@ -367,7 +361,7 @@ class HTMLUnicodeInputStream(object): def unget(self, char): # Only one character is allowed to be ungotten at once - it must # be consumed again before any further call to unget - if char is not None: + if char is not EOF: if self.chunkOffset == 0: # unget is called quite rarely, so it's a good idea to do # more work here if it saves a bit of work in the frequently @@ -449,7 +443,7 @@ class HTMLBinaryInputStream(HTMLUnicodeInputStream): try: stream.seek(stream.tell()) - except: # pylint:disable=bare-except + except Exception: stream = BufferedStream(stream) return stream @@ -461,7 +455,7 @@ class HTMLBinaryInputStream(HTMLUnicodeInputStream): if charEncoding[0] is not None: return charEncoding - # If we've been overriden, we've been overriden + # If we've been overridden, we've been overridden charEncoding = lookupEncoding(self.override_encoding), "certain" if charEncoding[0] is not None: return charEncoding @@ -664,9 +658,7 @@ class EncodingBytes(bytes): """Look for a sequence of bytes at the start of a string. If the bytes are found return True and advance the position to the byte after the match. Otherwise return False and leave the position alone""" - p = self.position - data = self[p:p + len(bytes)] - rv = data.startswith(bytes) + rv = self.startswith(bytes, self.position) if rv: self.position += len(bytes) return rv @@ -674,15 +666,11 @@ class EncodingBytes(bytes): def jumpTo(self, bytes): """Look for the next sequence of bytes matching a given sequence. If a match is found advance the position to the last byte of the match""" - newPosition = self[self.position:].find(bytes) - if newPosition > -1: - # XXX: This is ugly, but I can't see a nicer way to fix this. - if self._position == -1: - self._position = 0 - self._position += (newPosition + len(bytes) - 1) - return True - else: + try: + self._position = self.index(bytes, self.position) + len(bytes) - 1 + except ValueError: raise StopIteration + return True class EncodingParser(object): @@ -694,6 +682,9 @@ class EncodingParser(object): self.encoding = None def getEncoding(self): + if b"= (3, 7): + attributeMap = dict +else: + attributeMap = OrderedDict + class HTMLTokenizer(object): """ This class takes care of tokenizing HTML. @@ -228,6 +234,14 @@ class HTMLTokenizer(object): # Add token to the queue to be yielded if (token["type"] in tagTokenTypes): token["name"] = token["name"].translate(asciiUpper2Lower) + if token["type"] == tokenTypes["StartTag"]: + raw = token["data"] + data = attributeMap(raw) + if len(raw) > len(data): + # we had some duplicated attribute, fix so first wins + data.update(raw[::-1]) + token["data"] = data + if token["type"] == tokenTypes["EndTag"]: if token["data"]: self.tokenQueue.append({"type": tokenTypes["ParseError"], diff --git a/libs/html5lib/_trie/__init__.py b/libs/html5lib/_trie/__init__.py index a5ba4bf12..07bad5d31 100644 --- a/libs/html5lib/_trie/__init__.py +++ b/libs/html5lib/_trie/__init__.py @@ -1,14 +1,5 @@ from __future__ import absolute_import, division, unicode_literals -from .py import Trie as PyTrie +from .py import Trie -Trie = PyTrie - -# pylint:disable=wrong-import-position -try: - from .datrie import Trie as DATrie -except ImportError: - pass -else: - Trie = DATrie -# pylint:enable=wrong-import-position +__all__ = ["Trie"] diff --git a/libs/html5lib/_trie/_base.py b/libs/html5lib/_trie/_base.py index a1158bbbf..6b71975f0 100644 --- a/libs/html5lib/_trie/_base.py +++ b/libs/html5lib/_trie/_base.py @@ -1,6 +1,9 @@ from __future__ import absolute_import, division, unicode_literals -from collections import Mapping +try: + from collections.abc import Mapping +except ImportError: # Python 2.7 + from collections import Mapping class Trie(Mapping): diff --git a/libs/html5lib/_trie/datrie.py b/libs/html5lib/_trie/datrie.py deleted file mode 100644 index 51f3d046a..000000000 --- a/libs/html5lib/_trie/datrie.py +++ /dev/null @@ -1,44 +0,0 @@ -from __future__ import absolute_import, division, unicode_literals - -from datrie import Trie as DATrie -from six import text_type - -from ._base import Trie as ABCTrie - - -class Trie(ABCTrie): - def __init__(self, data): - chars = set() - for key in data.keys(): - if not isinstance(key, text_type): - raise TypeError("All keys must be strings") - for char in key: - chars.add(char) - - self._data = DATrie("".join(chars)) - for key, value in data.items(): - self._data[key] = value - - def __contains__(self, key): - return key in self._data - - def __len__(self): - return len(self._data) - - def __iter__(self): - raise NotImplementedError() - - def __getitem__(self, key): - return self._data[key] - - def keys(self, prefix=None): - return self._data.keys(prefix) - - def has_keys_with_prefix(self, prefix): - return self._data.has_keys_with_prefix(prefix) - - def longest_prefix(self, prefix): - return self._data.longest_prefix(prefix) - - def longest_prefix_item(self, prefix): - return self._data.longest_prefix_item(prefix) diff --git a/libs/html5lib/_utils.py b/libs/html5lib/_utils.py index 91252f2c0..9ea579421 100644 --- a/libs/html5lib/_utils.py +++ b/libs/html5lib/_utils.py @@ -2,12 +2,20 @@ from __future__ import absolute_import, division, unicode_literals from types import ModuleType -from six import text_type - try: - import xml.etree.cElementTree as default_etree + from collections.abc import Mapping except ImportError: + from collections import Mapping + +from six import text_type, PY3 + +if PY3: import xml.etree.ElementTree as default_etree +else: + try: + import xml.etree.cElementTree as default_etree + except ImportError: + import xml.etree.ElementTree as default_etree __all__ = ["default_etree", "MethodDispatcher", "isSurrogatePair", @@ -27,7 +35,7 @@ try: # We need this with u"" because of http://bugs.jython.org/issue2039 _x = eval('u"\\uD800"') # pylint:disable=eval-used assert isinstance(_x, text_type) -except: # pylint:disable=bare-except +except Exception: supports_lone_surrogates = False else: supports_lone_surrogates = True @@ -47,9 +55,6 @@ class MethodDispatcher(dict): """ def __init__(self, items=()): - # Using _dictEntries instead of directly assigning to self is about - # twice as fast. Please do careful performance testing before changing - # anything here. _dictEntries = [] for name, value in items: if isinstance(name, (list, tuple, frozenset, set)): @@ -64,6 +69,36 @@ class MethodDispatcher(dict): def __getitem__(self, key): return dict.get(self, key, self.default) + def __get__(self, instance, owner=None): + return BoundMethodDispatcher(instance, self) + + +class BoundMethodDispatcher(Mapping): + """Wraps a MethodDispatcher, binding its return values to `instance`""" + def __init__(self, instance, dispatcher): + self.instance = instance + self.dispatcher = dispatcher + + def __getitem__(self, key): + # see https://docs.python.org/3/reference/datamodel.html#object.__get__ + # on a function, __get__ is used to bind a function to an instance as a bound method + return self.dispatcher[key].__get__(self.instance) + + def get(self, key, default): + if key in self.dispatcher: + return self[key] + else: + return default + + def __iter__(self): + return iter(self.dispatcher) + + def __len__(self): + return len(self.dispatcher) + + def __contains__(self, key): + return key in self.dispatcher + # Some utility functions to deal with weirdness around UCS2 vs UCS4 # python builds diff --git a/libs/html5lib/constants.py b/libs/html5lib/constants.py index 1ff804190..fe3e237cd 100644 --- a/libs/html5lib/constants.py +++ b/libs/html5lib/constants.py @@ -519,8 +519,8 @@ adjustForeignAttributes = { "xmlns:xlink": ("xmlns", "xlink", namespaces["xmlns"]) } -unadjustForeignAttributes = dict([((ns, local), qname) for qname, (prefix, local, ns) in - adjustForeignAttributes.items()]) +unadjustForeignAttributes = {(ns, local): qname for qname, (prefix, local, ns) in + adjustForeignAttributes.items()} spaceCharacters = frozenset([ "\t", @@ -544,8 +544,7 @@ asciiLetters = frozenset(string.ascii_letters) digits = frozenset(string.digits) hexDigits = frozenset(string.hexdigits) -asciiUpper2Lower = dict([(ord(c), ord(c.lower())) - for c in string.ascii_uppercase]) +asciiUpper2Lower = {ord(c): ord(c.lower()) for c in string.ascii_uppercase} # Heading elements need to be ordered headingElements = ( @@ -2934,7 +2933,7 @@ tagTokenTypes = frozenset([tokenTypes["StartTag"], tokenTypes["EndTag"], tokenTypes["EmptyTag"]]) -prefixes = dict([(v, k) for k, v in namespaces.items()]) +prefixes = {v: k for k, v in namespaces.items()} prefixes["http://www.w3.org/1998/Math/MathML"] = "math" diff --git a/libs/html5lib/filters/sanitizer.py b/libs/html5lib/filters/sanitizer.py index e852f53be..70ef90665 100644 --- a/libs/html5lib/filters/sanitizer.py +++ b/libs/html5lib/filters/sanitizer.py @@ -1,6 +1,15 @@ +"""Deprecated from html5lib 1.1. + +See `here `_ for +information about its deprecation; `Bleach `_ +is recommended as a replacement. Please let us know in the aforementioned issue +if Bleach is unsuitable for your needs. + +""" from __future__ import absolute_import, division, unicode_literals import re +import warnings from xml.sax.saxutils import escape, unescape from six.moves import urllib_parse as urlparse @@ -11,6 +20,14 @@ from ..constants import namespaces, prefixes __all__ = ["Filter"] +_deprecation_msg = ( + "html5lib's sanitizer is deprecated; see " + + "https://github.com/html5lib/html5lib-python/issues/443 and please let " + + "us know if Bleach is unsuitable for your needs" +) + +warnings.warn(_deprecation_msg, DeprecationWarning) + allowed_elements = frozenset(( (namespaces['html'], 'a'), (namespaces['html'], 'abbr'), @@ -750,6 +767,9 @@ class Filter(base.Filter): """ super(Filter, self).__init__(source) + + warnings.warn(_deprecation_msg, DeprecationWarning) + self.allowed_elements = allowed_elements self.allowed_attributes = allowed_attributes self.allowed_css_properties = allowed_css_properties diff --git a/libs/html5lib/html5parser.py b/libs/html5lib/html5parser.py index 9d39b9d41..74d829d98 100644 --- a/libs/html5lib/html5parser.py +++ b/libs/html5lib/html5parser.py @@ -2,7 +2,6 @@ from __future__ import absolute_import, division, unicode_literals from six import with_metaclass, viewkeys import types -from collections import OrderedDict from . import _inputstream from . import _tokenizer @@ -119,8 +118,8 @@ class HTMLParser(object): self.tree = tree(namespaceHTMLElements) self.errors = [] - self.phases = dict([(name, cls(self, self.tree)) for name, cls in - getPhases(debug).items()]) + self.phases = {name: cls(self, self.tree) for name, cls in + getPhases(debug).items()} def _parse(self, stream, innerHTML=False, container="div", scripting=False, **kwargs): @@ -202,7 +201,7 @@ class HTMLParser(object): DoctypeToken = tokenTypes["Doctype"] ParseErrorToken = tokenTypes["ParseError"] - for token in self.normalizedTokens(): + for token in self.tokenizer: prev_token = None new_token = token while new_token is not None: @@ -260,10 +259,6 @@ class HTMLParser(object): if reprocess: assert self.phase not in phases - def normalizedTokens(self): - for token in self.tokenizer: - yield self.normalizeToken(token) - def parse(self, stream, *args, **kwargs): """Parse a HTML document into a well-formed tree @@ -325,17 +320,6 @@ class HTMLParser(object): if self.strict: raise ParseError(E[errorcode] % datavars) - def normalizeToken(self, token): - # HTML5 specific normalizations to the token stream - if token["type"] == tokenTypes["StartTag"]: - raw = token["data"] - token["data"] = OrderedDict(raw) - if len(raw) > len(token["data"]): - # we had some duplicated attribute, fix so first wins - token["data"].update(raw[::-1]) - - return token - def adjustMathMLAttributes(self, token): adjust_attributes(token, adjustMathMLAttributes) @@ -413,16 +397,12 @@ class HTMLParser(object): def getPhases(debug): def log(function): """Logger that records which phase processes each token""" - type_names = dict((value, key) for key, value in - tokenTypes.items()) + type_names = {value: key for key, value in tokenTypes.items()} def wrapped(self, *args, **kwargs): if function.__name__.startswith("process") and len(args) > 0: token = args[0] - try: - info = {"type": type_names[token['type']]} - except: - raise + info = {"type": type_names[token['type']]} if token['type'] in tagTokenTypes: info["name"] = token['name'] @@ -446,10 +426,13 @@ def getPhases(debug): class Phase(with_metaclass(getMetaclass(debug, log))): """Base class for helper object that implements each phase of processing """ + __slots__ = ("parser", "tree", "__startTagCache", "__endTagCache") def __init__(self, parser, tree): self.parser = parser self.tree = tree + self.__startTagCache = {} + self.__endTagCache = {} def processEOF(self): raise NotImplementedError @@ -469,7 +452,21 @@ def getPhases(debug): self.tree.insertText(token["data"]) def processStartTag(self, token): - return self.startTagHandler[token["name"]](token) + # Note the caching is done here rather than BoundMethodDispatcher as doing it there + # requires a circular reference to the Phase, and this ends up with a significant + # (CPython 2.7, 3.8) GC cost when parsing many short inputs + name = token["name"] + # In Py2, using `in` is quicker in general than try/except KeyError + # In Py3, `in` is quicker when there are few cache hits (typically short inputs) + if name in self.__startTagCache: + func = self.__startTagCache[name] + else: + func = self.__startTagCache[name] = self.startTagHandler[name] + # bound the cache size in case we get loads of unknown tags + while len(self.__startTagCache) > len(self.startTagHandler) * 1.1: + # this makes the eviction policy random on Py < 3.7 and FIFO >= 3.7 + self.__startTagCache.pop(next(iter(self.__startTagCache))) + return func(token) def startTagHtml(self, token): if not self.parser.firstStartTag and token["name"] == "html": @@ -482,9 +479,25 @@ def getPhases(debug): self.parser.firstStartTag = False def processEndTag(self, token): - return self.endTagHandler[token["name"]](token) + # Note the caching is done here rather than BoundMethodDispatcher as doing it there + # requires a circular reference to the Phase, and this ends up with a significant + # (CPython 2.7, 3.8) GC cost when parsing many short inputs + name = token["name"] + # In Py2, using `in` is quicker in general than try/except KeyError + # In Py3, `in` is quicker when there are few cache hits (typically short inputs) + if name in self.__endTagCache: + func = self.__endTagCache[name] + else: + func = self.__endTagCache[name] = self.endTagHandler[name] + # bound the cache size in case we get loads of unknown tags + while len(self.__endTagCache) > len(self.endTagHandler) * 1.1: + # this makes the eviction policy random on Py < 3.7 and FIFO >= 3.7 + self.__endTagCache.pop(next(iter(self.__endTagCache))) + return func(token) class InitialPhase(Phase): + __slots__ = tuple() + def processSpaceCharacters(self, token): pass @@ -613,6 +626,8 @@ def getPhases(debug): return True class BeforeHtmlPhase(Phase): + __slots__ = tuple() + # helper methods def insertHtmlElement(self): self.tree.insertRoot(impliedTagToken("html", "StartTag")) @@ -648,19 +663,7 @@ def getPhases(debug): return token class BeforeHeadPhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("head", self.startTagHead) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - (("head", "body", "html", "br"), self.endTagImplyHead) - ]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() def processEOF(self): self.startTagHead(impliedTagToken("head", "StartTag")) @@ -693,28 +696,19 @@ def getPhases(debug): self.parser.parseError("end-tag-after-implied-root", {"name": token["name"]}) + startTagHandler = _utils.MethodDispatcher([ + ("html", startTagHtml), + ("head", startTagHead) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + (("head", "body", "html", "br"), endTagImplyHead) + ]) + endTagHandler.default = endTagOther + class InHeadPhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("title", self.startTagTitle), - (("noframes", "style"), self.startTagNoFramesStyle), - ("noscript", self.startTagNoscript), - ("script", self.startTagScript), - (("base", "basefont", "bgsound", "command", "link"), - self.startTagBaseLinkCommand), - ("meta", self.startTagMeta), - ("head", self.startTagHead) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - ("head", self.endTagHead), - (("br", "html", "body"), self.endTagHtmlBodyBr) - ]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() # the real thing def processEOF(self): @@ -796,22 +790,27 @@ def getPhases(debug): def anythingElse(self): self.endTagHead(impliedTagToken("head")) - class InHeadNoscriptPhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) + startTagHandler = _utils.MethodDispatcher([ + ("html", startTagHtml), + ("title", startTagTitle), + (("noframes", "style"), startTagNoFramesStyle), + ("noscript", startTagNoscript), + ("script", startTagScript), + (("base", "basefont", "bgsound", "command", "link"), + startTagBaseLinkCommand), + ("meta", startTagMeta), + ("head", startTagHead) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + ("head", endTagHead), + (("br", "html", "body"), endTagHtmlBodyBr) + ]) + endTagHandler.default = endTagOther - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - (("basefont", "bgsound", "link", "meta", "noframes", "style"), self.startTagBaseLinkCommand), - (("head", "noscript"), self.startTagHeadNoscript), - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - ("noscript", self.endTagNoscript), - ("br", self.endTagBr), - ]) - self.endTagHandler.default = self.endTagOther + class InHeadNoscriptPhase(Phase): + __slots__ = tuple() def processEOF(self): self.parser.parseError("eof-in-head-noscript") @@ -860,23 +859,21 @@ def getPhases(debug): # Caller must raise parse error first! self.endTagNoscript(impliedTagToken("noscript")) + startTagHandler = _utils.MethodDispatcher([ + ("html", startTagHtml), + (("basefont", "bgsound", "link", "meta", "noframes", "style"), startTagBaseLinkCommand), + (("head", "noscript"), startTagHeadNoscript), + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + ("noscript", endTagNoscript), + ("br", endTagBr), + ]) + endTagHandler.default = endTagOther + class AfterHeadPhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("body", self.startTagBody), - ("frameset", self.startTagFrameset), - (("base", "basefont", "bgsound", "link", "meta", "noframes", "script", - "style", "title"), - self.startTagFromHead), - ("head", self.startTagHead) - ]) - self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([(("body", "html", "br"), - self.endTagHtmlBodyBr)]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() def processEOF(self): self.anythingElse() @@ -927,80 +924,30 @@ def getPhases(debug): self.parser.phase = self.parser.phases["inBody"] self.parser.framesetOK = True + startTagHandler = _utils.MethodDispatcher([ + ("html", startTagHtml), + ("body", startTagBody), + ("frameset", startTagFrameset), + (("base", "basefont", "bgsound", "link", "meta", "noframes", "script", + "style", "title"), + startTagFromHead), + ("head", startTagHead) + ]) + startTagHandler.default = startTagOther + endTagHandler = _utils.MethodDispatcher([(("body", "html", "br"), + endTagHtmlBodyBr)]) + endTagHandler.default = endTagOther + class InBodyPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#parsing-main-inbody # the really-really-really-very crazy mode - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) + __slots__ = ("processSpaceCharacters",) + def __init__(self, *args, **kwargs): + super(InBodyPhase, self).__init__(*args, **kwargs) # Set this to the default handler self.processSpaceCharacters = self.processSpaceCharactersNonPre - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - (("base", "basefont", "bgsound", "command", "link", "meta", - "script", "style", "title"), - self.startTagProcessInHead), - ("body", self.startTagBody), - ("frameset", self.startTagFrameset), - (("address", "article", "aside", "blockquote", "center", "details", - "dir", "div", "dl", "fieldset", "figcaption", "figure", - "footer", "header", "hgroup", "main", "menu", "nav", "ol", "p", - "section", "summary", "ul"), - self.startTagCloseP), - (headingElements, self.startTagHeading), - (("pre", "listing"), self.startTagPreListing), - ("form", self.startTagForm), - (("li", "dd", "dt"), self.startTagListItem), - ("plaintext", self.startTagPlaintext), - ("a", self.startTagA), - (("b", "big", "code", "em", "font", "i", "s", "small", "strike", - "strong", "tt", "u"), self.startTagFormatting), - ("nobr", self.startTagNobr), - ("button", self.startTagButton), - (("applet", "marquee", "object"), self.startTagAppletMarqueeObject), - ("xmp", self.startTagXmp), - ("table", self.startTagTable), - (("area", "br", "embed", "img", "keygen", "wbr"), - self.startTagVoidFormatting), - (("param", "source", "track"), self.startTagParamSource), - ("input", self.startTagInput), - ("hr", self.startTagHr), - ("image", self.startTagImage), - ("isindex", self.startTagIsIndex), - ("textarea", self.startTagTextarea), - ("iframe", self.startTagIFrame), - ("noscript", self.startTagNoscript), - (("noembed", "noframes"), self.startTagRawtext), - ("select", self.startTagSelect), - (("rp", "rt"), self.startTagRpRt), - (("option", "optgroup"), self.startTagOpt), - (("math"), self.startTagMath), - (("svg"), self.startTagSvg), - (("caption", "col", "colgroup", "frame", "head", - "tbody", "td", "tfoot", "th", "thead", - "tr"), self.startTagMisplaced) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - ("body", self.endTagBody), - ("html", self.endTagHtml), - (("address", "article", "aside", "blockquote", "button", "center", - "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", - "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", - "section", "summary", "ul"), self.endTagBlock), - ("form", self.endTagForm), - ("p", self.endTagP), - (("dd", "dt", "li"), self.endTagListItem), - (headingElements, self.endTagHeading), - (("a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", - "strike", "strong", "tt", "u"), self.endTagFormatting), - (("applet", "marquee", "object"), self.endTagAppletMarqueeObject), - ("br", self.endTagBr), - ]) - self.endTagHandler.default = self.endTagOther - def isMatchingFormattingElement(self, node1, node2): return (node1.name == node2.name and node1.namespace == node2.namespace and @@ -1650,14 +1597,73 @@ def getPhases(debug): self.parser.parseError("unexpected-end-tag", {"name": token["name"]}) break + startTagHandler = _utils.MethodDispatcher([ + ("html", Phase.startTagHtml), + (("base", "basefont", "bgsound", "command", "link", "meta", + "script", "style", "title"), + startTagProcessInHead), + ("body", startTagBody), + ("frameset", startTagFrameset), + (("address", "article", "aside", "blockquote", "center", "details", + "dir", "div", "dl", "fieldset", "figcaption", "figure", + "footer", "header", "hgroup", "main", "menu", "nav", "ol", "p", + "section", "summary", "ul"), + startTagCloseP), + (headingElements, startTagHeading), + (("pre", "listing"), startTagPreListing), + ("form", startTagForm), + (("li", "dd", "dt"), startTagListItem), + ("plaintext", startTagPlaintext), + ("a", startTagA), + (("b", "big", "code", "em", "font", "i", "s", "small", "strike", + "strong", "tt", "u"), startTagFormatting), + ("nobr", startTagNobr), + ("button", startTagButton), + (("applet", "marquee", "object"), startTagAppletMarqueeObject), + ("xmp", startTagXmp), + ("table", startTagTable), + (("area", "br", "embed", "img", "keygen", "wbr"), + startTagVoidFormatting), + (("param", "source", "track"), startTagParamSource), + ("input", startTagInput), + ("hr", startTagHr), + ("image", startTagImage), + ("isindex", startTagIsIndex), + ("textarea", startTagTextarea), + ("iframe", startTagIFrame), + ("noscript", startTagNoscript), + (("noembed", "noframes"), startTagRawtext), + ("select", startTagSelect), + (("rp", "rt"), startTagRpRt), + (("option", "optgroup"), startTagOpt), + (("math"), startTagMath), + (("svg"), startTagSvg), + (("caption", "col", "colgroup", "frame", "head", + "tbody", "td", "tfoot", "th", "thead", + "tr"), startTagMisplaced) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + ("body", endTagBody), + ("html", endTagHtml), + (("address", "article", "aside", "blockquote", "button", "center", + "details", "dialog", "dir", "div", "dl", "fieldset", "figcaption", "figure", + "footer", "header", "hgroup", "listing", "main", "menu", "nav", "ol", "pre", + "section", "summary", "ul"), endTagBlock), + ("form", endTagForm), + ("p", endTagP), + (("dd", "dt", "li"), endTagListItem), + (headingElements, endTagHeading), + (("a", "b", "big", "code", "em", "font", "i", "nobr", "s", "small", + "strike", "strong", "tt", "u"), endTagFormatting), + (("applet", "marquee", "object"), endTagAppletMarqueeObject), + ("br", endTagBr), + ]) + endTagHandler.default = endTagOther + class TextPhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([]) - self.startTagHandler.default = self.startTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("script", self.endTagScript)]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() def processCharacters(self, token): self.tree.insertText(token["data"]) @@ -1683,30 +1689,15 @@ def getPhases(debug): self.tree.openElements.pop() self.parser.phase = self.parser.originalPhase + startTagHandler = _utils.MethodDispatcher([]) + startTagHandler.default = startTagOther + endTagHandler = _utils.MethodDispatcher([ + ("script", endTagScript)]) + endTagHandler.default = endTagOther + class InTablePhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#in-table - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("caption", self.startTagCaption), - ("colgroup", self.startTagColgroup), - ("col", self.startTagCol), - (("tbody", "tfoot", "thead"), self.startTagRowGroup), - (("td", "th", "tr"), self.startTagImplyTbody), - ("table", self.startTagTable), - (("style", "script"), self.startTagStyleScript), - ("input", self.startTagInput), - ("form", self.startTagForm) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - ("table", self.endTagTable), - (("body", "caption", "col", "colgroup", "html", "tbody", "td", - "tfoot", "th", "thead", "tr"), self.endTagIgnore) - ]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() # helper methods def clearStackToTableContext(self): @@ -1828,9 +1819,32 @@ def getPhases(debug): self.parser.phases["inBody"].processEndTag(token) self.tree.insertFromTable = False + startTagHandler = _utils.MethodDispatcher([ + ("html", Phase.startTagHtml), + ("caption", startTagCaption), + ("colgroup", startTagColgroup), + ("col", startTagCol), + (("tbody", "tfoot", "thead"), startTagRowGroup), + (("td", "th", "tr"), startTagImplyTbody), + ("table", startTagTable), + (("style", "script"), startTagStyleScript), + ("input", startTagInput), + ("form", startTagForm) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + ("table", endTagTable), + (("body", "caption", "col", "colgroup", "html", "tbody", "td", + "tfoot", "th", "thead", "tr"), endTagIgnore) + ]) + endTagHandler.default = endTagOther + class InTableTextPhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) + __slots__ = ("originalPhase", "characterTokens") + + def __init__(self, *args, **kwargs): + super(InTableTextPhase, self).__init__(*args, **kwargs) self.originalPhase = None self.characterTokens = [] @@ -1875,23 +1889,7 @@ def getPhases(debug): class InCaptionPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#in-caption - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - (("caption", "col", "colgroup", "tbody", "td", "tfoot", "th", - "thead", "tr"), self.startTagTableElement) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - ("caption", self.endTagCaption), - ("table", self.endTagTable), - (("body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", - "thead", "tr"), self.endTagIgnore) - ]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() def ignoreEndTagCaption(self): return not self.tree.elementInScope("caption", variant="table") @@ -1944,23 +1942,24 @@ def getPhases(debug): def endTagOther(self, token): return self.parser.phases["inBody"].processEndTag(token) + startTagHandler = _utils.MethodDispatcher([ + ("html", Phase.startTagHtml), + (("caption", "col", "colgroup", "tbody", "td", "tfoot", "th", + "thead", "tr"), startTagTableElement) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + ("caption", endTagCaption), + ("table", endTagTable), + (("body", "col", "colgroup", "html", "tbody", "td", "tfoot", "th", + "thead", "tr"), endTagIgnore) + ]) + endTagHandler.default = endTagOther + class InColumnGroupPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#in-column - - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("col", self.startTagCol) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - ("colgroup", self.endTagColgroup), - ("col", self.endTagCol) - ]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() def ignoreEndTagColgroup(self): return self.tree.openElements[-1].name == "html" @@ -2010,26 +2009,21 @@ def getPhases(debug): if not ignoreEndTag: return token + startTagHandler = _utils.MethodDispatcher([ + ("html", Phase.startTagHtml), + ("col", startTagCol) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + ("colgroup", endTagColgroup), + ("col", endTagCol) + ]) + endTagHandler.default = endTagOther + class InTableBodyPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#in-table0 - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("tr", self.startTagTr), - (("td", "th"), self.startTagTableCell), - (("caption", "col", "colgroup", "tbody", "tfoot", "thead"), - self.startTagTableOther) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - (("tbody", "tfoot", "thead"), self.endTagTableRowGroup), - ("table", self.endTagTable), - (("body", "caption", "col", "colgroup", "html", "td", "th", - "tr"), self.endTagIgnore) - ]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() # helper methods def clearStackToTableBodyContext(self): @@ -2108,26 +2102,26 @@ def getPhases(debug): def endTagOther(self, token): return self.parser.phases["inTable"].processEndTag(token) + startTagHandler = _utils.MethodDispatcher([ + ("html", Phase.startTagHtml), + ("tr", startTagTr), + (("td", "th"), startTagTableCell), + (("caption", "col", "colgroup", "tbody", "tfoot", "thead"), + startTagTableOther) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + (("tbody", "tfoot", "thead"), endTagTableRowGroup), + ("table", endTagTable), + (("body", "caption", "col", "colgroup", "html", "td", "th", + "tr"), endTagIgnore) + ]) + endTagHandler.default = endTagOther + class InRowPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#in-row - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - (("td", "th"), self.startTagTableCell), - (("caption", "col", "colgroup", "tbody", "tfoot", "thead", - "tr"), self.startTagTableOther) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - ("tr", self.endTagTr), - ("table", self.endTagTable), - (("tbody", "tfoot", "thead"), self.endTagTableRowGroup), - (("body", "caption", "col", "colgroup", "html", "td", "th"), - self.endTagIgnore) - ]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() # helper methods (XXX unify this with other table helper methods) def clearStackToTableRowContext(self): @@ -2197,23 +2191,26 @@ def getPhases(debug): def endTagOther(self, token): return self.parser.phases["inTable"].processEndTag(token) + startTagHandler = _utils.MethodDispatcher([ + ("html", Phase.startTagHtml), + (("td", "th"), startTagTableCell), + (("caption", "col", "colgroup", "tbody", "tfoot", "thead", + "tr"), startTagTableOther) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + ("tr", endTagTr), + ("table", endTagTable), + (("tbody", "tfoot", "thead"), endTagTableRowGroup), + (("body", "caption", "col", "colgroup", "html", "td", "th"), + endTagIgnore) + ]) + endTagHandler.default = endTagOther + class InCellPhase(Phase): # http://www.whatwg.org/specs/web-apps/current-work/#in-cell - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - (("caption", "col", "colgroup", "tbody", "td", "tfoot", "th", - "thead", "tr"), self.startTagTableOther) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - (("td", "th"), self.endTagTableCell), - (("body", "caption", "col", "colgroup", "html"), self.endTagIgnore), - (("table", "tbody", "tfoot", "thead", "tr"), self.endTagImply) - ]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() # helper def closeCell(self): @@ -2273,26 +2270,22 @@ def getPhases(debug): def endTagOther(self, token): return self.parser.phases["inBody"].processEndTag(token) + startTagHandler = _utils.MethodDispatcher([ + ("html", Phase.startTagHtml), + (("caption", "col", "colgroup", "tbody", "td", "tfoot", "th", + "thead", "tr"), startTagTableOther) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + (("td", "th"), endTagTableCell), + (("body", "caption", "col", "colgroup", "html"), endTagIgnore), + (("table", "tbody", "tfoot", "thead", "tr"), endTagImply) + ]) + endTagHandler.default = endTagOther + class InSelectPhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("option", self.startTagOption), - ("optgroup", self.startTagOptgroup), - ("select", self.startTagSelect), - (("input", "keygen", "textarea"), self.startTagInput), - ("script", self.startTagScript) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([ - ("option", self.endTagOption), - ("optgroup", self.endTagOptgroup), - ("select", self.endTagSelect) - ]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() # http://www.whatwg.org/specs/web-apps/current-work/#in-select def processEOF(self): @@ -2373,21 +2366,25 @@ def getPhases(debug): self.parser.parseError("unexpected-end-tag-in-select", {"name": token["name"]}) - class InSelectInTablePhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - - self.startTagHandler = _utils.MethodDispatcher([ - (("caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"), - self.startTagTable) - ]) - self.startTagHandler.default = self.startTagOther + startTagHandler = _utils.MethodDispatcher([ + ("html", Phase.startTagHtml), + ("option", startTagOption), + ("optgroup", startTagOptgroup), + ("select", startTagSelect), + (("input", "keygen", "textarea"), startTagInput), + ("script", startTagScript) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + ("option", endTagOption), + ("optgroup", endTagOptgroup), + ("select", endTagSelect) + ]) + endTagHandler.default = endTagOther - self.endTagHandler = _utils.MethodDispatcher([ - (("caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"), - self.endTagTable) - ]) - self.endTagHandler.default = self.endTagOther + class InSelectInTablePhase(Phase): + __slots__ = tuple() def processEOF(self): self.parser.phases["inSelect"].processEOF() @@ -2412,7 +2409,21 @@ def getPhases(debug): def endTagOther(self, token): return self.parser.phases["inSelect"].processEndTag(token) + startTagHandler = _utils.MethodDispatcher([ + (("caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"), + startTagTable) + ]) + startTagHandler.default = startTagOther + + endTagHandler = _utils.MethodDispatcher([ + (("caption", "table", "tbody", "tfoot", "thead", "tr", "td", "th"), + endTagTable) + ]) + endTagHandler.default = endTagOther + class InForeignContentPhase(Phase): + __slots__ = tuple() + breakoutElements = frozenset(["b", "big", "blockquote", "body", "br", "center", "code", "dd", "div", "dl", "dt", "em", "embed", "h1", "h2", "h3", @@ -2422,9 +2433,6 @@ def getPhases(debug): "span", "strong", "strike", "sub", "sup", "table", "tt", "u", "ul", "var"]) - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - def adjustSVGTagNames(self, token): replacements = {"altglyph": "altGlyph", "altglyphdef": "altGlyphDef", @@ -2478,7 +2486,7 @@ def getPhases(debug): currentNode = self.tree.openElements[-1] if (token["name"] in self.breakoutElements or (token["name"] == "font" and - set(token["data"].keys()) & set(["color", "face", "size"]))): + set(token["data"].keys()) & {"color", "face", "size"})): self.parser.parseError("unexpected-html-element-in-foreign-content", {"name": token["name"]}) while (self.tree.openElements[-1].namespace != @@ -2528,16 +2536,7 @@ def getPhases(debug): return new_token class AfterBodyPhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) - - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml) - ]) - self.startTagHandler.default = self.startTagOther - - self.endTagHandler = _utils.MethodDispatcher([("html", self.endTagHtml)]) - self.endTagHandler.default = self.endTagOther + __slots__ = tuple() def processEOF(self): # Stop parsing @@ -2574,23 +2573,17 @@ def getPhases(debug): self.parser.phase = self.parser.phases["inBody"] return token - class InFramesetPhase(Phase): - # http://www.whatwg.org/specs/web-apps/current-work/#in-frameset - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) + startTagHandler = _utils.MethodDispatcher([ + ("html", startTagHtml) + ]) + startTagHandler.default = startTagOther - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("frameset", self.startTagFrameset), - ("frame", self.startTagFrame), - ("noframes", self.startTagNoframes) - ]) - self.startTagHandler.default = self.startTagOther + endTagHandler = _utils.MethodDispatcher([("html", endTagHtml)]) + endTagHandler.default = endTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("frameset", self.endTagFrameset) - ]) - self.endTagHandler.default = self.endTagOther + class InFramesetPhase(Phase): + # http://www.whatwg.org/specs/web-apps/current-work/#in-frameset + __slots__ = tuple() def processEOF(self): if self.tree.openElements[-1].name != "html": @@ -2631,21 +2624,22 @@ def getPhases(debug): self.parser.parseError("unexpected-end-tag-in-frameset", {"name": token["name"]}) - class AfterFramesetPhase(Phase): - # http://www.whatwg.org/specs/web-apps/current-work/#after3 - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) + startTagHandler = _utils.MethodDispatcher([ + ("html", Phase.startTagHtml), + ("frameset", startTagFrameset), + ("frame", startTagFrame), + ("noframes", startTagNoframes) + ]) + startTagHandler.default = startTagOther - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("noframes", self.startTagNoframes) - ]) - self.startTagHandler.default = self.startTagOther + endTagHandler = _utils.MethodDispatcher([ + ("frameset", endTagFrameset) + ]) + endTagHandler.default = endTagOther - self.endTagHandler = _utils.MethodDispatcher([ - ("html", self.endTagHtml) - ]) - self.endTagHandler.default = self.endTagOther + class AfterFramesetPhase(Phase): + # http://www.whatwg.org/specs/web-apps/current-work/#after3 + __slots__ = tuple() def processEOF(self): # Stop parsing @@ -2668,14 +2662,19 @@ def getPhases(debug): self.parser.parseError("unexpected-end-tag-after-frameset", {"name": token["name"]}) - class AfterAfterBodyPhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) + startTagHandler = _utils.MethodDispatcher([ + ("html", Phase.startTagHtml), + ("noframes", startTagNoframes) + ]) + startTagHandler.default = startTagOther - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml) - ]) - self.startTagHandler.default = self.startTagOther + endTagHandler = _utils.MethodDispatcher([ + ("html", endTagHtml) + ]) + endTagHandler.default = endTagOther + + class AfterAfterBodyPhase(Phase): + __slots__ = tuple() def processEOF(self): pass @@ -2706,15 +2705,13 @@ def getPhases(debug): self.parser.phase = self.parser.phases["inBody"] return token - class AfterAfterFramesetPhase(Phase): - def __init__(self, parser, tree): - Phase.__init__(self, parser, tree) + startTagHandler = _utils.MethodDispatcher([ + ("html", startTagHtml) + ]) + startTagHandler.default = startTagOther - self.startTagHandler = _utils.MethodDispatcher([ - ("html", self.startTagHtml), - ("noframes", self.startTagNoFrames) - ]) - self.startTagHandler.default = self.startTagOther + class AfterAfterFramesetPhase(Phase): + __slots__ = tuple() def processEOF(self): pass @@ -2741,6 +2738,13 @@ def getPhases(debug): def processEndTag(self, token): self.parser.parseError("expected-eof-but-got-end-tag", {"name": token["name"]}) + + startTagHandler = _utils.MethodDispatcher([ + ("html", startTagHtml), + ("noframes", startTagNoFrames) + ]) + startTagHandler.default = startTagOther + # pylint:enable=unused-argument return { @@ -2774,8 +2778,8 @@ def getPhases(debug): def adjust_attributes(token, replacements): needs_adjustment = viewkeys(token['data']) & viewkeys(replacements) if needs_adjustment: - token['data'] = OrderedDict((replacements.get(k, k), v) - for k, v in token['data'].items()) + token['data'] = type(token['data'])((replacements.get(k, k), v) + for k, v in token['data'].items()) def impliedTagToken(name, type="EndTag", attributes=None, diff --git a/libs/html5lib/serializer.py b/libs/html5lib/serializer.py index d6b7105d4..c66df6839 100644 --- a/libs/html5lib/serializer.py +++ b/libs/html5lib/serializer.py @@ -274,7 +274,7 @@ class HTMLSerializer(object): if token["systemId"]: if token["systemId"].find('"') >= 0: if token["systemId"].find("'") >= 0: - self.serializeError("System identifer contains both single and double quote characters") + self.serializeError("System identifier contains both single and double quote characters") quote_char = "'" else: quote_char = '"' diff --git a/libs/html5lib/tests/sanitizer-testdata/tests1.dat b/libs/html5lib/tests/sanitizer-testdata/tests1.dat new file mode 100644 index 000000000..74e883368 --- /dev/null +++ b/libs/html5lib/tests/sanitizer-testdata/tests1.dat @@ -0,0 +1,433 @@ +[ + { + "name": "IE_Comments", + "input": "", + "output": "" + }, + + { + "name": "IE_Comments_2", + "input": "", + "output": "<script>alert('XSS');</script>" + }, + + { + "name": "allow_colons_in_path_component", + "input": "foo", + "output": "foo" + }, + + { + "name": "background_attribute", + "input": "
", + "output": "
" + }, + + { + "name": "bgsound", + "input": "", + "output": "<bgsound src=\"javascript:alert('XSS');\"></bgsound>" + }, + + { + "name": "div_background_image_unicode_encoded", + "input": "
foo
", + "output": "
foo
" + }, + + { + "name": "div_expression", + "input": "
foo
", + "output": "
foo
" + }, + + { + "name": "double_open_angle_brackets", + "input": "", + "output": "" + }, + + { + "name": "img_dynsrc_lowsrc", + "input": "", + "output": "" + }, + + { + "name": "img_vbscript", + "input": "", + "output": "" + }, + + { + "name": "input_image", + "input": "", + "output": "" + }, + + { + "name": "link_stylesheets", + "input": "", + "output": "<link href=\"javascript:alert('XSS');\" rel=\"stylesheet\">" + }, + + { + "name": "link_stylesheets_2", + "input": "", + "output": "<link href=\"http://ha.ckers.org/xss.css\" rel=\"stylesheet\">" + }, + + { + "name": "list_style_image", + "input": "
  • foo
  • ", + "output": "
  • foo
  • " + }, + + { + "name": "no_closing_script_tags", + "input": "", + "output": "<script src=\"http://ha.ckers.org/xss.js\" xss=\"\"></script>" + }, + + { + "name": "non_alpha_non_digit_2", + "input": "foo", + "output": "foo" + }, + + { + "name": "non_alpha_non_digit_3", + "input": "", + "output": "" + }, + + { + "name": "non_alpha_non_digit_II", + "input": "foo", + "output": "foo" + }, + + { + "name": "non_alpha_non_digit_III", + "input": "foo", + "output": "foo" + }, + + { + "name": "platypus", + "input": "never trust your upstream platypus", + "output": "never trust your upstream platypus" + }, + + { + "name": "protocol_resolution_in_script_tag", + "input": "", + "output": "<script src=\"//ha.ckers.org/.j\"></script>" + }, + + { + "name": "should_allow_anchors", + "input": "", + "output": "<script>baz</script>" + }, + + { + "name": "should_allow_image_alt_attribute", + "input": "foo", + "output": "foo" + }, + + { + "name": "should_allow_image_height_attribute", + "input": "", + "output": "" + }, + + { + "name": "should_allow_image_src_attribute", + "input": "", + "output": "" + }, + + { + "name": "should_allow_image_width_attribute", + "input": "", + "output": "" + }, + + { + "name": "should_handle_blank_text", + "input": "", + "output": "" + }, + + { + "name": "should_handle_malformed_image_tags", + "input": "\">", + "output": "<script>alert(\"XSS\")</script>\">" + }, + + { + "name": "should_handle_non_html", + "input": "abc", + "output": "abc" + }, + + { + "name": "should_not_fall_for_ridiculous_hack", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_0", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_1", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_10", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_11", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_12", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_13", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_14", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_2", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_3", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_4", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_5", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_6", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_7", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_8", + "input": "", + "output": "" + }, + + { + "name": "should_not_fall_for_xss_image_hack_9", + "input": "", + "output": "" + }, + + { + "name": "should_sanitize_half_open_scripts", + "input": "", + "output": "<script src=\"http://ha.ckers.org/xss.js\" xss=\"\"></script>" + }, + + { + "name": "should_sanitize_script_tag_with_multiple_open_brackets", + "input": "<", + "output": "<<script>alert(\"XSS\");//<</script>" + }, + + { + "name": "should_sanitize_script_tag_with_multiple_open_brackets_2", + "input": " -#errors -(1,9): expected-doctype-but-got-end-tag -(1,9): unexpected-end-tag-before-html -(1,13): unexpected-end-tag-before-html -(1,18): unexpected-end-tag-before-html -(1,22): unexpected-end-tag-before-html -(1,26): unexpected-end-tag-before-html -(1,35): unexpected-end-tag-before-html -(1,39): unexpected-end-tag-before-html -(1,47): unexpected-end-tag-before-html -(1,52): unexpected-end-tag-before-html -(1,58): unexpected-end-tag-before-html -(1,64): unexpected-end-tag-before-html -(1,72): unexpected-end-tag-before-html -(1,79): unexpected-end-tag-before-html -(1,88): unexpected-end-tag-before-html -(1,93): unexpected-end-tag-before-html -(1,98): unexpected-end-tag-before-html -(1,103): unexpected-end-tag-before-html -(1,108): unexpected-end-tag-before-html -(1,113): unexpected-end-tag-before-html -(1,118): unexpected-end-tag-before-html -(1,130): unexpected-end-tag-after-body -(1,130): unexpected-end-tag-treated-as -(1,134): unexpected-end-tag -(1,140): unexpected-end-tag -(1,148): unexpected-end-tag -(1,155): unexpected-end-tag -(1,163): unexpected-end-tag -(1,172): unexpected-end-tag -(1,180): unexpected-end-tag -(1,185): unexpected-end-tag -(1,190): unexpected-end-tag -(1,195): unexpected-end-tag -(1,203): unexpected-end-tag -(1,210): unexpected-end-tag -(1,217): unexpected-end-tag -(1,225): unexpected-end-tag -(1,230): unexpected-end-tag -(1,238): unexpected-end-tag -(1,244): unexpected-end-tag -(1,251): unexpected-end-tag -(1,258): unexpected-end-tag -(1,269): unexpected-end-tag -(1,279): unexpected-end-tag -(1,287): unexpected-end-tag -(1,296): unexpected-end-tag -(1,300): unexpected-end-tag -(1,305): unexpected-end-tag -(1,310): unexpected-end-tag -(1,320): unexpected-end-tag -(1,331): unexpected-end-tag -(1,339): unexpected-end-tag -(1,347): unexpected-end-tag -(1,355): unexpected-end-tag -(1,365): end-tag-too-early -(1,378): end-tag-too-early -(1,387): end-tag-too-early -(1,393): end-tag-too-early -(1,399): end-tag-too-early -(1,404): end-tag-too-early -(1,415): end-tag-too-early -(1,425): end-tag-too-early -(1,432): end-tag-too-early -(1,437): end-tag-too-early -(1,442): end-tag-too-early -(1,447): unexpected-end-tag -(1,454): unexpected-end-tag -(1,460): unexpected-end-tag -(1,467): unexpected-end-tag -(1,476): end-tag-too-early -(1,486): end-tag-too-early -(1,495): end-tag-too-early -(1,513): expected-eof-but-got-end-tag -(1,513): unexpected-end-tag -(1,520): unexpected-end-tag -(1,529): unexpected-end-tag -(1,537): unexpected-end-tag -(1,547): unexpected-end-tag -(1,557): unexpected-end-tag -(1,568): unexpected-end-tag -(1,579): unexpected-end-tag -(1,590): unexpected-end-tag -(1,599): unexpected-end-tag -(1,611): unexpected-end-tag -(1,622): unexpected-end-tag -#document -| -| -| -|
    -|

    - -#data -

    -#errors -(1,7): expected-doctype-but-got-start-tag -(1,20): unexpected-end-tag-implies-table-voodoo -(1,20): unexpected-end-tag -(1,24): unexpected-end-tag-implies-table-voodoo -(1,24): unexpected-end-tag -(1,29): unexpected-end-tag-implies-table-voodoo -(1,29): unexpected-end-tag -(1,33): unexpected-end-tag-implies-table-voodoo -(1,33): unexpected-end-tag -(1,37): unexpected-end-tag-implies-table-voodoo -(1,37): unexpected-end-tag -(1,46): unexpected-end-tag-implies-table-voodoo -(1,46): unexpected-end-tag -(1,50): unexpected-end-tag-implies-table-voodoo -(1,50): unexpected-end-tag -(1,58): unexpected-end-tag-implies-table-voodoo -(1,58): unexpected-end-tag -(1,63): unexpected-end-tag-implies-table-voodoo -(1,63): unexpected-end-tag -(1,69): unexpected-end-tag-implies-table-voodoo -(1,69): end-tag-too-early -(1,75): unexpected-end-tag-implies-table-voodoo -(1,75): unexpected-end-tag -(1,83): unexpected-end-tag-implies-table-voodoo -(1,83): unexpected-end-tag -(1,90): unexpected-end-tag-implies-table-voodoo -(1,90): unexpected-end-tag -(1,99): unexpected-end-tag-implies-table-voodoo -(1,99): unexpected-end-tag -(1,104): unexpected-end-tag-implies-table-voodoo -(1,104): end-tag-too-early -(1,109): unexpected-end-tag-implies-table-voodoo -(1,109): end-tag-too-early -(1,114): unexpected-end-tag-implies-table-voodoo -(1,114): end-tag-too-early -(1,119): unexpected-end-tag-implies-table-voodoo -(1,119): end-tag-too-early -(1,124): unexpected-end-tag-implies-table-voodoo -(1,124): end-tag-too-early -(1,129): unexpected-end-tag-implies-table-voodoo -(1,129): end-tag-too-early -(1,136): unexpected-end-tag-in-table-row -(1,141): unexpected-end-tag-implies-table-voodoo -(1,141): unexpected-end-tag-treated-as -(1,145): unexpected-end-tag-implies-table-voodoo -(1,145): unexpected-end-tag -(1,151): unexpected-end-tag-implies-table-voodoo -(1,151): unexpected-end-tag -(1,159): unexpected-end-tag-implies-table-voodoo -(1,159): unexpected-end-tag -(1,166): unexpected-end-tag-implies-table-voodoo -(1,166): unexpected-end-tag -(1,174): unexpected-end-tag-implies-table-voodoo -(1,174): unexpected-end-tag -(1,183): unexpected-end-tag-implies-table-voodoo -(1,183): unexpected-end-tag -(1,196): unexpected-end-tag -(1,201): unexpected-end-tag -(1,206): unexpected-end-tag -(1,214): unexpected-end-tag -(1,221): unexpected-end-tag -(1,228): unexpected-end-tag -(1,236): unexpected-end-tag -(1,241): unexpected-end-tag -(1,249): unexpected-end-tag -(1,255): unexpected-end-tag -(1,262): unexpected-end-tag -(1,269): unexpected-end-tag -(1,280): unexpected-end-tag -(1,290): unexpected-end-tag -(1,298): unexpected-end-tag -(1,307): unexpected-end-tag -(1,311): unexpected-end-tag -(1,316): unexpected-end-tag -(1,321): unexpected-end-tag -(1,331): unexpected-end-tag -(1,342): unexpected-end-tag -(1,350): unexpected-end-tag -(1,358): unexpected-end-tag -(1,366): unexpected-end-tag -(1,376): end-tag-too-early -(1,389): end-tag-too-early -(1,398): end-tag-too-early -(1,404): end-tag-too-early -(1,410): end-tag-too-early -(1,415): end-tag-too-early -(1,426): end-tag-too-early -(1,436): end-tag-too-early -(1,443): end-tag-too-early -(1,448): end-tag-too-early -(1,453): end-tag-too-early -(1,458): unexpected-end-tag -(1,465): unexpected-end-tag -(1,471): unexpected-end-tag -(1,478): unexpected-end-tag -(1,487): end-tag-too-early -(1,497): end-tag-too-early -(1,506): end-tag-too-early -(1,524): expected-eof-but-got-end-tag -(1,524): unexpected-end-tag -(1,531): unexpected-end-tag -(1,540): unexpected-end-tag -(1,548): unexpected-end-tag -(1,558): unexpected-end-tag -(1,568): unexpected-end-tag -(1,579): unexpected-end-tag -(1,590): unexpected-end-tag -(1,601): unexpected-end-tag -(1,610): unexpected-end-tag -(1,622): unexpected-end-tag -(1,633): unexpected-end-tag -#document -| -| -| -|
    -| -| -| -|

    - -#data - -#errors -(1,10): expected-doctype-but-got-start-tag -(1,10): eof-in-frameset -#document -| -| -| diff --git a/libs/html5lib/tests/testdata/tree-construction/tests10.dat b/libs/html5lib/tests/testdata/tree-construction/tests10.dat deleted file mode 100644 index 3e9a9f19b..000000000 --- a/libs/html5lib/tests/testdata/tree-construction/tests10.dat +++ /dev/null @@ -1,847 +0,0 @@ -#data - -#errors -#document -| -| -| -| -| - -#data -a -#errors -(1,28) expected-dashes-or-doctype -#document -| -| -| -| -| -| - -#data - -#errors -#document -| -| -| -| -| - -#data - -#errors -(1,34) unexpected-start-tag-in-select -(1,40) unexpected-end-tag-in-select -#document -| -| -| -| -| -#errors -(1,42) unexpected-start-tag-in-select -(1,48) unexpected-end-tag-in-select -#document -| -| -| -| -|

    -#errors -(1,33) foster-parenting-start-tag -#document -| -| -| -| -| -| - -#data -
    foo
    -#errors -(1,33) foster-parenting-start-tag -#document -| -| -| -| -| -| -| "foo" -| - -#data -
    foobar
    -#errors -(1,33) foster-parenting-start-tag -#document -| -| -| -| -| -| -| "foo" -| -| "bar" -| - -#data -
    foobar
    -#errors -(1,40) foster-parenting-start-tag -#document -| -| -| -| -| -| -| "foo" -| -| "bar" -| -| - -#data -
    foobar
    -#errors -(1,44) foster-parenting-start-tag -#document -| -| -| -| -| -| -| "foo" -| -| "bar" -| -| -| - -#data -
    foobar
    -#errors -#document -| -| -| -| -| -| -| -|
    -| -| -| "foo" -| -| "bar" - -#data -
    foobar

    baz

    -#errors -#document -| -| -| -| -| -| -| -|
    -| -| -| "foo" -| -| "bar" -|

    -| "baz" - -#data -
    foobar

    baz

    -#errors -#document -| -| -| -| -| -|
    -| -| -| "foo" -| -| "bar" -|

    -| "baz" - -#data -
    foobar

    baz

    quux -#errors -(1,65) unexpected-html-element-in-foreign-content -#document -| -| -| -| -| -|
    -| -| -| "foo" -| -| "bar" -|

    -| "baz" -|

    -| "quux" - -#data -
    foobarbaz

    quux -#errors -(1,73) unexpected-end-tag -(1,73) expected-one-end-tag-but-got-another -#document -| -| -| -| -| -|
    -| -| -| "foo" -| -| "bar" -| "baz" -|

    -| "quux" - -#data -foobar

    baz

    quux -#errors -(1,43) foster-parenting-start-tag svg -(1,66) unexpected HTML-like start tag token in foreign content -(1,66) foster-parenting-start-tag -(1,67) foster-parenting-character -(1,68) foster-parenting-character -(1,69) foster-parenting-character -#document -| -| -| -| -| -| -| "foo" -| -| "bar" -|

    -| "baz" -| -| -|

    -| "quux" - -#data -

    quux -#errors -(1,49) unexpected-start-tag-in-select -(1,52) unexpected-start-tag-in-select -(1,59) unexpected-end-tag-in-select -(1,62) unexpected-start-tag-in-select -(1,69) unexpected-end-tag-in-select -(1,72) unexpected-start-tag-in-select -(1,83) unexpected-table-element-end-tag-in-select-in-table -#document -| -| -| -| -| -| -| -|
    -|

    quux -#errors -(1,36) unexpected-start-tag-implies-table-voodoo -(1,41) unexpected-start-tag-in-select -(1,44) unexpected-start-tag-in-select -(1,51) unexpected-end-tag-in-select -(1,54) unexpected-start-tag-in-select -(1,61) unexpected-end-tag-in-select -(1,64) unexpected-start-tag-in-select -(1,75) unexpected-table-element-end-tag-in-select-in-table -#document -| -| -| -| -| -|

    -| "quux" - -#data -foobar

    baz -#errors -(1,40) expected-eof-but-got-start-tag -(1,63) unexpected-html-element-in-foreign-content -#document -| -| -| -| -| -| -| "foo" -| -| "bar" -|

    -| "baz" - -#data -foobar

    baz -#errors -(1,33) unexpected-start-tag-after-body -(1,56) unexpected-html-element-in-foreign-content -#document -| -| -| -| -| -| -| "foo" -| -| "bar" -|

    -| "baz" - -#data -

    -#errors -(1,30) unexpected-start-tag-in-frameset -(1,33) unexpected-start-tag-in-frameset -(1,37) unexpected-end-tag-in-frameset -(1,40) unexpected-start-tag-in-frameset -(1,44) unexpected-end-tag-in-frameset -(1,47) unexpected-start-tag-in-frameset -(1,53) unexpected-start-tag-in-frameset -(1,53) eof-in-frameset -#document -| -| -| -| - -#data -

    -#errors -(1,41) unexpected-start-tag-after-frameset -(1,44) unexpected-start-tag-after-frameset -(1,48) unexpected-end-tag-after-frameset -(1,51) unexpected-start-tag-after-frameset -(1,55) unexpected-end-tag-after-frameset -(1,58) unexpected-start-tag-after-frameset -(1,64) unexpected-start-tag-after-frameset -#document -| -| -| -| - -#data - -#errors -#document -| -| -| -| -| xlink:href="foo" -| -| xlink href="foo" - -#data - -#errors -#document -| -| -| -| -| xlink:href="foo" -| xml:lang="en" -| -| -| xlink href="foo" -| xml lang="en" - -#data - -#errors -#document -| -| -| -| -| xlink:href="foo" -| xml:lang="en" -| -| -| xlink href="foo" -| xml lang="en" - -#data -bar -#errors -#document -| -| -| -| -| xlink:href="foo" -| xml:lang="en" -| -| -| xlink href="foo" -| xml lang="en" -| "bar" - -#data - -#errors -(1,5) expected-doctype-but-got-start-tag -(1,12) unexpected-end-tag -(1,12) unexpected-end-tag -(1,12) expected-closing-tag-but-got-eof -#document -| -| -| -| - -#data -

    a -#errors -(1,5) expected-doctype-but-got-start-tag -(1,16) unexpected-end-tag -(1,16) end-tag-too-early -#document -| -| -| -|
    -| -| "a" - -#data -
    a -#errors -(1,5) expected-doctype-but-got-start-tag -(1,22) unexpected-end-tag -(1,22) end-tag-too-early -#document -| -| -| -|
    -| -| -| "a" - -#data -
    -#errors -(1,5) expected-doctype-but-got-start-tag -(1,22) unexpected-end-tag -(1,28) expected-closing-tag-but-got-eof -#document -| -| -| -|
    -| -| -| - -#data -
    a -#errors -(1,5) expected-doctype-but-got-start-tag -(1,43) unexpected-end-tag -(1,43) end-tag-too-early -(1,44) expected-closing-tag-but-got-eof -#document -| -| -| -|
    -| -| -| -| -| "a" - -#data -

    a -#errors -(1,5) expected-doctype-but-got-start-tag -(1,40) end-tag-too-early -(1,41) expected-closing-tag-but-got-eof -#document -| -| -| -|

    -| -| -| -|

    -| "a" - -#data -
      a -#errors -(1,40) unexpected-html-element-in-foreign-content -(1,41) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| -|
      -| -|
        -| "a" - -#data -
          a -#errors -(1,35) unexpected-html-element-in-foreign-content -(1,36) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| -| -|
            -| "a" - -#data -

            -#errors -(1,32) expected-closing-tag-but-got-eof -#document -| -| -| -| -|

            -| -| -|

            - -#data -

            -#errors -(1,33) expected-closing-tag-but-got-eof -#document -| -| -| -| -|

            -| -| -|

            - -#data -

            -#errors -(1,5) expected-doctype-but-got-start-tag -(1,50) unexpected-end-tag -(1,53) expected-closing-tag-but-got-eof -#document -| -| -| -|

            -| -| -| -|

            -|

            - -#data -
            -#errors -(1,6) expected-doctype-but-got-start-tag -(1,71) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -|
            -| -|
            -| -| - -#data -
            -#errors -(1,6) expected-doctype-but-got-start-tag -(1,83) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| -| -|
            -|
            -| - -#data - -#errors -(1,5) expected-doctype-but-got-start-tag -(1,28) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data -

    -#errors -(1,7) expected-doctype-but-got-start-tag -(1,12) unexpected-start-tag-implies-table-voodoo -(1,22) eof-in-table -#document -| -| -| -| -|
    -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,18) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,22) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,18) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,22) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,18) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,22) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,18) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,22) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,21) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,25) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,54) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| -| - -#data -
    -#errors -(1,6) expected-doctype-but-got-start-tag -(1,144) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| -| -|
    -| -| -| -| -| - -#data - -#errors -(1,6) expected-doctype-but-got-start-tag -(1,153) expected-closing-tag-but-got-eof -#document -| -| -| -| -| -| -| -| -| -| -| -| -| -| diff --git a/libs/html5lib/tests/testdata/tree-construction/tests11.dat b/libs/html5lib/tests/testdata/tree-construction/tests11.dat deleted file mode 100644 index b9901e79e..000000000 --- a/libs/html5lib/tests/testdata/tree-construction/tests11.dat +++ /dev/null @@ -1,523 +0,0 @@ -#data - -#errors -#document -| -| -| -| -| -| attributeName="" -| attributeType="" -| baseFrequency="" -| baseProfile="" -| calcMode="" -| clipPathUnits="" -| diffuseConstant="" -| edgeMode="" -| filterUnits="" -| glyphRef="" -| gradientTransform="" -| gradientUnits="" -| kernelMatrix="" -| kernelUnitLength="" -| keyPoints="" -| keySplines="" -| keyTimes="" -| lengthAdjust="" -| limitingConeAngle="" -| markerHeight="" -| markerUnits="" -| markerWidth="" -| maskContentUnits="" -| maskUnits="" -| numOctaves="" -| pathLength="" -| patternContentUnits="" -| patternTransform="" -| patternUnits="" -| pointsAtX="" -| pointsAtY="" -| pointsAtZ="" -| preserveAlpha="" -| preserveAspectRatio="" -| primitiveUnits="" -| refX="" -| refY="" -| repeatCount="" -| repeatDur="" -| requiredExtensions="" -| requiredFeatures="" -| specularConstant="" -| specularExponent="" -| spreadMethod="" -| startOffset="" -| stdDeviation="" -| stitchTiles="" -| surfaceScale="" -| systemLanguage="" -| tableValues="" -| targetX="" -| targetY="" -| textLength="" -| viewBox="" -| viewTarget="" -| xChannelSelector="" -| yChannelSelector="" -| zoomAndPan="" - -#data - -#errors -#document -| -| -| -| -| -| attributeName="" -| attributeType="" -| baseFrequency="" -| baseProfile="" -| calcMode="" -| clipPathUnits="" -| diffuseConstant="" -| edgeMode="" -| filterUnits="" -| glyphRef="" -| gradientTransform="" -| gradientUnits="" -| kernelMatrix="" -| kernelUnitLength="" -| keyPoints="" -| keySplines="" -| keyTimes="" -| lengthAdjust="" -| limitingConeAngle="" -| markerHeight="" -| markerUnits="" -| markerWidth="" -| maskContentUnits="" -| maskUnits="" -| numOctaves="" -| pathLength="" -| patternContentUnits="" -| patternTransform="" -| patternUnits="" -| pointsAtX="" -| pointsAtY="" -| pointsAtZ="" -| preserveAlpha="" -| preserveAspectRatio="" -| primitiveUnits="" -| refX="" -| refY="" -| repeatCount="" -| repeatDur="" -| requiredExtensions="" -| requiredFeatures="" -| specularConstant="" -| specularExponent="" -| spreadMethod="" -| startOffset="" -| stdDeviation="" -| stitchTiles="" -| surfaceScale="" -| systemLanguage="" -| tableValues="" -| targetX="" -| targetY="" -| textLength="" -| viewBox="" -| viewTarget="" -| xChannelSelector="" -| yChannelSelector="" -| zoomAndPan="" - -#data - -#errors -#document -| -| -| -| -| -| attributeName="" -| attributeType="" -| baseFrequency="" -| baseProfile="" -| calcMode="" -| clipPathUnits="" -| diffuseConstant="" -| edgeMode="" -| filterUnits="" -| filterres="" -| glyphRef="" -| gradientTransform="" -| gradientUnits="" -| kernelMatrix="" -| kernelUnitLength="" -| keyPoints="" -| keySplines="" -| keyTimes="" -| lengthAdjust="" -| limitingConeAngle="" -| markerHeight="" -| markerUnits="" -| markerWidth="" -| maskContentUnits="" -| maskUnits="" -| numOctaves="" -| pathLength="" -| patternContentUnits="" -| patternTransform="" -| patternUnits="" -| pointsAtX="" -| pointsAtY="" -| pointsAtZ="" -| preserveAlpha="" -| preserveAspectRatio="" -| primitiveUnits="" -| refX="" -| refY="" -| repeatCount="" -| repeatDur="" -| requiredExtensions="" -| requiredFeatures="" -| specularConstant="" -| specularExponent="" -| spreadMethod="" -| startOffset="" -| stdDeviation="" -| stitchTiles="" -| surfaceScale="" -| systemLanguage="" -| tableValues="" -| targetX="" -| targetY="" -| textLength="" -| viewBox="" -| viewTarget="" -| xChannelSelector="" -| yChannelSelector="" -| zoomAndPan="" - -#data - -#errors -#document -| -| -| -| -| -| attributename="" -| attributetype="" -| basefrequency="" -| baseprofile="" -| calcmode="" -| clippathunits="" -| diffuseconstant="" -| edgemode="" -| filterunits="" -| glyphref="" -| gradienttransform="" -| gradientunits="" -| kernelmatrix="" -| kernelunitlength="" -| keypoints="" -| keysplines="" -| keytimes="" -| lengthadjust="" -| limitingconeangle="" -| markerheight="" -| markerunits="" -| markerwidth="" -| maskcontentunits="" -| maskunits="" -| numoctaves="" -| pathlength="" -| patterncontentunits="" -| patterntransform="" -| patternunits="" -| pointsatx="" -| pointsaty="" -| pointsatz="" -| preservealpha="" -| preserveaspectratio="" -| primitiveunits="" -| refx="" -| refy="" -| repeatcount="" -| repeatdur="" -| requiredextensions="" -| requiredfeatures="" -| specularconstant="" -| specularexponent="" -| spreadmethod="" -| startoffset="" -| stddeviation="" -| stitchtiles="" -| surfacescale="" -| systemlanguage="" -| tablevalues="" -| targetx="" -| targety="" -| textlength="" -| viewbox="" -| viewtarget="" -| xchannelselector="" -| ychannelselector="" -| zoomandpan="" - -#data - -#errors -#document -| -| -| -| -| -| contentscripttype="" -| contentstyletype="" -| externalresourcesrequired="" -| filterres="" - -#data - -#errors -#document -| -| -| -| -| -| contentscripttype="" -| contentstyletype="" -| externalresourcesrequired="" -| filterres="" - -#data - -#errors -#document -| -| -| -| -| -| contentscripttype="" -| contentstyletype="" -| externalresourcesrequired="" -| filterres="" - -#data - -#errors -#document -| -| -| -| -| -| contentscripttype="" -| contentstyletype="" -| externalresourcesrequired="" -| filterres="" - -#data - -#errors -#document -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| - -#data - -#errors -#document -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| - -#data - -#errors -#document -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| - -#data - -#errors -#document -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| -| - -#data - -#errors -#document -| -| -| -| -| -| diff --git a/libs/html5lib/tests/testdata/tree-construction/tests12.dat b/libs/html5lib/tests/testdata/tree-construction/tests12.dat deleted file mode 100644 index 63107d277..000000000 --- a/libs/html5lib/tests/testdata/tree-construction/tests12.dat +++ /dev/null @@ -1,62 +0,0 @@ -#data -

    foobazeggs

    spam

    quuxbar -#errors -#document -| -| -| -| -|

    -| "foo" -| -| -| -| "baz" -| -| -| -| -| "eggs" -| -| -|

    -| "spam" -| -| -| -|
    -| -| -| "quux" -| "bar" - -#data -foobazeggs

    spam
    quuxbar -#errors -#document -| -| -| -| -| "foo" -| -| -| -| "baz" -| -| -| -| -| "eggs" -| -| -|

    -| "spam" -| -| -| -|
    -| -| -| "quux" -| "bar" diff --git a/libs/html5lib/tests/testdata/tree-construction/tests14.dat b/libs/html5lib/tests/testdata/tree-construction/tests14.dat deleted file mode 100644 index a08b7649e..000000000 --- a/libs/html5lib/tests/testdata/tree-construction/tests14.dat +++ /dev/null @@ -1,75 +0,0 @@ -#data - -#errors -#document -| -| -| -| -| - -#data - -#errors -#document -| -| -| -| -| -| - -#data - -#errors -(1,38): non-html-root -#document -| -| -| abc:def="gh" -| -| -| - -#data - -#errors -(1,53): non-html-root -#document -| -| -| xml:lang="bar" -| -| - -#data - -#errors -#document -| -| -| 123="456" -| -| - -#data - -#errors -(1,43): non-html-root -#document -| -| -| 123="456" -| 789="012" -| -| - -#data - -#errors -#document -| -| -| -| -| 789="012" diff --git a/libs/html5lib/tests/testdata/tree-construction/tests15.dat b/libs/html5lib/tests/testdata/tree-construction/tests15.dat deleted file mode 100644 index 93d06a871..000000000 --- a/libs/html5lib/tests/testdata/tree-construction/tests15.dat +++ /dev/null @@ -1,216 +0,0 @@ -#data -

    X -#errors -(1,31): unexpected-end-tag -(1,36): expected-closing-tag-but-got-eof -#document -| -| -| -| -|

    -| -| -| -| -| -| -| " " -|

    -| "X" - -#data -

    -

    X -#errors -(1,3): expected-doctype-but-got-start-tag -(1,16): unexpected-end-tag -(2,4): expected-closing-tag-but-got-eof -#document -| -| -| -|

    -| -| -| -| -| -| -| " -" -|

    -| "X" - -#data - -#errors -(1,29): expected-eof-but-got-start-tag -(1,29): unexpected-start-tag-ignored -#document -| -| -| -| -| " " - -#data - -#errors -(1,28): unexpected-start-tag-after-body -#document -| -| -| -| -| - -#data - -#errors -(1,6): expected-doctype-but-got-start-tag -#document -| -| -| -| - -#data -X -#errors -(1,29): unexpected-start-tag-after-body -#document -| -| -| -| -| -| "X" - -#data -<!doctype html><table> X<meta></table> -#errors -(1,23): foster-parenting-character -(1,24): foster-parenting-character -(1,30): foster-parenting-start-character -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| " X" -| <meta> -| <table> - -#data -<!doctype html><table> x</table> -#errors -(1,23): foster-parenting-character -(1,24): foster-parenting-character -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| " x" -| <table> - -#data -<!doctype html><table> x </table> -#errors -(1,23): foster-parenting-character -(1,24): foster-parenting-character -(1,25): foster-parenting-character -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| " x " -| <table> - -#data -<!doctype html><table><tr> x</table> -#errors -(1,27): foster-parenting-character -(1,28): foster-parenting-character -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| " x" -| <table> -| <tbody> -| <tr> - -#data -<!doctype html><table>X<style> <tr>x </style> </table> -#errors -(1,23): foster-parenting-character -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| "X" -| <table> -| <style> -| " <tr>x " -| " " - -#data -<!doctype html><div><table><a>foo</a> <tr><td>bar</td> </tr></table></div> -#errors -(1,30): foster-parenting-start-tag -(1,31): foster-parenting-character -(1,32): foster-parenting-character -(1,33): foster-parenting-character -(1,37): foster-parenting-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <div> -| <a> -| "foo" -| <table> -| " " -| <tbody> -| <tr> -| <td> -| "bar" -| " " - -#data -<frame></frame></frame><frameset><frame><frameset><frame></frameset><noframes></frameset><noframes> -#errors -(1,7): expected-doctype-but-got-start-tag -(1,7): unexpected-start-tag-ignored -(1,15): unexpected-end-tag -(1,23): unexpected-end-tag -(1,33): unexpected-start-tag -(1,99): expected-named-closing-tag-but-got-eof -(1,99): eof-in-frameset -#document -| <html> -| <head> -| <frameset> -| <frame> -| <frameset> -| <frame> -| <noframes> -| "</frameset><noframes>" - -#data -<!DOCTYPE html><object></html> -#errors -(1,30): expected-body-in-scope -(1,30): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <object> diff --git a/libs/html5lib/tests/testdata/tree-construction/tests16.dat b/libs/html5lib/tests/testdata/tree-construction/tests16.dat deleted file mode 100644 index 8d9631fa9..000000000 --- a/libs/html5lib/tests/testdata/tree-construction/tests16.dat +++ /dev/null @@ -1,2460 +0,0 @@ -#data -<!doctype html><script> -#errors -(1,23): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| <body> - -#data -<!doctype html><script>a -#errors -(1,24): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "a" -| <body> - -#data -<!doctype html><script>< -#errors -(1,24): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<" -| <body> - -#data -<!doctype html><script></ -#errors -(1,25): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</" -| <body> - -#data -<!doctype html><script></S -#errors -(1,26): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</S" -| <body> - -#data -<!doctype html><script></SC -#errors -(1,27): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</SC" -| <body> - -#data -<!doctype html><script></SCR -#errors -(1,28): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</SCR" -| <body> - -#data -<!doctype html><script></SCRI -#errors -(1,29): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</SCRI" -| <body> - -#data -<!doctype html><script></SCRIP -#errors -(1,30): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</SCRIP" -| <body> - -#data -<!doctype html><script></SCRIPT -#errors -(1,31): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</SCRIPT" -| <body> - -#data -<!doctype html><script></SCRIPT -#errors -(1,32): expected-attribute-name-but-got-eof -(1,32): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| <body> - -#data -<!doctype html><script></s -#errors -(1,26): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</s" -| <body> - -#data -<!doctype html><script></sc -#errors -(1,27): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</sc" -| <body> - -#data -<!doctype html><script></scr -#errors -(1,28): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</scr" -| <body> - -#data -<!doctype html><script></scri -#errors -(1,29): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</scri" -| <body> - -#data -<!doctype html><script></scrip -#errors -(1,30): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</scrip" -| <body> - -#data -<!doctype html><script></script -#errors -(1,31): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "</script" -| <body> - -#data -<!doctype html><script></script -#errors -(1,32): expected-attribute-name-but-got-eof -(1,32): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| <body> - -#data -<!doctype html><script><! -#errors -(1,25): expected-script-data-but-got-eof -(1,25): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!" -| <body> - -#data -<!doctype html><script><!a -#errors -(1,26): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!a" -| <body> - -#data -<!doctype html><script><!- -#errors -(1,26): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!-" -| <body> - -#data -<!doctype html><script><!-a -#errors -(1,27): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!-a" -| <body> - -#data -<!doctype html><script><!-- -#errors -(1,27): expected-named-closing-tag-but-got-eof -(1,27): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--" -| <body> - -#data -<!doctype html><script><!--a -#errors -(1,28): expected-named-closing-tag-but-got-eof -(1,28): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--a" -| <body> - -#data -<!doctype html><script><!--< -#errors -(1,28): expected-named-closing-tag-but-got-eof -(1,28): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<" -| <body> - -#data -<!doctype html><script><!--<a -#errors -(1,29): expected-named-closing-tag-but-got-eof -(1,29): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<a" -| <body> - -#data -<!doctype html><script><!--</ -#errors -(1,29): expected-named-closing-tag-but-got-eof -(1,29): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--</" -| <body> - -#data -<!doctype html><script><!--</script -#errors -(1,35): expected-named-closing-tag-but-got-eof -(1,35): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--</script" -| <body> - -#data -<!doctype html><script><!--</script -#errors -(1,36): expected-attribute-name-but-got-eof -(1,36): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--" -| <body> - -#data -<!doctype html><script><!--<s -#errors -(1,29): expected-named-closing-tag-but-got-eof -(1,29): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<s" -| <body> - -#data -<!doctype html><script><!--<script -#errors -(1,34): expected-named-closing-tag-but-got-eof -(1,34): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script" -| <body> - -#data -<!doctype html><script><!--<script -#errors -(1,35): eof-in-script-in-script -(1,35): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script " -| <body> - -#data -<!doctype html><script><!--<script < -#errors -(1,36): eof-in-script-in-script -(1,36): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script <" -| <body> - -#data -<!doctype html><script><!--<script <a -#errors -(1,37): eof-in-script-in-script -(1,37): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script <a" -| <body> - -#data -<!doctype html><script><!--<script </ -#errors -(1,37): eof-in-script-in-script -(1,37): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </" -| <body> - -#data -<!doctype html><script><!--<script </s -#errors -(1,38): eof-in-script-in-script -(1,38): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </s" -| <body> - -#data -<!doctype html><script><!--<script </script -#errors -(1,43): eof-in-script-in-script -(1,43): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script" -| <body> - -#data -<!doctype html><script><!--<script </scripta -#errors -(1,44): eof-in-script-in-script -(1,44): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </scripta" -| <body> - -#data -<!doctype html><script><!--<script </script -#errors -(1,44): expected-named-closing-tag-but-got-eof -(1,44): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script " -| <body> - -#data -<!doctype html><script><!--<script </script> -#errors -(1,44): expected-named-closing-tag-but-got-eof -(1,44): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script>" -| <body> - -#data -<!doctype html><script><!--<script </script/ -#errors -(1,44): expected-named-closing-tag-but-got-eof -(1,44): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script/" -| <body> - -#data -<!doctype html><script><!--<script </script < -#errors -(1,45): expected-named-closing-tag-but-got-eof -(1,45): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script <" -| <body> - -#data -<!doctype html><script><!--<script </script <a -#errors -(1,46): expected-named-closing-tag-but-got-eof -(1,46): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script <a" -| <body> - -#data -<!doctype html><script><!--<script </script </ -#errors -(1,46): expected-named-closing-tag-but-got-eof -(1,46): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script </" -| <body> - -#data -<!doctype html><script><!--<script </script </script -#errors -(1,52): expected-named-closing-tag-but-got-eof -(1,52): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script </script" -| <body> - -#data -<!doctype html><script><!--<script </script </script -#errors -(1,53): expected-attribute-name-but-got-eof -(1,53): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script " -| <body> - -#data -<!doctype html><script><!--<script </script </script/ -#errors -(1,53): unexpected-EOF-after-solidus-in-tag -(1,53): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script " -| <body> - -#data -<!doctype html><script><!--<script </script </script> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script </script " -| <body> - -#data -<!doctype html><script><!--<script - -#errors -(1,36): eof-in-script-in-script -(1,36): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script -" -| <body> - -#data -<!doctype html><script><!--<script -a -#errors -(1,37): eof-in-script-in-script -(1,37): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script -a" -| <body> - -#data -<!doctype html><script><!--<script -< -#errors -(1,37): eof-in-script-in-script -(1,37): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script -<" -| <body> - -#data -<!doctype html><script><!--<script -- -#errors -(1,37): eof-in-script-in-script -(1,37): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script --" -| <body> - -#data -<!doctype html><script><!--<script --a -#errors -(1,38): eof-in-script-in-script -(1,38): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script --a" -| <body> - -#data -<!doctype html><script><!--<script --< -#errors -(1,38): eof-in-script-in-script -(1,38): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script --<" -| <body> - -#data -<!doctype html><script><!--<script --> -#errors -(1,38): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script -->" -| <body> - -#data -<!doctype html><script><!--<script -->< -#errors -(1,39): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script --><" -| <body> - -#data -<!doctype html><script><!--<script --></ -#errors -(1,40): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script --></" -| <body> - -#data -<!doctype html><script><!--<script --></script -#errors -(1,46): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script --></script" -| <body> - -#data -<!doctype html><script><!--<script --></script -#errors -(1,47): expected-attribute-name-but-got-eof -(1,47): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script -->" -| <body> - -#data -<!doctype html><script><!--<script --></script/ -#errors -(1,47): unexpected-EOF-after-solidus-in-tag -(1,47): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script -->" -| <body> - -#data -<!doctype html><script><!--<script --></script> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script -->" -| <body> - -#data -<!doctype html><script><!--<script><\/script>--></script> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script><\/script>-->" -| <body> - -#data -<!doctype html><script><!--<script></scr'+'ipt>--></script> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script></scr'+'ipt>-->" -| <body> - -#data -<!doctype html><script><!--<script></script><script></script></script> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>" -| <body> - -#data -<!doctype html><script><!--<script></script><script></script>--><!--</script> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>--><!--" -| <body> - -#data -<!doctype html><script><!--<script></script><script></script>-- ></script> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>-- >" -| <body> - -#data -<!doctype html><script><!--<script></script><script></script>- -></script> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>- ->" -| <body> - -#data -<!doctype html><script><!--<script></script><script></script>- - ></script> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>- - >" -| <body> - -#data -<!doctype html><script><!--<script></script><script></script>-></script> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>->" -| <body> - -#data -<!doctype html><script><!--<script>--!></script>X -#errors -(1,49): expected-named-closing-tag-but-got-eof -(1,49): unexpected-EOF-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script>--!></script>X" -| <body> - -#data -<!doctype html><script><!--<scr'+'ipt></script>--></script> -#errors -(1,59): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<scr'+'ipt>" -| <body> -| "-->" - -#data -<!doctype html><script><!--<script></scr'+'ipt></script>X -#errors -(1,57): expected-named-closing-tag-but-got-eof -(1,57): unexpected-eof-in-text-mode -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| "<!--<script></scr'+'ipt></script>X" -| <body> - -#data -<!doctype html><style><!--<style></style>--></style> -#errors -(1,52): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <style> -| "<!--<style>" -| <body> -| "-->" - -#data -<!doctype html><style><!--</style>X -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <style> -| "<!--" -| <body> -| "X" - -#data -<!doctype html><style><!--...</style>...--></style> -#errors -(1,51): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <style> -| "<!--..." -| <body> -| "...-->" - -#data -<!doctype html><style><!--<br><html xmlns:v="urn:schemas-microsoft-com:vml"><!--[if !mso]><style></style>X -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <style> -| "<!--<br><html xmlns:v="urn:schemas-microsoft-com:vml"><!--[if !mso]><style>" -| <body> -| "X" - -#data -<!doctype html><style><!--...<style><!--...--!></style>--></style> -#errors -(1,66): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <style> -| "<!--...<style><!--...--!>" -| <body> -| "-->" - -#data -<!doctype html><style><!--...</style><!-- --><style>@import ...</style> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <style> -| "<!--..." -| <!-- --> -| <style> -| "@import ..." -| <body> - -#data -<!doctype html><style>...<style><!--...</style><!-- --></style> -#errors -(1,63): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <style> -| "...<style><!--..." -| <!-- --> -| <body> - -#data -<!doctype html><style>...<!--[if IE]><style>...</style>X -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <style> -| "...<!--[if IE]><style>..." -| <body> -| "X" - -#data -<!doctype html><title><!--<title>--> -#errors -(1,52): unexpected-end-tag -#document -| -| -| -| -| "<!--<title>" -| <body> -| "-->" - -#data -<!doctype html><title></title> -#errors -#document -| -| -| -| -| "" -| - -#data -foo/title><link></head><body>X -#errors -(1,52): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <title> -| "foo/title><link></head><body>X" -| <body> - -#data -<!doctype html><noscript><!--<noscript></noscript>--></noscript> -#errors -(1,64): unexpected-end-tag -#script-on -#document -| <!DOCTYPE html> -| <html> -| <head> -| <noscript> -| "<!--<noscript>" -| <body> -| "-->" - -#data -<!doctype html><noscript><!--<noscript></noscript>--></noscript> -#errors -#script-off -#document -| <!DOCTYPE html> -| <html> -| <head> -| <noscript> -| <!-- <noscript></noscript> --> -| <body> - -#data -<!doctype html><noscript><!--</noscript>X<noscript>--></noscript> -#errors -#script-on -#document -| <!DOCTYPE html> -| <html> -| <head> -| <noscript> -| "<!--" -| <body> -| "X" -| <noscript> -| "-->" - -#data -<!doctype html><noscript><!--</noscript>X<noscript>--></noscript> -#errors -#script-off -#document -| <!DOCTYPE html> -| <html> -| <head> -| <noscript> -| <!-- </noscript>X<noscript> --> -| <body> - -#data -<!doctype html><noscript><iframe></noscript>X -#errors -#script-on -#document -| <!DOCTYPE html> -| <html> -| <head> -| <noscript> -| "<iframe>" -| <body> -| "X" - -#data -<!doctype html><noscript><iframe></noscript>X -#errors - * (1,34) unexpected token in head noscript - * (1,46) unexpected EOF -#script-off -#document -| <!DOCTYPE html> -| <html> -| <head> -| <noscript> -| <body> -| <iframe> -| "</noscript>X" - -#data -<!doctype html><noframes><!--<noframes></noframes>--></noframes> -#errors -(1,64): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <noframes> -| "<!--<noframes>" -| <body> -| "-->" - -#data -<!doctype html><noframes><body><script><!--...</script></body></noframes></html> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <noframes> -| "<body><script><!--...</script></body>" -| <body> - -#data -<!doctype html><textarea><!--<textarea></textarea>--></textarea> -#errors -(1,64): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <textarea> -| "<!--<textarea>" -| "-->" - -#data -<!doctype html><textarea></textarea></textarea> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <textarea> -| "</textarea>" - -#data -<!doctype html><textarea><</textarea> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <textarea> -| "<" - -#data -<!doctype html><textarea>a<b</textarea> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <textarea> -| "a<b" - -#data -<!doctype html><iframe><!--<iframe></iframe>--></iframe> -#errors -(1,56): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <iframe> -| "<!--<iframe>" -| "-->" - -#data -<!doctype html><iframe>...<!--X->...<!--/X->...</iframe> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <iframe> -| "...<!--X->...<!--/X->..." - -#data -<!doctype html><xmp><!--<xmp></xmp>--></xmp> -#errors -(1,44): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <xmp> -| "<!--<xmp>" -| "-->" - -#data -<!doctype html><noembed><!--<noembed></noembed>--></noembed> -#errors -(1,60): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <noembed> -| "<!--<noembed>" -| "-->" - -#data -<script> -#errors -(1,8): expected-doctype-but-got-start-tag -(1,8): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| <body> - -#data -<script>a -#errors -(1,8): expected-doctype-but-got-start-tag -(1,9): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "a" -| <body> - -#data -<script>< -#errors -(1,8): expected-doctype-but-got-start-tag -(1,9): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<" -| <body> - -#data -<script></ -#errors -(1,8): expected-doctype-but-got-start-tag -(1,10): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</" -| <body> - -#data -<script></S -#errors -(1,8): expected-doctype-but-got-start-tag -(1,11): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</S" -| <body> - -#data -<script></SC -#errors -(1,8): expected-doctype-but-got-start-tag -(1,12): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</SC" -| <body> - -#data -<script></SCR -#errors -(1,8): expected-doctype-but-got-start-tag -(1,13): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</SCR" -| <body> - -#data -<script></SCRI -#errors -(1,8): expected-doctype-but-got-start-tag -(1,14): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</SCRI" -| <body> - -#data -<script></SCRIP -#errors -(1,8): expected-doctype-but-got-start-tag -(1,15): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</SCRIP" -| <body> - -#data -<script></SCRIPT -#errors -(1,8): expected-doctype-but-got-start-tag -(1,16): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</SCRIPT" -| <body> - -#data -<script></SCRIPT -#errors -(1,8): expected-doctype-but-got-start-tag -(1,17): expected-attribute-name-but-got-eof -(1,17): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| <body> - -#data -<script></s -#errors -(1,8): expected-doctype-but-got-start-tag -(1,11): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</s" -| <body> - -#data -<script></sc -#errors -(1,8): expected-doctype-but-got-start-tag -(1,12): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</sc" -| <body> - -#data -<script></scr -#errors -(1,8): expected-doctype-but-got-start-tag -(1,13): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</scr" -| <body> - -#data -<script></scri -#errors -(1,8): expected-doctype-but-got-start-tag -(1,14): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</scri" -| <body> - -#data -<script></scrip -#errors -(1,8): expected-doctype-but-got-start-tag -(1,15): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</scrip" -| <body> - -#data -<script></script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,16): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</script" -| <body> - -#data -<script></script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,17): expected-attribute-name-but-got-eof -(1,17): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| <body> - -#data -<script><! -#errors -(1,8): expected-doctype-but-got-start-tag -(1,10): expected-script-data-but-got-eof -(1,10): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!" -| <body> - -#data -<script><!a -#errors -(1,8): expected-doctype-but-got-start-tag -(1,11): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!a" -| <body> - -#data -<script><!- -#errors -(1,8): expected-doctype-but-got-start-tag -(1,11): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!-" -| <body> - -#data -<script><!-a -#errors -(1,8): expected-doctype-but-got-start-tag -(1,12): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!-a" -| <body> - -#data -<script><!-- -#errors -(1,8): expected-doctype-but-got-start-tag -(1,12): expected-named-closing-tag-but-got-eof -(1,12): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--" -| <body> - -#data -<script><!--a -#errors -(1,8): expected-doctype-but-got-start-tag -(1,13): expected-named-closing-tag-but-got-eof -(1,13): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--a" -| <body> - -#data -<script><!--< -#errors -(1,8): expected-doctype-but-got-start-tag -(1,13): expected-named-closing-tag-but-got-eof -(1,13): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<" -| <body> - -#data -<script><!--<a -#errors -(1,8): expected-doctype-but-got-start-tag -(1,14): expected-named-closing-tag-but-got-eof -(1,14): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<a" -| <body> - -#data -<script><!--</ -#errors -(1,8): expected-doctype-but-got-start-tag -(1,14): expected-named-closing-tag-but-got-eof -(1,14): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--</" -| <body> - -#data -<script><!--</script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,20): expected-named-closing-tag-but-got-eof -(1,20): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--</script" -| <body> - -#data -<script><!--</script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,21): expected-attribute-name-but-got-eof -(1,21): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--" -| <body> - -#data -<script><!--<s -#errors -(1,8): expected-doctype-but-got-start-tag -(1,14): expected-named-closing-tag-but-got-eof -(1,14): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<s" -| <body> - -#data -<script><!--<script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,19): expected-named-closing-tag-but-got-eof -(1,19): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<script" -| <body> - -#data -<script><!--<script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,20): eof-in-script-in-script -(1,20): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script " -| <body> - -#data -<script><!--<script < -#errors -(1,8): expected-doctype-but-got-start-tag -(1,21): eof-in-script-in-script -(1,21): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script <" -| <body> - -#data -<script><!--<script <a -#errors -(1,8): expected-doctype-but-got-start-tag -(1,22): eof-in-script-in-script -(1,22): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script <a" -| <body> - -#data -<script><!--<script </ -#errors -(1,8): expected-doctype-but-got-start-tag -(1,22): eof-in-script-in-script -(1,22): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script </" -| <body> - -#data -<script><!--<script </s -#errors -(1,8): expected-doctype-but-got-start-tag -(1,23): eof-in-script-in-script -(1,23): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script </s" -| <body> - -#data -<script><!--<script </script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,28): eof-in-script-in-script -(1,28): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script </script" -| <body> - -#data -<script><!--<script </scripta -#errors -(1,8): expected-doctype-but-got-start-tag -(1,29): eof-in-script-in-script -(1,29): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script </scripta" -| <body> - -#data -<script><!--<script </script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,29): expected-named-closing-tag-but-got-eof -(1,29): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<script </script " -| <body> - -#data -<script><!--<script </script> -#errors -(1,8): expected-doctype-but-got-start-tag -(1,29): expected-named-closing-tag-but-got-eof -(1,29): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<script </script>" -| <body> - -#data -<script><!--<script </script/ -#errors -(1,8): expected-doctype-but-got-start-tag -(1,29): expected-named-closing-tag-but-got-eof -(1,29): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<script </script/" -| <body> - -#data -<script><!--<script </script < -#errors -(1,8): expected-doctype-but-got-start-tag -(1,30): expected-named-closing-tag-but-got-eof -(1,30): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<script </script <" -| <body> - -#data -<script><!--<script </script <a -#errors -(1,8): expected-doctype-but-got-start-tag -(1,31): expected-named-closing-tag-but-got-eof -(1,31): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<script </script <a" -| <body> - -#data -<script><!--<script </script </ -#errors -(1,8): expected-doctype-but-got-start-tag -(1,31): expected-named-closing-tag-but-got-eof -(1,31): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<script </script </" -| <body> - -#data -<script><!--<script </script </script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,37): expected-named-closing-tag-but-got-eof -(1,37): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<script </script </script" -| <body> - -#data -<script><!--<script </script </script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,38): expected-attribute-name-but-got-eof -(1,38): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script </script " -| <body> - -#data -<script><!--<script </script </script/ -#errors -(1,8): expected-doctype-but-got-start-tag -(1,38): unexpected-EOF-after-solidus-in-tag -(1,38): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script </script " -| <body> - -#data -<script><!--<script </script </script> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <script> -| "<!--<script </script " -| <body> - -#data -<script><!--<script - -#errors -(1,8): expected-doctype-but-got-start-tag -(1,21): eof-in-script-in-script -(1,21): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script -" -| <body> - -#data -<script><!--<script -a -#errors -(1,8): expected-doctype-but-got-start-tag -(1,22): eof-in-script-in-script -(1,22): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script -a" -| <body> - -#data -<script><!--<script -- -#errors -(1,8): expected-doctype-but-got-start-tag -(1,22): eof-in-script-in-script -(1,22): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script --" -| <body> - -#data -<script><!--<script --a -#errors -(1,8): expected-doctype-but-got-start-tag -(1,23): eof-in-script-in-script -(1,23): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script --a" -| <body> - -#data -<script><!--<script --> -#errors -(1,8): expected-doctype-but-got-start-tag -(1,23): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script -->" -| <body> - -#data -<script><!--<script -->< -#errors -(1,8): expected-doctype-but-got-start-tag -(1,24): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script --><" -| <body> - -#data -<script><!--<script --></ -#errors -(1,8): expected-doctype-but-got-start-tag -(1,25): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script --></" -| <body> - -#data -<script><!--<script --></script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,31): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script --></script" -| <body> - -#data -<script><!--<script --></script -#errors -(1,8): expected-doctype-but-got-start-tag -(1,32): expected-attribute-name-but-got-eof -(1,32): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script -->" -| <body> - -#data -<script><!--<script --></script/ -#errors -(1,8): expected-doctype-but-got-start-tag -(1,32): unexpected-EOF-after-solidus-in-tag -(1,32): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "<!--<script -->" -| <body> - -#data -<script><!--<script --></script> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <script> -| "<!--<script -->" -| <body> - -#data -<script><!--<script><\/script>--></script> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <script> -| "<!--<script><\/script>-->" -| <body> - -#data -<script><!--<script></scr'+'ipt>--></script> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <script> -| "<!--<script></scr'+'ipt>-->" -| <body> - -#data -<script><!--<script></script><script></script></script> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>" -| <body> - -#data -<script><!--<script></script><script></script>--><!--</script> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>--><!--" -| <body> - -#data -<script><!--<script></script><script></script>-- ></script> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>-- >" -| <body> - -#data -<script><!--<script></script><script></script>- -></script> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>- ->" -| <body> - -#data -<script><!--<script></script><script></script>- - ></script> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>- - >" -| <body> - -#data -<script><!--<script></script><script></script>-></script> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <script> -| "<!--<script></script><script></script>->" -| <body> - -#data -<script><!--<script>--!></script>X -#errors -(1,8): expected-doctype-but-got-start-tag -(1,34): expected-named-closing-tag-but-got-eof -(1,34): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<script>--!></script>X" -| <body> - -#data -<script><!--<scr'+'ipt></script>--></script> -#errors -(1,8): expected-doctype-but-got-start-tag -(1,44): unexpected-end-tag -#document -| <html> -| <head> -| <script> -| "<!--<scr'+'ipt>" -| <body> -| "-->" - -#data -<script><!--<script></scr'+'ipt></script>X -#errors -(1,8): expected-doctype-but-got-start-tag -(1,42): expected-named-closing-tag-but-got-eof -(1,42): unexpected-eof-in-text-mode -#document -| <html> -| <head> -| <script> -| "<!--<script></scr'+'ipt></script>X" -| <body> - -#data -<style><!--<style></style>--></style> -#errors -(1,7): expected-doctype-but-got-start-tag -(1,37): unexpected-end-tag -#document -| <html> -| <head> -| <style> -| "<!--<style>" -| <body> -| "-->" - -#data -<style><!--</style>X -#errors -(1,7): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <style> -| "<!--" -| <body> -| "X" - -#data -<style><!--...</style>...--></style> -#errors -(1,7): expected-doctype-but-got-start-tag -(1,36): unexpected-end-tag -#document -| <html> -| <head> -| <style> -| "<!--..." -| <body> -| "...-->" - -#data -<style><!--<br><html xmlns:v="urn:schemas-microsoft-com:vml"><!--[if !mso]><style></style>X -#errors -(1,7): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <style> -| "<!--<br><html xmlns:v="urn:schemas-microsoft-com:vml"><!--[if !mso]><style>" -| <body> -| "X" - -#data -<style><!--...<style><!--...--!></style>--></style> -#errors -(1,7): expected-doctype-but-got-start-tag -(1,51): unexpected-end-tag -#document -| <html> -| <head> -| <style> -| "<!--...<style><!--...--!>" -| <body> -| "-->" - -#data -<style><!--...</style><!-- --><style>@import ...</style> -#errors -(1,7): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <style> -| "<!--..." -| <!-- --> -| <style> -| "@import ..." -| <body> - -#data -<style>...<style><!--...</style><!-- --></style> -#errors -(1,7): expected-doctype-but-got-start-tag -(1,48): unexpected-end-tag -#document -| <html> -| <head> -| <style> -| "...<style><!--..." -| <!-- --> -| <body> - -#data -<style>...<!--[if IE]><style>...</style>X -#errors -(1,7): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <style> -| "...<!--[if IE]><style>..." -| <body> -| "X" - -#data -<title><!--<title>--> -#errors -(1,7): expected-doctype-but-got-start-tag -(1,37): unexpected-end-tag -#document -| -| -| -| "<!--<title>" -| <body> -| "-->" - -#data -<title></title> -#errors -(1,7): expected-doctype-but-got-start-tag -#document -| -| -| -| "" -| - -#data -foo/title><link></head><body>X -#errors -(1,7): expected-doctype-but-got-start-tag -(1,37): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <title> -| "foo/title><link></head><body>X" -| <body> - -#data -<noscript><!--<noscript></noscript>--></noscript> -#errors -(1,10): expected-doctype-but-got-start-tag -(1,49): unexpected-end-tag -#script-on -#document -| <html> -| <head> -| <noscript> -| "<!--<noscript>" -| <body> -| "-->" - -#data -<noscript><!--<noscript></noscript>--></noscript> -#errors - * (1,11) missing DOCTYPE -#script-off -#document -| <html> -| <head> -| <noscript> -| <!-- <noscript></noscript> --> -| <body> - -#data -<noscript><!--</noscript>X<noscript>--></noscript> -#errors -(1,10): expected-doctype-but-got-start-tag -#script-on -#document -| <html> -| <head> -| <noscript> -| "<!--" -| <body> -| "X" -| <noscript> -| "-->" - -#data -<noscript><!--</noscript>X<noscript>--></noscript> -#errors -(1,10): expected-doctype-but-got-start-tag -#script-off -#document -| <html> -| <head> -| <noscript> -| <!-- </noscript>X<noscript> --> -| <body> - -#data -<noscript><iframe></noscript>X -#errors -(1,10): expected-doctype-but-got-start-tag -#script-on -#document -| <html> -| <head> -| <noscript> -| "<iframe>" -| <body> -| "X" - -#data -<noscript><iframe></noscript>X -#errors - * (1,11) missing DOCTYPE - * (1,19) unexpected token in head noscript - * (1,31) unexpected EOF -#script-off -#document -| <html> -| <head> -| <noscript> -| <body> -| <iframe> -| "</noscript>X" - -#data -<noframes><!--<noframes></noframes>--></noframes> -#errors -(1,10): expected-doctype-but-got-start-tag -(1,49): unexpected-end-tag -#document -| <html> -| <head> -| <noframes> -| "<!--<noframes>" -| <body> -| "-->" - -#data -<noframes><body><script><!--...</script></body></noframes></html> -#errors -(1,10): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <noframes> -| "<body><script><!--...</script></body>" -| <body> - -#data -<textarea><!--<textarea></textarea>--></textarea> -#errors -(1,10): expected-doctype-but-got-start-tag -(1,49): unexpected-end-tag -#document -| <html> -| <head> -| <body> -| <textarea> -| "<!--<textarea>" -| "-->" - -#data -<textarea></textarea></textarea> -#errors -(1,10): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <body> -| <textarea> -| "</textarea>" - -#data -<iframe><!--<iframe></iframe>--></iframe> -#errors -(1,8): expected-doctype-but-got-start-tag -(1,41): unexpected-end-tag -#document -| <html> -| <head> -| <body> -| <iframe> -| "<!--<iframe>" -| "-->" - -#data -<iframe>...<!--X->...<!--/X->...</iframe> -#errors -(1,8): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <body> -| <iframe> -| "...<!--X->...<!--/X->..." - -#data -<xmp><!--<xmp></xmp>--></xmp> -#errors -(1,5): expected-doctype-but-got-start-tag -(1,29): unexpected-end-tag -#document -| <html> -| <head> -| <body> -| <xmp> -| "<!--<xmp>" -| "-->" - -#data -<noembed><!--<noembed></noembed>--></noembed> -#errors -(1,9): expected-doctype-but-got-start-tag -(1,45): unexpected-end-tag -#document -| <html> -| <head> -| <body> -| <noembed> -| "<!--<noembed>" -| "-->" - -#data -<!doctype html><table> - -#errors -(2,0): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| " -" - -#data -<!doctype html><table><td><span><font></span><span> -#errors -(1,26): unexpected-cell-in-table-body -(1,45): unexpected-end-tag -(1,51): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| <td> -| <span> -| <font> -| <font> -| <span> - -#data -<!doctype html><form><table></form><form></table></form> -#errors -(1,35): unexpected-end-tag-implies-table-voodoo -(1,35): unexpected-end-tag -(1,41): unexpected-form-in-table -(1,56): unexpected-end-tag -(1,56): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <form> -| <table> -| <form> diff --git a/libs/html5lib/tests/testdata/tree-construction/tests17.dat b/libs/html5lib/tests/testdata/tree-construction/tests17.dat deleted file mode 100644 index e49bcf031..000000000 --- a/libs/html5lib/tests/testdata/tree-construction/tests17.dat +++ /dev/null @@ -1,179 +0,0 @@ -#data -<!doctype html><table><tbody><select><tr> -#errors -(1,37): unexpected-start-tag-implies-table-voodoo -(1,41): unexpected-table-element-start-tag-in-select-in-table -(1,41): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <table> -| <tbody> -| <tr> - -#data -<!doctype html><table><tr><select><td> -#errors -(1,34): unexpected-start-tag-implies-table-voodoo -(1,38): unexpected-table-element-start-tag-in-select-in-table -(1,38): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <table> -| <tbody> -| <tr> -| <td> - -#data -<!doctype html><table><tr><td><select><td> -#errors -(1,42): unexpected-table-element-start-tag-in-select-in-table -(1,42): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| <td> -| <select> -| <td> - -#data -<!doctype html><table><tr><th><select><td> -#errors -(1,42): unexpected-table-element-start-tag-in-select-in-table -(1,42): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| <th> -| <select> -| <td> - -#data -<!doctype html><table><caption><select><tr> -#errors -(1,43): unexpected-table-element-start-tag-in-select-in-table -(1,43): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <caption> -| <select> -| <tbody> -| <tr> - -#data -<!doctype html><select><tr> -#errors -(1,27): unexpected-start-tag-in-select -(1,27): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> - -#data -<!doctype html><select><td> -#errors -(1,27): unexpected-start-tag-in-select -(1,27): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> - -#data -<!doctype html><select><th> -#errors -(1,27): unexpected-start-tag-in-select -(1,27): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> - -#data -<!doctype html><select><tbody> -#errors -(1,30): unexpected-start-tag-in-select -(1,30): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> - -#data -<!doctype html><select><thead> -#errors -(1,30): unexpected-start-tag-in-select -(1,30): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> - -#data -<!doctype html><select><tfoot> -#errors -(1,30): unexpected-start-tag-in-select -(1,30): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> - -#data -<!doctype html><select><caption> -#errors -(1,32): unexpected-start-tag-in-select -(1,32): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> - -#data -<!doctype html><table><tr></table>a -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| "a" diff --git a/libs/html5lib/tests/testdata/tree-construction/tests18.dat b/libs/html5lib/tests/testdata/tree-construction/tests18.dat deleted file mode 100644 index 926bccb38..000000000 --- a/libs/html5lib/tests/testdata/tree-construction/tests18.dat +++ /dev/null @@ -1,322 +0,0 @@ -#data -<!doctype html><plaintext></plaintext> -#errors -(1,38): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <plaintext> -| "</plaintext>" - -#data -<!doctype html><table><plaintext></plaintext> -#errors -(1,33): foster-parenting-start-tag -(1,34): foster-parenting-character -(1,35): foster-parenting-character -(1,36): foster-parenting-character -(1,37): foster-parenting-character -(1,38): foster-parenting-character -(1,39): foster-parenting-character -(1,40): foster-parenting-character -(1,41): foster-parenting-character -(1,42): foster-parenting-character -(1,43): foster-parenting-character -(1,44): foster-parenting-character -(1,45): foster-parenting-character -(1,45): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <plaintext> -| "</plaintext>" -| <table> - -#data -<!doctype html><table><tbody><plaintext></plaintext> -#errors -(1,40): foster-parenting-start-tag -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,41): foster-parenting-character -(1,52): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <plaintext> -| "</plaintext>" -| <table> -| <tbody> - -#data -<!doctype html><table><tbody><tr><plaintext></plaintext> -#errors -(1,44): foster-parenting-start-tag -(1,45): foster-parenting-character -(1,46): foster-parenting-character -(1,47): foster-parenting-character -(1,48): foster-parenting-character -(1,49): foster-parenting-character -(1,50): foster-parenting-character -(1,51): foster-parenting-character -(1,52): foster-parenting-character -(1,53): foster-parenting-character -(1,54): foster-parenting-character -(1,55): foster-parenting-character -(1,56): foster-parenting-character -(1,56): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <plaintext> -| "</plaintext>" -| <table> -| <tbody> -| <tr> - -#data -<!doctype html><table><td><plaintext></plaintext> -#errors -(1,26): unexpected-cell-in-table-body -(1,49): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| <td> -| <plaintext> -| "</plaintext>" - -#data -<!doctype html><table><caption><plaintext></plaintext> -#errors -(1,54): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <caption> -| <plaintext> -| "</plaintext>" - -#data -<!doctype html><table><tr><style></script></style>abc -#errors -(1,51): foster-parenting-character -(1,52): foster-parenting-character -(1,53): foster-parenting-character -(1,53): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| "abc" -| <table> -| <tbody> -| <tr> -| <style> -| "</script>" - -#data -<!doctype html><table><tr><script></style></script>abc -#errors -(1,52): foster-parenting-character -(1,53): foster-parenting-character -(1,54): foster-parenting-character -(1,54): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| "abc" -| <table> -| <tbody> -| <tr> -| <script> -| "</style>" - -#data -<!doctype html><table><caption><style></script></style>abc -#errors -(1,58): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <caption> -| <style> -| "</script>" -| "abc" - -#data -<!doctype html><table><td><style></script></style>abc -#errors -(1,26): unexpected-cell-in-table-body -(1,53): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| <td> -| <style> -| "</script>" -| "abc" - -#data -<!doctype html><select><script></style></script>abc -#errors -(1,51): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <script> -| "</style>" -| "abc" - -#data -<!doctype html><table><select><script></style></script>abc -#errors -(1,30): unexpected-start-tag-implies-table-voodoo -(1,58): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <script> -| "</style>" -| "abc" -| <table> - -#data -<!doctype html><table><tr><select><script></style></script>abc -#errors -(1,34): unexpected-start-tag-implies-table-voodoo -(1,62): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <script> -| "</style>" -| "abc" -| <table> -| <tbody> -| <tr> - -#data -<!doctype html><frameset></frameset><noframes>abc -#errors -(1,49): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <noframes> -| "abc" - -#data -<!doctype html><frameset></frameset><noframes>abc</noframes><!--abc--> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <noframes> -| "abc" -| <!-- abc --> - -#data -<!doctype html><frameset></frameset></html><noframes>abc -#errors -(1,56): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <noframes> -| "abc" - -#data -<!doctype html><frameset></frameset></html><noframes>abc</noframes><!--abc--> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <noframes> -| "abc" -| <!-- abc --> - -#data -<!doctype html><table><tr></tbody><tfoot> -#errors -(1,41): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| <tfoot> - -#data -<!doctype html><table><td><svg></svg>abc<td> -#errors -(1,26): unexpected-cell-in-table-body -(1,44): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| <td> -| <svg svg> -| "abc" -| <td> diff --git a/libs/html5lib/tests/testdata/tree-construction/tests19.dat b/libs/html5lib/tests/testdata/tree-construction/tests19.dat deleted file mode 100644 index a1897774d..000000000 --- a/libs/html5lib/tests/testdata/tree-construction/tests19.dat +++ /dev/null @@ -1,1454 +0,0 @@ -#data -<!doctype html><math><mn DefinitionUrl="foo"> -#errors -(1,45): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <math math> -| <math mn> -| definitionURL="foo" - -#data -<!doctype html><html></p><!--foo--> -#errors -(1,25): end-tag-after-implied-root -#document -| <!DOCTYPE html> -| <html> -| <!-- foo --> -| <head> -| <body> - -#data -<!doctype html><head></head></p><!--foo--> -#errors -(1,32): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <!-- foo --> -| <body> - -#data -<!doctype html><body><p><pre> -#errors -(1,29): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <pre> - -#data -<!doctype html><body><p><listing> -#errors -(1,33): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <listing> - -#data -<!doctype html><p><plaintext> -#errors -(1,29): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <plaintext> - -#data -<!doctype html><p><h1> -#errors -(1,22): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <h1> - -#data -<!doctype html><isindex type="hidden"> -#errors -(1,38): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <isindex> -| type="hidden" - -#data -<!doctype html><ruby><p><rp> -#errors -(1,28): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <ruby> -| <p> -| <rp> - -#data -<!doctype html><ruby><div><span><rp> -#errors -(1,36): XXX-undefined-error -(1,36): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <ruby> -| <div> -| <span> -| <rp> - -#data -<!doctype html><ruby><div><p><rp> -#errors -(1,33): XXX-undefined-error -(1,33): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <ruby> -| <div> -| <p> -| <rp> - -#data -<!doctype html><ruby><p><rt> -#errors -(1,28): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <ruby> -| <p> -| <rt> - -#data -<!doctype html><ruby><div><span><rt> -#errors -(1,36): XXX-undefined-error -(1,36): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <ruby> -| <div> -| <span> -| <rt> - -#data -<!doctype html><ruby><div><p><rt> -#errors -(1,33): XXX-undefined-error -(1,33): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <ruby> -| <div> -| <p> -| <rt> - -#data -<html><ruby>a<rb>b<rt></ruby></html> -#errors -(1,6): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <body> -| <ruby> -| "a" -| <rb> -| "b" -| <rt> - -#data -<html><ruby>a<rp>b<rt></ruby></html> -#errors -(1,6): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <body> -| <ruby> -| "a" -| <rp> -| "b" -| <rt> - -#data -<html><ruby>a<rt>b<rt></ruby></html> -#errors -(1,6): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <body> -| <ruby> -| "a" -| <rt> -| "b" -| <rt> - -#data -<html><ruby>a<rtc>b<rt>c<rb>d</ruby></html> -#errors -(1,6): expected-doctype-but-got-start-tag -#document -| <html> -| <head> -| <body> -| <ruby> -| "a" -| <rtc> -| "b" -| <rt> -| "c" -| <rb> -| "d" - -#data -<!doctype html><math/><foo> -#errors -(1,27): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <math math> -| <foo> - -#data -<!doctype html><svg/><foo> -#errors -(1,26): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <svg svg> -| <foo> - -#data -<!doctype html><div></body><!--foo--> -#errors -(1,27): expected-one-end-tag-but-got-another -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <div> -| <!-- foo --> - -#data -<!doctype html><h1><div><h3><span></h1>foo -#errors -(1,39): end-tag-too-early -(1,42): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <h1> -| <div> -| <h3> -| <span> -| "foo" - -#data -<!doctype html><p></h3>foo -#errors -(1,23): end-tag-too-early -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| "foo" - -#data -<!doctype html><h3><li>abc</h2>foo -#errors -(1,31): end-tag-too-early -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <h3> -| <li> -| "abc" -| "foo" - -#data -<!doctype html><table>abc<!--foo--> -#errors -(1,23): foster-parenting-character -(1,24): foster-parenting-character -(1,25): foster-parenting-character -(1,35): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| "abc" -| <table> -| <!-- foo --> - -#data -<!doctype html><table> <!--foo--> -#errors -(1,34): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| " " -| <!-- foo --> - -#data -<!doctype html><table> b <!--foo--> -#errors -(1,23): foster-parenting-character -(1,24): foster-parenting-character -(1,25): foster-parenting-character -(1,35): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| " b " -| <table> -| <!-- foo --> - -#data -<!doctype html><select><option><option> -#errors -(1,39): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <option> -| <option> - -#data -<!doctype html><select><option></optgroup> -#errors -(1,42): unexpected-end-tag-in-select -(1,42): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <option> - -#data -<!doctype html><select><option></optgroup> -#errors -(1,42): unexpected-end-tag-in-select -(1,42): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <option> - -#data -<!doctype html><dd><optgroup><dd> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <dd> -| <optgroup> -| <dd> - -#data -<!doctype html><p><math><mi><p><h1> -#errors -(1,35): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <math math> -| <math mi> -| <p> -| <h1> - -#data -<!doctype html><p><math><mo><p><h1> -#errors -(1,35): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <math math> -| <math mo> -| <p> -| <h1> - -#data -<!doctype html><p><math><mn><p><h1> -#errors -(1,35): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <math math> -| <math mn> -| <p> -| <h1> - -#data -<!doctype html><p><math><ms><p><h1> -#errors -(1,35): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <math math> -| <math ms> -| <p> -| <h1> - -#data -<!doctype html><p><math><mtext><p><h1> -#errors -(1,38): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <math math> -| <math mtext> -| <p> -| <h1> - -#data -<!doctype html><frameset></noframes> -#errors -(1,36): unexpected-end-tag-in-frameset -(1,36): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> - -#data -<!doctype html><html c=d><body></html><html a=b> -#errors -(1,48): non-html-root -#document -| <!DOCTYPE html> -| <html> -| a="b" -| c="d" -| <head> -| <body> - -#data -<!doctype html><html c=d><frameset></frameset></html><html a=b> -#errors -(1,63): non-html-root -#document -| <!DOCTYPE html> -| <html> -| a="b" -| c="d" -| <head> -| <frameset> - -#data -<!doctype html><html><frameset></frameset></html><!--foo--> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <!-- foo --> - -#data -<!doctype html><html><frameset></frameset></html> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| " " - -#data -<!doctype html><html><frameset></frameset></html>abc -#errors -(1,50): expected-eof-but-got-char -(1,51): expected-eof-but-got-char -(1,52): expected-eof-but-got-char -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> - -#data -<!doctype html><html><frameset></frameset></html><p> -#errors -(1,52): expected-eof-but-got-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> - -#data -<!doctype html><html><frameset></frameset></html></p> -#errors -(1,53): expected-eof-but-got-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> - -#data -<html><frameset></frameset></html><!doctype html> -#errors -(1,6): expected-doctype-but-got-start-tag -(1,49): unexpected-doctype -#document -| <html> -| <head> -| <frameset> - -#data -<!doctype html><body><frameset> -#errors -(1,31): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> - -#data -<!doctype html><p><frameset><frame> -#errors -(1,28): unexpected-start-tag -(1,35): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <frame> - -#data -<!doctype html><p>a<frameset> -#errors -(1,29): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| "a" - -#data -<!doctype html><p> <frameset><frame> -#errors -(1,29): unexpected-start-tag -(1,36): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <frame> - -#data -<!doctype html><pre><frameset> -#errors -(1,30): unexpected-start-tag -(1,30): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <pre> - -#data -<!doctype html><listing><frameset> -#errors -(1,34): unexpected-start-tag -(1,34): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <listing> - -#data -<!doctype html><li><frameset> -#errors -(1,29): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <li> - -#data -<!doctype html><dd><frameset> -#errors -(1,29): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <dd> - -#data -<!doctype html><dt><frameset> -#errors -(1,29): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <dt> - -#data -<!doctype html><button><frameset> -#errors -(1,33): unexpected-start-tag -(1,33): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <button> - -#data -<!doctype html><applet><frameset> -#errors -(1,33): unexpected-start-tag -(1,33): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <applet> - -#data -<!doctype html><marquee><frameset> -#errors -(1,34): unexpected-start-tag -(1,34): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <marquee> - -#data -<!doctype html><object><frameset> -#errors -(1,33): unexpected-start-tag -(1,33): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <object> - -#data -<!doctype html><table><frameset> -#errors -(1,32): unexpected-start-tag-implies-table-voodoo -(1,32): unexpected-start-tag -(1,32): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> - -#data -<!doctype html><area><frameset> -#errors -(1,31): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <area> - -#data -<!doctype html><basefont><frameset> -#errors -(1,35): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <basefont> -| <frameset> - -#data -<!doctype html><bgsound><frameset> -#errors -(1,34): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <bgsound> -| <frameset> - -#data -<!doctype html><br><frameset> -#errors -(1,29): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <br> - -#data -<!doctype html><embed><frameset> -#errors -(1,32): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <embed> - -#data -<!doctype html><img><frameset> -#errors -(1,30): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <img> - -#data -<!doctype html><input><frameset> -#errors -(1,32): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <input> - -#data -<!doctype html><keygen><frameset> -#errors -(1,33): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <keygen> - -#data -<!doctype html><wbr><frameset> -#errors -(1,30): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <wbr> - -#data -<!doctype html><hr><frameset> -#errors -(1,29): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <hr> - -#data -<!doctype html><textarea></textarea><frameset> -#errors -(1,46): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <textarea> - -#data -<!doctype html><xmp></xmp><frameset> -#errors -(1,36): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <xmp> - -#data -<!doctype html><iframe></iframe><frameset> -#errors -(1,42): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <iframe> - -#data -<!doctype html><select></select><frameset> -#errors -(1,42): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> - -#data -<!doctype html><svg></svg><frameset><frame> -#errors -(1,36): unexpected-start-tag -(1,43): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <frame> - -#data -<!doctype html><math></math><frameset><frame> -#errors -(1,38): unexpected-start-tag -(1,45): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <frame> - -#data -<!doctype html><svg><foreignObject><div> <frameset><frame> -#errors -(1,51): unexpected-start-tag -(1,58): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <frame> - -#data -<!doctype html><svg>a</svg><frameset><frame> -#errors -(1,37): unexpected-start-tag -(1,44): unexpected-start-tag-ignored -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <svg svg> -| "a" - -#data -<!doctype html><svg> </svg><frameset><frame> -#errors -(1,37): unexpected-start-tag -(1,44): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| <frame> - -#data -<html>aaa<frameset></frameset> -#errors -(1,6): expected-doctype-but-got-start-tag -(1,19): unexpected-start-tag -(1,30): unexpected-end-tag -#document -| <html> -| <head> -| <body> -| "aaa" - -#data -<html> a <frameset></frameset> -#errors -(1,6): expected-doctype-but-got-start-tag -(1,19): unexpected-start-tag -(1,30): unexpected-end-tag -#document -| <html> -| <head> -| <body> -| "a " - -#data -<!doctype html><div><frameset> -#errors -(1,30): unexpected-start-tag -(1,30): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> - -#data -<!doctype html><div><body><frameset> -#errors -(1,26): unexpected-start-tag -(1,36): unexpected-start-tag -(1,36): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <div> - -#data -<!doctype html><p><math></p>a -#errors -(1,28): unexpected-end-tag -(1,28): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <math math> -| "a" - -#data -<!doctype html><p><math><mn><span></p>a -#errors -(1,38): unexpected-end-tag -(1,39): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <math math> -| <math mn> -| <span> -| <p> -| "a" - -#data -<!doctype html><math></html> -#errors -(1,28): unexpected-end-tag -(1,28): expected-one-end-tag-but-got-another -(1,28): unexpected-end-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <math math> - -#data -<!doctype html><meta charset="ascii"> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <meta> -| charset="ascii" -| <body> - -#data -<!doctype html><meta http-equiv="content-type" content="text/html;charset=ascii"> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <meta> -| content="text/html;charset=ascii" -| http-equiv="content-type" -| <body> - -#data -<!doctype html><head><!--aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa--><meta charset="utf8"> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <!-- aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --> -| <meta> -| charset="utf8" -| <body> - -#data -<!doctype html><html a=b><head></head><html c=d> -#errors -(1,48): non-html-root -#document -| <!DOCTYPE html> -| <html> -| a="b" -| c="d" -| <head> -| <body> - -#data -<!doctype html><image/> -#errors -(1,23): image-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <img> - -#data -<!doctype html>a<i>b<table>c<b>d</i>e</b>f -#errors -(1,28): foster-parenting-character -(1,31): foster-parenting-start-tag -(1,32): foster-parenting-character -(1,36): foster-parenting-end-tag -(1,36): adoption-agency-1.3 -(1,37): foster-parenting-character -(1,41): foster-parenting-end-tag -(1,42): foster-parenting-character -(1,42): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| "a" -| <i> -| "bc" -| <b> -| "de" -| "f" -| <table> - -#data -<!doctype html><table><i>a<b>b<div>c<a>d</i>e</b>f -#errors -(1,25): foster-parenting-start-tag -(1,26): foster-parenting-character -(1,29): foster-parenting-start-tag -(1,30): foster-parenting-character -(1,35): foster-parenting-start-tag -(1,36): foster-parenting-character -(1,39): foster-parenting-start-tag -(1,40): foster-parenting-character -(1,44): foster-parenting-end-tag -(1,44): adoption-agency-1.3 -(1,44): adoption-agency-1.3 -(1,45): foster-parenting-character -(1,49): foster-parenting-end-tag -(1,49): adoption-agency-1.3 -(1,49): adoption-agency-1.3 -(1,50): foster-parenting-character -(1,50): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <i> -| "a" -| <b> -| "b" -| <b> -| <div> -| <b> -| <i> -| "c" -| <a> -| "d" -| <a> -| "e" -| <a> -| "f" -| <table> - -#data -<!doctype html><i>a<b>b<div>c<a>d</i>e</b>f -#errors -(1,37): adoption-agency-1.3 -(1,37): adoption-agency-1.3 -(1,42): adoption-agency-1.3 -(1,42): adoption-agency-1.3 -(1,43): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <i> -| "a" -| <b> -| "b" -| <b> -| <div> -| <b> -| <i> -| "c" -| <a> -| "d" -| <a> -| "e" -| <a> -| "f" - -#data -<!doctype html><table><i>a<b>b<div>c</i> -#errors -(1,25): foster-parenting-start-tag -(1,26): foster-parenting-character -(1,29): foster-parenting-start-tag -(1,30): foster-parenting-character -(1,35): foster-parenting-start-tag -(1,36): foster-parenting-character -(1,40): foster-parenting-end-tag -(1,40): adoption-agency-1.3 -(1,40): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <i> -| "a" -| <b> -| "b" -| <b> -| <div> -| <i> -| "c" -| <table> - -#data -<!doctype html><table><i>a<b>b<div>c<a>d</i>e</b>f -#errors -(1,25): foster-parenting-start-tag -(1,26): foster-parenting-character -(1,29): foster-parenting-start-tag -(1,30): foster-parenting-character -(1,35): foster-parenting-start-tag -(1,36): foster-parenting-character -(1,39): foster-parenting-start-tag -(1,40): foster-parenting-character -(1,44): foster-parenting-end-tag -(1,44): adoption-agency-1.3 -(1,44): adoption-agency-1.3 -(1,45): foster-parenting-character -(1,49): foster-parenting-end-tag -(1,44): adoption-agency-1.3 -(1,44): adoption-agency-1.3 -(1,50): foster-parenting-character -(1,50): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <i> -| "a" -| <b> -| "b" -| <b> -| <div> -| <b> -| <i> -| "c" -| <a> -| "d" -| <a> -| "e" -| <a> -| "f" -| <table> - -#data -<!doctype html><table><i>a<div>b<tr>c<b>d</i>e -#errors -(1,25): foster-parenting-start-tag -(1,26): foster-parenting-character -(1,31): foster-parenting-start-tag -(1,32): foster-parenting-character -(1,37): foster-parenting-character -(1,40): foster-parenting-start-tag -(1,41): foster-parenting-character -(1,45): foster-parenting-end-tag -(1,45): adoption-agency-1.3 -(1,46): foster-parenting-character -(1,46): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <i> -| "a" -| <div> -| "b" -| <i> -| "c" -| <b> -| "d" -| <b> -| "e" -| <table> -| <tbody> -| <tr> - -#data -<!doctype html><table><td><table><i>a<div>b<b>c</i>d -#errors -(1,26): unexpected-cell-in-table-body -(1,36): foster-parenting-start-tag -(1,37): foster-parenting-character -(1,42): foster-parenting-start-tag -(1,43): foster-parenting-character -(1,46): foster-parenting-start-tag -(1,47): foster-parenting-character -(1,51): foster-parenting-end-tag -(1,51): adoption-agency-1.3 -(1,51): adoption-agency-1.3 -(1,52): foster-parenting-character -(1,52): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| <td> -| <i> -| "a" -| <div> -| <i> -| "b" -| <b> -| "c" -| <b> -| "d" -| <table> - -#data -<!doctype html><body><bgsound> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <bgsound> - -#data -<!doctype html><body><basefont> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <basefont> - -#data -<!doctype html><a><b></a><basefont> -#errors -(1,25): adoption-agency-1.3 -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <a> -| <b> -| <basefont> - -#data -<!doctype html><a><b></a><bgsound> -#errors -(1,25): adoption-agency-1.3 -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <a> -| <b> -| <bgsound> - -#data -<!doctype html><figcaption><article></figcaption>a -#errors -(1,49): end-tag-too-early -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <figcaption> -| <article> -| "a" - -#data -<!doctype html><summary><article></summary>a -#errors -(1,43): end-tag-too-early -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <summary> -| <article> -| "a" - -#data -<!doctype html><p><a><plaintext>b -#errors -(1,32): unexpected-end-tag -(1,33): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <a> -| <plaintext> -| <a> -| "b" - -#data -<!DOCTYPE html><div>a<a></div>b<p>c</p>d -#errors -(1,30): end-tag-too-early -(1,40): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <div> -| "a" -| <a> -| <a> -| "b" -| <p> -| "c" -| "d" diff --git a/libs/html5lib/tests/testdata/tree-construction/tests2.dat b/libs/html5lib/tests/testdata/tree-construction/tests2.dat deleted file mode 100644 index bd2d11d9d..000000000 --- a/libs/html5lib/tests/testdata/tree-construction/tests2.dat +++ /dev/null @@ -1,780 +0,0 @@ -#data -<!DOCTYPE html>Test -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| "Test" - -#data -<textarea>test</div>test -#errors -(1,10): expected-doctype-but-got-start-tag -(1,24): expected-closing-tag-but-got-eof -#document -| <html> -| <head> -| <body> -| <textarea> -| "test</div>test" - -#data -<table><td> -#errors -(1,7): expected-doctype-but-got-start-tag -(1,11): unexpected-cell-in-table-body -(1,11): expected-closing-tag-but-got-eof -#document -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| <td> - -#data -<table><td>test</tbody></table> -#errors -(1,7): expected-doctype-but-got-start-tag -(1,11): unexpected-cell-in-table-body -#document -| <html> -| <head> -| <body> -| <table> -| <tbody> -| <tr> -| <td> -| "test" - -#data -<frame>test -#errors -(1,7): expected-doctype-but-got-start-tag -(1,7): unexpected-start-tag-ignored -#document -| <html> -| <head> -| <body> -| "test" - -#data -<!DOCTYPE html><frameset>test -#errors -(1,29): unexpected-char-in-frameset -(1,29): unexpected-char-in-frameset -(1,29): unexpected-char-in-frameset -(1,29): unexpected-char-in-frameset -(1,29): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> - -#data -<!DOCTYPE html><frameset> te st -#errors -(1,29): unexpected-char-in-frameset -(1,29): unexpected-char-in-frameset -(1,29): unexpected-char-in-frameset -(1,29): unexpected-char-in-frameset -(1,29): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| " " - -#data -<!DOCTYPE html><frameset></frameset> te st -#errors -(1,29): unexpected-char-after-frameset -(1,29): unexpected-char-after-frameset -(1,29): unexpected-char-after-frameset -(1,29): unexpected-char-after-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> -| " " - -#data -<!DOCTYPE html><frameset><!DOCTYPE html> -#errors -(1,40): unexpected-doctype -(1,40): eof-in-frameset -#document -| <!DOCTYPE html> -| <html> -| <head> -| <frameset> - -#data -<!DOCTYPE html><font><p><b>test</font> -#errors -(1,38): adoption-agency-1.3 -(1,38): adoption-agency-1.3 -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <font> -| <p> -| <font> -| <b> -| "test" - -#data -<!DOCTYPE html><dt><div><dd> -#errors -(1,28): end-tag-too-early -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <dt> -| <div> -| <dd> - -#data -<script></x -#errors -(1,8): expected-doctype-but-got-start-tag -(1,11): expected-named-closing-tag-but-got-eof -#document -| <html> -| <head> -| <script> -| "</x" -| <body> - -#data -<table><plaintext><td> -#errors -(1,7): expected-doctype-but-got-start-tag -(1,18): unexpected-start-tag-implies-table-voodoo -(1,22): foster-parenting-character-in-table -(1,22): foster-parenting-character-in-table -(1,22): foster-parenting-character-in-table -(1,22): foster-parenting-character-in-table -(1,22): eof-in-table -#document -| <html> -| <head> -| <body> -| <plaintext> -| "<td>" -| <table> - -#data -<plaintext></plaintext> -#errors -(1,11): expected-doctype-but-got-start-tag -(1,23): expected-closing-tag-but-got-eof -#document -| <html> -| <head> -| <body> -| <plaintext> -| "</plaintext>" - -#data -<!DOCTYPE html><table><tr>TEST -#errors -(1,30): foster-parenting-character-in-table -(1,30): foster-parenting-character-in-table -(1,30): foster-parenting-character-in-table -(1,30): foster-parenting-character-in-table -(1,30): eof-in-table -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| "TEST" -| <table> -| <tbody> -| <tr> - -#data -<!DOCTYPE html><body t1=1><body t2=2><body t3=3 t4=4> -#errors -(1,37): unexpected-start-tag -(1,53): unexpected-start-tag -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| t1="1" -| t2="2" -| t3="3" -| t4="4" - -#data -</b test -#errors -(1,8): eof-in-attribute-name -(1,8): expected-doctype-but-got-eof -#document -| <html> -| <head> -| <body> - -#data -<!DOCTYPE html></b test<b &=&>X -#errors -(1,24): invalid-character-in-attribute-name -(1,32): named-entity-without-semicolon -(1,33): attributes-in-end-tag -(1,33): unexpected-end-tag-before-html -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| "X" - -#data -<!doctypehtml><scrIPt type=text/x-foobar;baz>X</SCRipt -#errors -(1,9): need-space-after-doctype -(1,54): expected-named-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <script> -| type="text/x-foobar;baz" -| "X</SCRipt" -| <body> - -#data -& -#errors -(1,1): expected-doctype-but-got-chars -#document -| <html> -| <head> -| <body> -| "&" - -#data -&# -#errors -(1,2): expected-numeric-entity -(1,2): expected-doctype-but-got-chars -#document -| <html> -| <head> -| <body> -| "&#" - -#data -&#X -#errors -(1,3): expected-numeric-entity -(1,3): expected-doctype-but-got-chars -#document -| <html> -| <head> -| <body> -| "&#X" - -#data -&#x -#errors -(1,3): expected-numeric-entity -(1,3): expected-doctype-but-got-chars -#document -| <html> -| <head> -| <body> -| "&#x" - -#data -- -#errors -(1,4): numeric-entity-without-semicolon -(1,4): expected-doctype-but-got-chars -#document -| <html> -| <head> -| <body> -| "-" - -#data -&x-test -#errors -(1,2): expected-doctype-but-got-chars -#document -| <html> -| <head> -| <body> -| "&x-test" - -#data -<!doctypehtml><p><li> -#errors -(1,9): need-space-after-doctype -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <li> - -#data -<!doctypehtml><p><dt> -#errors -(1,9): need-space-after-doctype -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <dt> - -#data -<!doctypehtml><p><dd> -#errors -(1,9): need-space-after-doctype -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <dd> - -#data -<!doctypehtml><p><form> -#errors -(1,9): need-space-after-doctype -(1,23): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| <form> - -#data -<!DOCTYPE html><p></P>X -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <p> -| "X" - -#data -& -#errors -(1,4): named-entity-without-semicolon -(1,4): expected-doctype-but-got-chars -#document -| <html> -| <head> -| <body> -| "&" - -#data -&AMp; -#errors -(1,3): expected-named-entity -(1,3): expected-doctype-but-got-chars -#document -| <html> -| <head> -| <body> -| "&AMp;" - -#data -<!DOCTYPE html><html><head></head><body><thisISasillyTESTelementNameToMakeSureCrazyTagNamesArePARSEDcorrectLY> -#errors -(1,110): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <thisisasillytestelementnametomakesurecrazytagnamesareparsedcorrectly> - -#data -<!DOCTYPE html>X</body>X -#errors -(1,24): unexpected-char-after-body -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| "XX" - -#data -<!DOCTYPE html><!-- X -#errors -(1,21): eof-in-comment -#document -| <!DOCTYPE html> -| <!-- X --> -| <html> -| <head> -| <body> - -#data -<!DOCTYPE html><table><caption>test TEST</caption><td>test -#errors -(1,54): unexpected-cell-in-table-body -(1,58): expected-closing-tag-but-got-eof -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <table> -| <caption> -| "test TEST" -| <tbody> -| <tr> -| <td> -| "test" - -#data -<!DOCTYPE html><select><option><optgroup> -#errors -(1,41): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <option> -| <optgroup> - -#data -<!DOCTYPE html><select><optgroup><option></optgroup><option><select><option> -#errors -(1,68): unexpected-select-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <optgroup> -| <option> -| <option> -| <option> - -#data -<!DOCTYPE html><select><optgroup><option><optgroup> -#errors -(1,51): eof-in-select -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <optgroup> -| <option> -| <optgroup> - -#data -<!DOCTYPE html><datalist><option>foo</datalist>bar -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <datalist> -| <option> -| "foo" -| "bar" - -#data -<!DOCTYPE html><font><input><input></font> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <font> -| <input> -| <input> - -#data -<!DOCTYPE html><!-- XXX - XXX --> -#errors -#document -| <!DOCTYPE html> -| <!-- XXX - XXX --> -| <html> -| <head> -| <body> - -#data -<!DOCTYPE html><!-- XXX - XXX -#errors -(1,29): eof-in-comment -#document -| <!DOCTYPE html> -| <!-- XXX - XXX --> -| <html> -| <head> -| <body> - -#data -<!DOCTYPE html><!-- XXX - XXX - XXX --> -#errors -#document -| <!DOCTYPE html> -| <!-- XXX - XXX - XXX --> -| <html> -| <head> -| <body> - -#data -test -test -#errors -(2,4): expected-doctype-but-got-chars -#document -| <html> -| <head> -| <body> -| "test -test" - -#data -<!DOCTYPE html><body><title>test</body> -#errors -#document -| -| -| -| -| -| "test</body>" - -#data -<!DOCTYPE html><body><title>X -#errors -#document -| -| -| -| -| -| "X" -| <meta> -| name="z" -| <link> -| rel="foo" -| <style> -| " -x { content:"</style" } " - -#data -<!DOCTYPE html><select><optgroup></optgroup></select> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> -| <select> -| <optgroup> - -#data - - -#errors -(2,1): expected-doctype-but-got-eof -#document -| <html> -| <head> -| <body> - -#data -<!DOCTYPE html> <html> -#errors -#document -| <!DOCTYPE html> -| <html> -| <head> -| <body> - -#data -<!DOCTYPE html><script> -</script> <title>x -#errors -#document -| -| -| -| -#errors -(1,6): expected-doctype-but-got-start-tag -(1,21): unexpected-start-tag-out-of-my-head -#document -| -| -| -#errors -(1,6): expected-doctype-but-got-start-tag -(1,28): unexpected-start-tag-out-of-my-head -(1,52): unexpected-start-tag-out-of-my-head -#document -| -| -| -#errors -(1,6): expected-doctype-but-got-start-tag -#document -| -| -| -| -| "x" -| x -#errors -(1,7): expected-doctype-but-got-start-tag -#document -| -| -| --> x -#errors -(1,7): expected-doctype-but-got-start-tag -(1,34): unexpected-end-tag -#document -| -| -| x -#errors -(1,7): expected-doctype-but-got-start-tag -#document -| -| -| x -#errors -(1,7): expected-doctype-but-got-start-tag -#document -| -| -| x -#errors -(1,7): expected-doctype-but-got-start-tag -#document -| -| -|

    -#errors -#document -| -| -| -| -| -| ddd -#errors -(1,6): expected-doctype-but-got-start-tag -(1,21): unexpected-start-tag-out-of-my-head -#document -| -| -| -#errors -(1,3): expected-doctype-but-got-start-tag -(1,41): adoption-agency-1.3 -#document -| -| -| -| -|
  • -| -|