diff --git a/.gitmodules b/.gitmodules index 57c9b57f2f0..7aa466b5566 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,8 @@ +# [submodule "test/html5lib-tests"] +# path = test/html5lib-tests +# url = https://github.com/html5lib/html5lib-tests.git +# branch = master [submodule "test/html5lib-tests"] path = test/html5lib-tests - url = https://github.com/html5lib/html5lib-tests.git - branch = master + url = https://github.com/flavorjones/html5lib-tests.git + branch = flavorjones-fix-template-2023-04 diff --git a/gumbo-parser/src/foreign_attrs.c b/gumbo-parser/src/foreign_attrs.c index 2325c964730..54358731a92 100644 --- a/gumbo-parser/src/foreign_attrs.c +++ b/gumbo-parser/src/foreign_attrs.c @@ -1,6 +1,6 @@ /* ANSI-C code produced by gperf version 3.1 */ /* Command-line: gperf -m100 -n src/foreign_attrs.gperf */ -/* Computed positions: -k'2,8' */ +/* Computed positions: -k'8-9' */ /* Filtered by: gperf-filter.sed */ #include "replacement.h" @@ -29,9 +29,9 @@ hash (register const char *str, register size_t len) 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 2, - 11, 10, 11, 9, 7, 6, 11, 11, 1, 0, - 11, 5, 11, 11, 4, 11, 11, 11, 11, 11, - 11, 3, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 1, 11, 10, 4, 4, 11, 11, 3, 11, + 11, 5, 3, 11, 0, 11, 2, 11, 11, 11, + 11, 2, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, @@ -51,15 +51,14 @@ hash (register const char *str, register size_t len) switch (len) { default: + hval += asso_values[(unsigned char)str[8]]; + /*FALLTHROUGH*/ + case 8: hval += asso_values[(unsigned char)str[7]]; /*FALLTHROUGH*/ case 7: case 6: case 5: - case 4: - case 3: - case 2: - hval += asso_values[(unsigned char)str[1]]; break; } return hval; @@ -70,21 +69,21 @@ gumbo_get_foreign_attr_replacement (register const char *str, register size_t le { static const unsigned char lengthtable[] = { - 5, 11, 9, 13, 10, 10, 10, 11, 10, 8, 8 + 5, 10, 13, 9, 13, 10, 11, 11, 10, 10, 8 }; static const ForeignAttrReplacement wordlist[] = { {"xmlns", "xmlns", GUMBO_ATTR_NAMESPACE_XMLNS}, - {"xmlns:xlink", "xlink", GUMBO_ATTR_NAMESPACE_XMLNS}, + {"xlink:href", "href", GUMBO_ATTR_NAMESPACE_XLINK}, + {"xlink:arcrole", "arcrole", GUMBO_ATTR_NAMESPACE_XLINK}, {"xml:space", "space", GUMBO_ATTR_NAMESPACE_XML}, {"xlink:actuate", "actuate", GUMBO_ATTR_NAMESPACE_XLINK}, {"xlink:type", "type", GUMBO_ATTR_NAMESPACE_XLINK}, - {"xlink:href", "href", GUMBO_ATTR_NAMESPACE_XLINK}, - {"xlink:role", "role", GUMBO_ATTR_NAMESPACE_XLINK}, {"xlink:title", "title", GUMBO_ATTR_NAMESPACE_XLINK}, + {"xmlns:xlink", "xlink", GUMBO_ATTR_NAMESPACE_XMLNS}, + {"xlink:role", "role", GUMBO_ATTR_NAMESPACE_XLINK}, {"xlink:show", "show", GUMBO_ATTR_NAMESPACE_XLINK}, - {"xml:lang", "lang", GUMBO_ATTR_NAMESPACE_XML}, - {"xml:base", "base", GUMBO_ATTR_NAMESPACE_XML} + {"xml:lang", "lang", GUMBO_ATTR_NAMESPACE_XML} }; if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) diff --git a/gumbo-parser/src/foreign_attrs.gperf b/gumbo-parser/src/foreign_attrs.gperf index 91a0aa40b44..8a4e7bd338b 100644 --- a/gumbo-parser/src/foreign_attrs.gperf +++ b/gumbo-parser/src/foreign_attrs.gperf @@ -15,12 +15,12 @@ ForeignAttrReplacement; %% "xlink:actuate", "actuate", GUMBO_ATTR_NAMESPACE_XLINK +"xlink:arcrole", "arcrole", GUMBO_ATTR_NAMESPACE_XLINK "xlink:href", "href", GUMBO_ATTR_NAMESPACE_XLINK "xlink:role", "role", GUMBO_ATTR_NAMESPACE_XLINK "xlink:show", "show", GUMBO_ATTR_NAMESPACE_XLINK "xlink:title", "title", GUMBO_ATTR_NAMESPACE_XLINK "xlink:type", "type", GUMBO_ATTR_NAMESPACE_XLINK -"xml:base", "base", GUMBO_ATTR_NAMESPACE_XML "xml:lang", "lang", GUMBO_ATTR_NAMESPACE_XML "xml:space", "space", GUMBO_ATTR_NAMESPACE_XML "xmlns", "xmlns", GUMBO_ATTR_NAMESPACE_XMLNS diff --git a/test/html5/test_tree_construction.rb b/test/html5/test_tree_construction.rb index c0124aaa5ce..ac4684227ee 100644 --- a/test/html5/test_tree_construction.rb +++ b/test/html5/test_tree_construction.rb @@ -30,7 +30,7 @@ def compare_nodes(node, ng_node) else attributes[attr[:name]].value end - assert_equal(attr[:value], value) + assert_equal(attr[:value], value, "expected #{attr}[:value] to equal #{value.inspect}") end assert_equal( node[:children].length, @@ -117,7 +117,12 @@ def run_test end # Test the errors. - assert_equal(@test[:errors].length, doc.errors.length, "Wrong number of errors for #{@test[:data]}") + errpayload = doc.errors.map(&:to_s).join("\n") + assert_equal( + @test[:errors].length, + doc.errors.length, + "Expected #{@test[:errors].length} errors for #{@test[:data]}, found:\n#{errpayload}", + ) # The new, standardized tokenizer errors live in @test[:new_errors]. Let's # match each one to exactly one error in doc.errors. Unfortunately, the diff --git a/test/html5lib-tests b/test/html5lib-tests index 03e6c3250a5..38b11e598dd 160000 --- a/test/html5lib-tests +++ b/test/html5lib-tests @@ -1 +1 @@ -Subproject commit 03e6c3250a569af63c48d2d09b3f70270626c3b6 +Subproject commit 38b11e598dd6a8bf8f8ca42b582e84a104a34b58