nokogiri 1.8.5 → 1.13.9
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +3 -21
- data/LICENSE-DEPENDENCIES.md +1159 -868
- data/LICENSE.md +5 -28
- data/README.md +196 -90
- data/bin/nokogiri +63 -50
- data/dependencies.yml +13 -59
- data/ext/nokogiri/depend +38 -358
- data/ext/nokogiri/extconf.rb +765 -420
- data/ext/nokogiri/gumbo.c +584 -0
- data/ext/nokogiri/html4_document.c +166 -0
- data/ext/nokogiri/html4_element_description.c +294 -0
- data/ext/nokogiri/html4_entity_lookup.c +37 -0
- data/ext/nokogiri/html4_sax_parser_context.c +119 -0
- data/ext/nokogiri/html4_sax_push_parser.c +95 -0
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +228 -91
- data/ext/nokogiri/nokogiri.h +199 -88
- data/ext/nokogiri/test_global_handlers.c +40 -0
- data/ext/nokogiri/xml_attr.c +42 -37
- data/ext/nokogiri/xml_attribute_decl.c +21 -21
- data/ext/nokogiri/xml_cdata.c +14 -19
- data/ext/nokogiri/xml_comment.c +19 -26
- data/ext/nokogiri/xml_document.c +296 -217
- data/ext/nokogiri/xml_document_fragment.c +12 -16
- data/ext/nokogiri/xml_dtd.c +64 -58
- data/ext/nokogiri/xml_element_content.c +31 -26
- data/ext/nokogiri/xml_element_decl.c +25 -25
- data/ext/nokogiri/xml_encoding_handler.c +43 -18
- data/ext/nokogiri/xml_entity_decl.c +37 -35
- data/ext/nokogiri/xml_entity_reference.c +16 -18
- data/ext/nokogiri/xml_namespace.c +99 -54
- data/ext/nokogiri/xml_node.c +1107 -658
- data/ext/nokogiri/xml_node_set.c +178 -166
- data/ext/nokogiri/xml_processing_instruction.c +17 -19
- data/ext/nokogiri/xml_reader.c +277 -175
- data/ext/nokogiri/xml_relax_ng.c +52 -28
- data/ext/nokogiri/xml_sax_parser.c +112 -112
- data/ext/nokogiri/xml_sax_parser_context.c +112 -86
- data/ext/nokogiri/xml_sax_push_parser.c +36 -27
- data/ext/nokogiri/xml_schema.c +114 -35
- data/ext/nokogiri/xml_syntax_error.c +42 -21
- data/ext/nokogiri/xml_text.c +14 -18
- data/ext/nokogiri/xml_xpath_context.c +226 -115
- data/ext/nokogiri/xslt_stylesheet.c +265 -173
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +101 -0
- data/gumbo-parser/THANKS +27 -0
- data/gumbo-parser/src/Makefile +34 -0
- data/gumbo-parser/src/README.md +41 -0
- data/gumbo-parser/src/ascii.c +75 -0
- data/gumbo-parser/src/ascii.h +115 -0
- data/gumbo-parser/src/attribute.c +42 -0
- data/gumbo-parser/src/attribute.h +17 -0
- data/gumbo-parser/src/char_ref.c +22225 -0
- data/gumbo-parser/src/char_ref.h +29 -0
- data/gumbo-parser/src/char_ref.rl +2154 -0
- data/gumbo-parser/src/error.c +626 -0
- data/gumbo-parser/src/error.h +148 -0
- data/gumbo-parser/src/foreign_attrs.c +104 -0
- data/gumbo-parser/src/foreign_attrs.gperf +27 -0
- data/gumbo-parser/src/gumbo.h +943 -0
- data/gumbo-parser/src/insertion_mode.h +33 -0
- data/gumbo-parser/src/macros.h +91 -0
- data/gumbo-parser/src/parser.c +4875 -0
- data/gumbo-parser/src/parser.h +41 -0
- data/gumbo-parser/src/replacement.h +33 -0
- data/gumbo-parser/src/string_buffer.c +103 -0
- data/gumbo-parser/src/string_buffer.h +68 -0
- data/gumbo-parser/src/string_piece.c +48 -0
- data/gumbo-parser/src/svg_attrs.c +174 -0
- data/gumbo-parser/src/svg_attrs.gperf +77 -0
- data/gumbo-parser/src/svg_tags.c +137 -0
- data/gumbo-parser/src/svg_tags.gperf +55 -0
- data/gumbo-parser/src/tag.c +222 -0
- data/gumbo-parser/src/tag_lookup.c +382 -0
- data/gumbo-parser/src/tag_lookup.gperf +169 -0
- data/gumbo-parser/src/tag_lookup.h +13 -0
- data/gumbo-parser/src/token_buffer.c +79 -0
- data/gumbo-parser/src/token_buffer.h +71 -0
- data/gumbo-parser/src/token_type.h +17 -0
- data/gumbo-parser/src/tokenizer.c +3463 -0
- data/gumbo-parser/src/tokenizer.h +112 -0
- data/gumbo-parser/src/tokenizer_states.h +339 -0
- data/gumbo-parser/src/utf8.c +245 -0
- data/gumbo-parser/src/utf8.h +164 -0
- data/gumbo-parser/src/util.c +68 -0
- data/gumbo-parser/src/util.h +30 -0
- data/gumbo-parser/src/vector.c +111 -0
- data/gumbo-parser/src/vector.h +45 -0
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +10 -8
- data/lib/nokogiri/css/parser.rb +397 -377
- data/lib/nokogiri/css/parser.y +250 -245
- data/lib/nokogiri/css/parser_extras.rb +54 -49
- data/lib/nokogiri/css/syntax_error.rb +3 -1
- data/lib/nokogiri/css/tokenizer.rb +107 -104
- data/lib/nokogiri/css/tokenizer.rex +3 -2
- data/lib/nokogiri/css/xpath_visitor.rb +218 -91
- data/lib/nokogiri/css.rb +50 -17
- data/lib/nokogiri/decorators/slop.rb +9 -7
- data/lib/nokogiri/extension.rb +31 -0
- data/lib/nokogiri/gumbo.rb +15 -0
- data/lib/nokogiri/html.rb +38 -27
- data/lib/nokogiri/{html → html4}/builder.rb +4 -2
- data/lib/nokogiri/{html → html4}/document.rb +103 -105
- data/lib/nokogiri/html4/document_fragment.rb +54 -0
- data/lib/nokogiri/{html → html4}/element_description.rb +3 -1
- data/lib/nokogiri/html4/element_description_defaults.rb +578 -0
- data/lib/nokogiri/{html → html4}/entity_lookup.rb +4 -2
- data/lib/nokogiri/{html → html4}/sax/parser.rb +17 -16
- data/lib/nokogiri/html4/sax/parser_context.rb +20 -0
- data/lib/nokogiri/{html → html4}/sax/push_parser.rb +12 -11
- data/lib/nokogiri/html4.rb +46 -0
- data/lib/nokogiri/html5/document.rb +91 -0
- data/lib/nokogiri/html5/document_fragment.rb +83 -0
- data/lib/nokogiri/html5/node.rb +100 -0
- data/lib/nokogiri/html5.rb +478 -0
- data/lib/nokogiri/jruby/dependencies.rb +21 -0
- data/lib/nokogiri/syntax_error.rb +2 -0
- data/lib/nokogiri/version/constant.rb +6 -0
- data/lib/nokogiri/version/info.rb +222 -0
- data/lib/nokogiri/version.rb +3 -108
- data/lib/nokogiri/xml/attr.rb +6 -3
- data/lib/nokogiri/xml/attribute_decl.rb +3 -1
- data/lib/nokogiri/xml/builder.rb +97 -53
- data/lib/nokogiri/xml/cdata.rb +3 -1
- data/lib/nokogiri/xml/character_data.rb +2 -0
- data/lib/nokogiri/xml/document.rb +224 -86
- data/lib/nokogiri/xml/document_fragment.rb +57 -44
- data/lib/nokogiri/xml/dtd.rb +4 -2
- data/lib/nokogiri/xml/element_content.rb +2 -0
- data/lib/nokogiri/xml/element_decl.rb +3 -1
- data/lib/nokogiri/xml/entity_decl.rb +4 -2
- data/lib/nokogiri/xml/entity_reference.rb +2 -0
- data/lib/nokogiri/xml/namespace.rb +3 -0
- data/lib/nokogiri/xml/node/save_options.rb +10 -5
- data/lib/nokogiri/xml/node.rb +895 -377
- data/lib/nokogiri/xml/node_set.rb +92 -65
- data/lib/nokogiri/xml/notation.rb +13 -0
- data/lib/nokogiri/xml/parse_options.rb +22 -8
- data/lib/nokogiri/xml/pp/character_data.rb +9 -6
- data/lib/nokogiri/xml/pp/node.rb +25 -26
- data/lib/nokogiri/xml/pp.rb +4 -2
- data/lib/nokogiri/xml/processing_instruction.rb +3 -1
- data/lib/nokogiri/xml/reader.rb +21 -28
- data/lib/nokogiri/xml/relax_ng.rb +8 -2
- data/lib/nokogiri/xml/sax/document.rb +45 -49
- data/lib/nokogiri/xml/sax/parser.rb +38 -34
- data/lib/nokogiri/xml/sax/parser_context.rb +8 -3
- data/lib/nokogiri/xml/sax/push_parser.rb +6 -5
- data/lib/nokogiri/xml/sax.rb +6 -4
- data/lib/nokogiri/xml/schema.rb +19 -9
- data/lib/nokogiri/xml/searchable.rb +112 -72
- data/lib/nokogiri/xml/syntax_error.rb +6 -4
- data/lib/nokogiri/xml/text.rb +2 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +4 -2
- data/lib/nokogiri/xml/xpath.rb +15 -4
- data/lib/nokogiri/xml/xpath_context.rb +3 -3
- data/lib/nokogiri/xml.rb +38 -37
- data/lib/nokogiri/xslt/stylesheet.rb +3 -1
- data/lib/nokogiri/xslt.rb +29 -20
- data/lib/nokogiri.rb +49 -65
- data/lib/xsd/xmlparser/nokogiri.rb +26 -24
- data/patches/libxml2/0001-Remove-script-macro-support.patch +40 -0
- data/patches/libxml2/0002-Update-entities-to-remove-handling-of-ssi.patch +44 -0
- data/patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch +25 -0
- data/patches/libxml2/0005-avoid-isnan-isinf.patch +81 -0
- data/patches/libxml2/0009-allow-wildcard-namespaces.patch +77 -0
- data/patches/libxslt/0001-update-automake-files-for-arm64.patch +3037 -0
- data/ports/archives/libxml2-2.10.3.tar.xz +0 -0
- data/ports/archives/libxslt-1.1.37.tar.xz +0 -0
- metadata +211 -266
- data/.autotest +0 -22
- data/.cross_rubies +0 -8
- data/.editorconfig +0 -17
- data/.gemtest +0 -0
- data/.travis.yml +0 -63
- data/CHANGELOG.md +0 -1368
- data/CONTRIBUTING.md +0 -42
- data/C_CODING_STYLE.rdoc +0 -33
- data/Gemfile-libxml-ruby +0 -3
- data/Manifest.txt +0 -370
- data/ROADMAP.md +0 -111
- data/Rakefile +0 -348
- data/SECURITY.md +0 -19
- data/STANDARD_RESPONSES.md +0 -47
- data/Y_U_NO_GEMSPEC.md +0 -155
- data/appveyor.yml +0 -29
- data/build_all +0 -44
- data/ext/nokogiri/html_document.c +0 -170
- data/ext/nokogiri/html_document.h +0 -10
- data/ext/nokogiri/html_element_description.c +0 -279
- data/ext/nokogiri/html_element_description.h +0 -10
- data/ext/nokogiri/html_entity_lookup.c +0 -32
- data/ext/nokogiri/html_entity_lookup.h +0 -8
- data/ext/nokogiri/html_sax_parser_context.c +0 -116
- data/ext/nokogiri/html_sax_parser_context.h +0 -11
- data/ext/nokogiri/html_sax_push_parser.c +0 -87
- data/ext/nokogiri/html_sax_push_parser.h +0 -9
- data/ext/nokogiri/xml_attr.h +0 -9
- data/ext/nokogiri/xml_attribute_decl.h +0 -9
- data/ext/nokogiri/xml_cdata.h +0 -9
- data/ext/nokogiri/xml_comment.h +0 -9
- data/ext/nokogiri/xml_document.h +0 -23
- data/ext/nokogiri/xml_document_fragment.h +0 -10
- data/ext/nokogiri/xml_dtd.h +0 -10
- data/ext/nokogiri/xml_element_content.h +0 -10
- data/ext/nokogiri/xml_element_decl.h +0 -9
- data/ext/nokogiri/xml_encoding_handler.h +0 -8
- data/ext/nokogiri/xml_entity_decl.h +0 -10
- data/ext/nokogiri/xml_entity_reference.h +0 -9
- data/ext/nokogiri/xml_io.c +0 -61
- data/ext/nokogiri/xml_io.h +0 -11
- data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
- data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
- data/ext/nokogiri/xml_namespace.h +0 -15
- data/ext/nokogiri/xml_node.h +0 -13
- data/ext/nokogiri/xml_node_set.h +0 -12
- data/ext/nokogiri/xml_processing_instruction.h +0 -9
- data/ext/nokogiri/xml_reader.h +0 -10
- data/ext/nokogiri/xml_relax_ng.h +0 -9
- data/ext/nokogiri/xml_sax_parser.h +0 -39
- data/ext/nokogiri/xml_sax_parser_context.h +0 -10
- data/ext/nokogiri/xml_sax_push_parser.h +0 -9
- data/ext/nokogiri/xml_schema.h +0 -9
- data/ext/nokogiri/xml_syntax_error.h +0 -13
- data/ext/nokogiri/xml_text.h +0 -9
- data/ext/nokogiri/xml_xpath_context.h +0 -10
- data/ext/nokogiri/xslt_stylesheet.h +0 -14
- data/lib/nokogiri/html/document_fragment.rb +0 -49
- data/lib/nokogiri/html/element_description_defaults.rb +0 -671
- data/lib/nokogiri/html/sax/parser_context.rb +0 -16
- data/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch +0 -78
- data/patches/libxml2/0002-Fix-nullptr-deref-with-XPath-logic-ops.patch +0 -54
- data/patches/libxml2/0003-Fix-infinite-loop-in-LZMA-decompression.patch +0 -50
- data/patches/sort-patches-by-date +0 -25
- data/ports/archives/libxml2-2.9.8.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.32.tar.gz +0 -0
- data/suppressions/README.txt +0 -1
- data/suppressions/nokogiri_ruby-2.supp +0 -10
- data/tasks/test.rb +0 -100
- data/test/css/test_nthiness.rb +0 -226
- data/test/css/test_parser.rb +0 -386
- data/test/css/test_tokenizer.rb +0 -215
- data/test/css/test_xpath_visitor.rb +0 -96
- data/test/decorators/test_slop.rb +0 -23
- data/test/files/2ch.html +0 -108
- data/test/files/GH_1042.html +0 -18
- data/test/files/address_book.rlx +0 -12
- data/test/files/address_book.xml +0 -10
- data/test/files/atom.xml +0 -344
- data/test/files/bar/bar.xsd +0 -4
- data/test/files/bogus.xml +0 -0
- data/test/files/dont_hurt_em_why.xml +0 -422
- data/test/files/encoding.html +0 -82
- data/test/files/encoding.xhtml +0 -84
- data/test/files/exslt.xml +0 -8
- data/test/files/exslt.xslt +0 -35
- data/test/files/foo/foo.xsd +0 -4
- data/test/files/metacharset.html +0 -10
- data/test/files/namespace_pressure_test.xml +0 -1684
- data/test/files/noencoding.html +0 -47
- data/test/files/po.xml +0 -32
- data/test/files/po.xsd +0 -66
- data/test/files/saml/saml20assertion_schema.xsd +0 -283
- data/test/files/saml/saml20protocol_schema.xsd +0 -302
- data/test/files/saml/xenc_schema.xsd +0 -146
- data/test/files/saml/xmldsig_schema.xsd +0 -318
- data/test/files/shift_jis.html +0 -10
- data/test/files/shift_jis.xml +0 -5
- data/test/files/shift_jis_no_charset.html +0 -9
- data/test/files/slow-xpath.xml +0 -25509
- data/test/files/snuggles.xml +0 -3
- data/test/files/staff.dtd +0 -10
- data/test/files/staff.xml +0 -59
- data/test/files/staff.xslt +0 -32
- data/test/files/test_document_url/bar.xml +0 -2
- data/test/files/test_document_url/document.dtd +0 -4
- data/test/files/test_document_url/document.xml +0 -6
- data/test/files/tlm.html +0 -851
- data/test/files/to_be_xincluded.xml +0 -2
- data/test/files/valid_bar.xml +0 -2
- data/test/files/xinclude.xml +0 -4
- data/test/helper.rb +0 -271
- data/test/html/sax/test_parser.rb +0 -168
- data/test/html/sax/test_parser_context.rb +0 -46
- data/test/html/sax/test_parser_text.rb +0 -163
- data/test/html/sax/test_push_parser.rb +0 -87
- data/test/html/test_attributes.rb +0 -85
- data/test/html/test_builder.rb +0 -164
- data/test/html/test_document.rb +0 -712
- data/test/html/test_document_encoding.rb +0 -143
- data/test/html/test_document_fragment.rb +0 -310
- data/test/html/test_element_description.rb +0 -105
- data/test/html/test_named_characters.rb +0 -14
- data/test/html/test_node.rb +0 -212
- data/test/html/test_node_encoding.rb +0 -91
- data/test/namespaces/test_additional_namespaces_in_builder_doc.rb +0 -14
- data/test/namespaces/test_namespaces_aliased_default.rb +0 -24
- data/test/namespaces/test_namespaces_in_builder_doc.rb +0 -75
- data/test/namespaces/test_namespaces_in_cloned_doc.rb +0 -31
- data/test/namespaces/test_namespaces_in_created_doc.rb +0 -75
- data/test/namespaces/test_namespaces_in_parsed_doc.rb +0 -80
- data/test/namespaces/test_namespaces_preservation.rb +0 -31
- data/test/test_convert_xpath.rb +0 -135
- data/test/test_css_cache.rb +0 -47
- data/test/test_encoding_handler.rb +0 -48
- data/test/test_memory_leak.rb +0 -156
- data/test/test_nokogiri.rb +0 -138
- data/test/test_soap4r_sax.rb +0 -52
- data/test/test_xslt_transforms.rb +0 -314
- data/test/xml/node/test_save_options.rb +0 -28
- data/test/xml/node/test_subclass.rb +0 -44
- data/test/xml/sax/test_parser.rb +0 -402
- data/test/xml/sax/test_parser_context.rb +0 -115
- data/test/xml/sax/test_parser_text.rb +0 -202
- data/test/xml/sax/test_push_parser.rb +0 -265
- data/test/xml/test_attr.rb +0 -74
- data/test/xml/test_attribute_decl.rb +0 -86
- data/test/xml/test_builder.rb +0 -341
- data/test/xml/test_c14n.rb +0 -180
- data/test/xml/test_cdata.rb +0 -54
- data/test/xml/test_comment.rb +0 -40
- data/test/xml/test_document.rb +0 -982
- data/test/xml/test_document_encoding.rb +0 -31
- data/test/xml/test_document_fragment.rb +0 -298
- data/test/xml/test_dtd.rb +0 -187
- data/test/xml/test_dtd_encoding.rb +0 -31
- data/test/xml/test_element_content.rb +0 -56
- data/test/xml/test_element_decl.rb +0 -73
- data/test/xml/test_entity_decl.rb +0 -122
- data/test/xml/test_entity_reference.rb +0 -262
- data/test/xml/test_namespace.rb +0 -96
- data/test/xml/test_node.rb +0 -1325
- data/test/xml/test_node_attributes.rb +0 -115
- data/test/xml/test_node_encoding.rb +0 -75
- data/test/xml/test_node_inheritance.rb +0 -32
- data/test/xml/test_node_reparenting.rb +0 -592
- data/test/xml/test_node_set.rb +0 -809
- data/test/xml/test_parse_options.rb +0 -64
- data/test/xml/test_processing_instruction.rb +0 -30
- data/test/xml/test_reader.rb +0 -620
- data/test/xml/test_reader_encoding.rb +0 -134
- data/test/xml/test_relax_ng.rb +0 -60
- data/test/xml/test_schema.rb +0 -142
- data/test/xml/test_syntax_error.rb +0 -36
- data/test/xml/test_text.rb +0 -60
- data/test/xml/test_unparented_node.rb +0 -483
- data/test/xml/test_xinclude.rb +0 -83
- data/test/xml/test_xpath.rb +0 -470
- data/test/xslt/test_custom_functions.rb +0 -133
- data/test/xslt/test_exception_handling.rb +0 -37
@@ -0,0 +1,55 @@
|
|
1
|
+
%{
|
2
|
+
#include "replacement.h"
|
3
|
+
#include "macros.h"
|
4
|
+
#include "ascii.h"
|
5
|
+
%}
|
6
|
+
|
7
|
+
%ignore-case
|
8
|
+
%struct-type
|
9
|
+
%omit-struct-type
|
10
|
+
%compare-lengths
|
11
|
+
%readonly-tables
|
12
|
+
%null-strings
|
13
|
+
%includes
|
14
|
+
%define lookup-function-name gumbo_get_svg_tag_replacement
|
15
|
+
%define slot-name from
|
16
|
+
%define initializer-suffix ,(char*)0
|
17
|
+
StringReplacement;
|
18
|
+
|
19
|
+
%%
|
20
|
+
"altglyph", "altGlyph"
|
21
|
+
"altglyphdef", "altGlyphDef"
|
22
|
+
"altglyphitem", "altGlyphItem"
|
23
|
+
"animatecolor", "animateColor"
|
24
|
+
"animatemotion", "animateMotion"
|
25
|
+
"animatetransform", "animateTransform"
|
26
|
+
"clippath", "clipPath"
|
27
|
+
"feblend", "feBlend"
|
28
|
+
"fecolormatrix", "feColorMatrix"
|
29
|
+
"fecomponenttransfer", "feComponentTransfer"
|
30
|
+
"fecomposite", "feComposite"
|
31
|
+
"feconvolvematrix", "feConvolveMatrix"
|
32
|
+
"fediffuselighting", "feDiffuseLighting"
|
33
|
+
"fedisplacementmap", "feDisplacementMap"
|
34
|
+
"fedistantlight", "feDistantLight"
|
35
|
+
"feflood", "feFlood"
|
36
|
+
"fefunca", "feFuncA"
|
37
|
+
"fefuncb", "feFuncB"
|
38
|
+
"fefuncg", "feFuncG"
|
39
|
+
"fefuncr", "feFuncR"
|
40
|
+
"fegaussianblur", "feGaussianBlur"
|
41
|
+
"feimage", "feImage"
|
42
|
+
"femerge", "feMerge"
|
43
|
+
"femergenode", "feMergeNode"
|
44
|
+
"femorphology", "feMorphology"
|
45
|
+
"feoffset", "feOffset"
|
46
|
+
"fepointlight", "fePointLight"
|
47
|
+
"fespecularlighting", "feSpecularLighting"
|
48
|
+
"fespotlight", "feSpotLight"
|
49
|
+
"fetile", "feTile"
|
50
|
+
"feturbulence", "feTurbulence"
|
51
|
+
"foreignobject", "foreignObject"
|
52
|
+
"glyphref", "glyphRef"
|
53
|
+
"lineargradient", "linearGradient"
|
54
|
+
"radialgradient", "radialGradient"
|
55
|
+
"textpath", "textPath"
|
@@ -0,0 +1,222 @@
|
|
1
|
+
/*
|
2
|
+
Copyright 2011 Google Inc.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
#include "gumbo.h"
|
18
|
+
#include "util.h"
|
19
|
+
#include "tag_lookup.h"
|
20
|
+
|
21
|
+
#include <assert.h>
|
22
|
+
#include <string.h>
|
23
|
+
|
24
|
+
static const char kGumboTagNames[GUMBO_TAG_LAST+1][15] = {
|
25
|
+
[GUMBO_TAG_HTML] = "html",
|
26
|
+
[GUMBO_TAG_HEAD] = "head",
|
27
|
+
[GUMBO_TAG_TITLE] = "title",
|
28
|
+
[GUMBO_TAG_BASE] = "base",
|
29
|
+
[GUMBO_TAG_LINK] = "link",
|
30
|
+
[GUMBO_TAG_META] = "meta",
|
31
|
+
[GUMBO_TAG_STYLE] = "style",
|
32
|
+
[GUMBO_TAG_SCRIPT] = "script",
|
33
|
+
[GUMBO_TAG_NOSCRIPT] = "noscript",
|
34
|
+
[GUMBO_TAG_TEMPLATE] = "template",
|
35
|
+
[GUMBO_TAG_BODY] = "body",
|
36
|
+
[GUMBO_TAG_ARTICLE] = "article",
|
37
|
+
[GUMBO_TAG_SECTION] = "section",
|
38
|
+
[GUMBO_TAG_NAV] = "nav",
|
39
|
+
[GUMBO_TAG_ASIDE] = "aside",
|
40
|
+
[GUMBO_TAG_H1] = "h1",
|
41
|
+
[GUMBO_TAG_H2] = "h2",
|
42
|
+
[GUMBO_TAG_H3] = "h3",
|
43
|
+
[GUMBO_TAG_H4] = "h4",
|
44
|
+
[GUMBO_TAG_H5] = "h5",
|
45
|
+
[GUMBO_TAG_H6] = "h6",
|
46
|
+
[GUMBO_TAG_HGROUP] = "hgroup",
|
47
|
+
[GUMBO_TAG_HEADER] = "header",
|
48
|
+
[GUMBO_TAG_FOOTER] = "footer",
|
49
|
+
[GUMBO_TAG_ADDRESS] = "address",
|
50
|
+
[GUMBO_TAG_P] = "p",
|
51
|
+
[GUMBO_TAG_HR] = "hr",
|
52
|
+
[GUMBO_TAG_PRE] = "pre",
|
53
|
+
[GUMBO_TAG_BLOCKQUOTE] = "blockquote",
|
54
|
+
[GUMBO_TAG_OL] = "ol",
|
55
|
+
[GUMBO_TAG_UL] = "ul",
|
56
|
+
[GUMBO_TAG_LI] = "li",
|
57
|
+
[GUMBO_TAG_DL] = "dl",
|
58
|
+
[GUMBO_TAG_DT] = "dt",
|
59
|
+
[GUMBO_TAG_DD] = "dd",
|
60
|
+
[GUMBO_TAG_FIGURE] = "figure",
|
61
|
+
[GUMBO_TAG_FIGCAPTION] = "figcaption",
|
62
|
+
[GUMBO_TAG_MAIN] = "main",
|
63
|
+
[GUMBO_TAG_DIV] = "div",
|
64
|
+
[GUMBO_TAG_A] = "a",
|
65
|
+
[GUMBO_TAG_EM] = "em",
|
66
|
+
[GUMBO_TAG_STRONG] = "strong",
|
67
|
+
[GUMBO_TAG_SMALL] = "small",
|
68
|
+
[GUMBO_TAG_S] = "s",
|
69
|
+
[GUMBO_TAG_CITE] = "cite",
|
70
|
+
[GUMBO_TAG_Q] = "q",
|
71
|
+
[GUMBO_TAG_DFN] = "dfn",
|
72
|
+
[GUMBO_TAG_ABBR] = "abbr",
|
73
|
+
[GUMBO_TAG_DATA] = "data",
|
74
|
+
[GUMBO_TAG_TIME] = "time",
|
75
|
+
[GUMBO_TAG_CODE] = "code",
|
76
|
+
[GUMBO_TAG_VAR] = "var",
|
77
|
+
[GUMBO_TAG_SAMP] = "samp",
|
78
|
+
[GUMBO_TAG_KBD] = "kbd",
|
79
|
+
[GUMBO_TAG_SUB] = "sub",
|
80
|
+
[GUMBO_TAG_SUP] = "sup",
|
81
|
+
[GUMBO_TAG_I] = "i",
|
82
|
+
[GUMBO_TAG_B] = "b",
|
83
|
+
[GUMBO_TAG_U] = "u",
|
84
|
+
[GUMBO_TAG_MARK] = "mark",
|
85
|
+
[GUMBO_TAG_RUBY] = "ruby",
|
86
|
+
[GUMBO_TAG_RT] = "rt",
|
87
|
+
[GUMBO_TAG_RP] = "rp",
|
88
|
+
[GUMBO_TAG_BDI] = "bdi",
|
89
|
+
[GUMBO_TAG_BDO] = "bdo",
|
90
|
+
[GUMBO_TAG_SPAN] = "span",
|
91
|
+
[GUMBO_TAG_BR] = "br",
|
92
|
+
[GUMBO_TAG_WBR] = "wbr",
|
93
|
+
[GUMBO_TAG_INS] = "ins",
|
94
|
+
[GUMBO_TAG_DEL] = "del",
|
95
|
+
[GUMBO_TAG_IMAGE] = "image",
|
96
|
+
[GUMBO_TAG_IMG] = "img",
|
97
|
+
[GUMBO_TAG_IFRAME] = "iframe",
|
98
|
+
[GUMBO_TAG_EMBED] = "embed",
|
99
|
+
[GUMBO_TAG_OBJECT] = "object",
|
100
|
+
[GUMBO_TAG_PARAM] = "param",
|
101
|
+
[GUMBO_TAG_VIDEO] = "video",
|
102
|
+
[GUMBO_TAG_AUDIO] = "audio",
|
103
|
+
[GUMBO_TAG_SOURCE] = "source",
|
104
|
+
[GUMBO_TAG_TRACK] = "track",
|
105
|
+
[GUMBO_TAG_CANVAS] = "canvas",
|
106
|
+
[GUMBO_TAG_MAP] = "map",
|
107
|
+
[GUMBO_TAG_AREA] = "area",
|
108
|
+
[GUMBO_TAG_MATH] = "math",
|
109
|
+
[GUMBO_TAG_MI] = "mi",
|
110
|
+
[GUMBO_TAG_MO] = "mo",
|
111
|
+
[GUMBO_TAG_MN] = "mn",
|
112
|
+
[GUMBO_TAG_MS] = "ms",
|
113
|
+
[GUMBO_TAG_MTEXT] = "mtext",
|
114
|
+
[GUMBO_TAG_MGLYPH] = "mglyph",
|
115
|
+
[GUMBO_TAG_MALIGNMARK] = "malignmark",
|
116
|
+
[GUMBO_TAG_ANNOTATION_XML] = "annotation-xml",
|
117
|
+
[GUMBO_TAG_SVG] = "svg",
|
118
|
+
[GUMBO_TAG_FOREIGNOBJECT] = "foreignobject",
|
119
|
+
[GUMBO_TAG_DESC] = "desc",
|
120
|
+
[GUMBO_TAG_TABLE] = "table",
|
121
|
+
[GUMBO_TAG_CAPTION] = "caption",
|
122
|
+
[GUMBO_TAG_COLGROUP] = "colgroup",
|
123
|
+
[GUMBO_TAG_COL] = "col",
|
124
|
+
[GUMBO_TAG_TBODY] = "tbody",
|
125
|
+
[GUMBO_TAG_THEAD] = "thead",
|
126
|
+
[GUMBO_TAG_TFOOT] = "tfoot",
|
127
|
+
[GUMBO_TAG_TR] = "tr",
|
128
|
+
[GUMBO_TAG_TD] = "td",
|
129
|
+
[GUMBO_TAG_TH] = "th",
|
130
|
+
[GUMBO_TAG_FORM] = "form",
|
131
|
+
[GUMBO_TAG_FIELDSET] = "fieldset",
|
132
|
+
[GUMBO_TAG_LEGEND] = "legend",
|
133
|
+
[GUMBO_TAG_LABEL] = "label",
|
134
|
+
[GUMBO_TAG_INPUT] = "input",
|
135
|
+
[GUMBO_TAG_BUTTON] = "button",
|
136
|
+
[GUMBO_TAG_SELECT] = "select",
|
137
|
+
[GUMBO_TAG_DATALIST] = "datalist",
|
138
|
+
[GUMBO_TAG_OPTGROUP] = "optgroup",
|
139
|
+
[GUMBO_TAG_OPTION] = "option",
|
140
|
+
[GUMBO_TAG_TEXTAREA] = "textarea",
|
141
|
+
[GUMBO_TAG_KEYGEN] = "keygen",
|
142
|
+
[GUMBO_TAG_OUTPUT] = "output",
|
143
|
+
[GUMBO_TAG_PROGRESS] = "progress",
|
144
|
+
[GUMBO_TAG_METER] = "meter",
|
145
|
+
[GUMBO_TAG_DETAILS] = "details",
|
146
|
+
[GUMBO_TAG_SUMMARY] = "summary",
|
147
|
+
[GUMBO_TAG_MENU] = "menu",
|
148
|
+
[GUMBO_TAG_MENUITEM] = "menuitem",
|
149
|
+
[GUMBO_TAG_APPLET] = "applet",
|
150
|
+
[GUMBO_TAG_ACRONYM] = "acronym",
|
151
|
+
[GUMBO_TAG_BGSOUND] = "bgsound",
|
152
|
+
[GUMBO_TAG_DIR] = "dir",
|
153
|
+
[GUMBO_TAG_FRAME] = "frame",
|
154
|
+
[GUMBO_TAG_FRAMESET] = "frameset",
|
155
|
+
[GUMBO_TAG_NOFRAMES] = "noframes",
|
156
|
+
[GUMBO_TAG_LISTING] = "listing",
|
157
|
+
[GUMBO_TAG_XMP] = "xmp",
|
158
|
+
[GUMBO_TAG_NEXTID] = "nextid",
|
159
|
+
[GUMBO_TAG_NOEMBED] = "noembed",
|
160
|
+
[GUMBO_TAG_PLAINTEXT] = "plaintext",
|
161
|
+
[GUMBO_TAG_RB] = "rb",
|
162
|
+
[GUMBO_TAG_STRIKE] = "strike",
|
163
|
+
[GUMBO_TAG_BASEFONT] = "basefont",
|
164
|
+
[GUMBO_TAG_BIG] = "big",
|
165
|
+
[GUMBO_TAG_BLINK] = "blink",
|
166
|
+
[GUMBO_TAG_CENTER] = "center",
|
167
|
+
[GUMBO_TAG_FONT] = "font",
|
168
|
+
[GUMBO_TAG_MARQUEE] = "marquee",
|
169
|
+
[GUMBO_TAG_MULTICOL] = "multicol",
|
170
|
+
[GUMBO_TAG_NOBR] = "nobr",
|
171
|
+
[GUMBO_TAG_SPACER] = "spacer",
|
172
|
+
[GUMBO_TAG_TT] = "tt",
|
173
|
+
[GUMBO_TAG_RTC] = "rtc",
|
174
|
+
[GUMBO_TAG_DIALOG] = "dialog",
|
175
|
+
|
176
|
+
[GUMBO_TAG_UNKNOWN] = "",
|
177
|
+
[GUMBO_TAG_LAST] = "",
|
178
|
+
};
|
179
|
+
|
180
|
+
const char* gumbo_normalized_tagname(GumboTag tag) {
|
181
|
+
assert(tag <= GUMBO_TAG_LAST);
|
182
|
+
const char *tagname = kGumboTagNames[tag];
|
183
|
+
assert(tagname);
|
184
|
+
return tagname;
|
185
|
+
}
|
186
|
+
|
187
|
+
void gumbo_tag_from_original_text(GumboStringPiece* text) {
|
188
|
+
if (text->data == NULL) {
|
189
|
+
return;
|
190
|
+
}
|
191
|
+
|
192
|
+
assert(text->length >= 2);
|
193
|
+
assert(text->data[0] == '<');
|
194
|
+
assert(text->data[text->length - 1] == '>');
|
195
|
+
|
196
|
+
if (text->data[1] == '/') {
|
197
|
+
// End tag
|
198
|
+
assert(text->length >= 3);
|
199
|
+
text->data += 2; // Move past </
|
200
|
+
text->length -= 3;
|
201
|
+
} else {
|
202
|
+
// Start tag
|
203
|
+
text->data += 1; // Move past <
|
204
|
+
text->length -= 2;
|
205
|
+
for (const char* c = text->data; c != text->data + text->length; ++c) {
|
206
|
+
switch (*c) {
|
207
|
+
case '\t':
|
208
|
+
case '\n':
|
209
|
+
case '\f':
|
210
|
+
case ' ':
|
211
|
+
case '/':
|
212
|
+
text->length = c - text->data;
|
213
|
+
return;
|
214
|
+
}
|
215
|
+
}
|
216
|
+
}
|
217
|
+
}
|
218
|
+
|
219
|
+
GumboTag gumbo_tagn_enum(const char *tagname, size_t tagname_length) {
|
220
|
+
const TagHashSlot *slot = gumbo_tag_lookup(tagname, tagname_length);
|
221
|
+
return slot ? slot->tag : GUMBO_TAG_UNKNOWN;
|
222
|
+
}
|
@@ -0,0 +1,382 @@
|
|
1
|
+
/* ANSI-C code produced by gperf version 3.1 */
|
2
|
+
/* Command-line: gperf -m100 lib/tag_lookup.gperf */
|
3
|
+
/* Computed positions: -k'1-2,$' */
|
4
|
+
/* Filtered by: mk/gperf-filter.sed */
|
5
|
+
|
6
|
+
#include "tag_lookup.h"
|
7
|
+
#include "macros.h"
|
8
|
+
#include "ascii.h"
|
9
|
+
#include <string.h>
|
10
|
+
|
11
|
+
#define TOTAL_KEYWORDS 150
|
12
|
+
#define MIN_WORD_LENGTH 1
|
13
|
+
#define MAX_WORD_LENGTH 14
|
14
|
+
#define MIN_HASH_VALUE 9
|
15
|
+
#define MAX_HASH_VALUE 271
|
16
|
+
/* maximum key range = 263, duplicates = 0 */
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
static inline unsigned int
|
21
|
+
hash (register const char *str, register size_t len)
|
22
|
+
{
|
23
|
+
static const unsigned short asso_values[] =
|
24
|
+
{
|
25
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
26
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
27
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
28
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
29
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 9,
|
30
|
+
7, 6, 4, 4, 3, 4, 3, 3, 272, 272,
|
31
|
+
272, 272, 272, 272, 272, 70, 83, 152, 7, 16,
|
32
|
+
61, 98, 5, 76, 102, 126, 12, 19, 54, 54,
|
33
|
+
31, 97, 3, 4, 9, 33, 136, 113, 86, 15,
|
34
|
+
272, 272, 272, 272, 272, 272, 272, 70, 83, 152,
|
35
|
+
7, 16, 61, 98, 5, 76, 102, 126, 12, 19,
|
36
|
+
54, 54, 31, 97, 3, 4, 9, 33, 136, 113,
|
37
|
+
86, 15, 272, 272, 272, 272, 272, 272, 272, 272,
|
38
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
39
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
40
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
41
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
42
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
43
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
44
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
45
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
46
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
47
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
48
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
49
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272, 272,
|
50
|
+
272, 272, 272, 272, 272, 272, 272, 272, 272
|
51
|
+
};
|
52
|
+
register unsigned int hval = len;
|
53
|
+
|
54
|
+
switch (hval)
|
55
|
+
{
|
56
|
+
default:
|
57
|
+
hval += asso_values[(unsigned char)str[1]+3];
|
58
|
+
/*FALLTHROUGH*/
|
59
|
+
case 1:
|
60
|
+
hval += asso_values[(unsigned char)str[0]];
|
61
|
+
break;
|
62
|
+
}
|
63
|
+
return hval + asso_values[(unsigned char)str[len - 1]];
|
64
|
+
}
|
65
|
+
|
66
|
+
const TagHashSlot *
|
67
|
+
gumbo_tag_lookup (register const char *str, register size_t len)
|
68
|
+
{
|
69
|
+
static const unsigned char lengthtable[] =
|
70
|
+
{
|
71
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 2,
|
72
|
+
2, 2, 2, 6, 2, 6, 2, 4, 0, 7, 6, 3, 0, 3,
|
73
|
+
0, 6, 6, 8, 5, 0, 0, 4, 5, 5, 8, 0, 2, 4,
|
74
|
+
5, 2, 0, 5, 4, 2, 0, 7, 0, 8, 5, 0, 0, 0,
|
75
|
+
0, 0, 0, 5, 3, 4, 5, 1, 4, 0, 4, 1, 2, 8,
|
76
|
+
7, 7, 6, 6, 8, 2, 8, 4, 2, 0, 6, 0, 0, 3,
|
77
|
+
4, 6, 13, 4, 4, 6, 8, 0, 8, 4, 0, 6, 0, 8,
|
78
|
+
4, 5, 0, 2, 2, 9, 2, 4, 0, 8, 4, 2, 4, 8,
|
79
|
+
7, 0, 2, 5, 2, 0, 6, 0, 3, 2, 2, 6, 3, 8,
|
80
|
+
7, 2, 5, 7, 0, 2, 6, 2, 4, 3, 0, 10, 5, 6,
|
81
|
+
3, 1, 2, 0, 6, 0, 5, 5, 0, 3, 0, 3, 3, 1,
|
82
|
+
4, 6, 4, 7, 3, 0, 0, 2, 10, 10, 0, 0, 6, 1,
|
83
|
+
4, 6, 3, 0, 2, 5, 6, 4, 3, 4, 0, 7, 3, 0,
|
84
|
+
0, 0, 4, 0, 0, 5, 0, 0, 0, 6, 0, 14, 8, 1,
|
85
|
+
3, 0, 0, 7, 3, 0, 0, 0, 0, 0, 0, 5, 3, 0,
|
86
|
+
0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 7, 6, 0, 0,
|
87
|
+
0, 0, 0, 5, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0,
|
88
|
+
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
89
|
+
0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0,
|
90
|
+
0, 0, 5, 0, 0, 3
|
91
|
+
};
|
92
|
+
static const TagHashSlot wordlist[] =
|
93
|
+
{
|
94
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
95
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
96
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
97
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
98
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
99
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
100
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
101
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
102
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
103
|
+
{"s", GUMBO_TAG_S},
|
104
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
105
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
106
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
107
|
+
{"h6", GUMBO_TAG_H6},
|
108
|
+
{"h5", GUMBO_TAG_H5},
|
109
|
+
{"h4", GUMBO_TAG_H4},
|
110
|
+
{"h3", GUMBO_TAG_H3},
|
111
|
+
{"spacer", GUMBO_TAG_SPACER},
|
112
|
+
{"h2", GUMBO_TAG_H2},
|
113
|
+
{"header", GUMBO_TAG_HEADER},
|
114
|
+
{"h1", GUMBO_TAG_H1},
|
115
|
+
{"head", GUMBO_TAG_HEAD},
|
116
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
117
|
+
{"details", GUMBO_TAG_DETAILS},
|
118
|
+
{"select", GUMBO_TAG_SELECT},
|
119
|
+
{"dir", GUMBO_TAG_DIR},
|
120
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
121
|
+
{"del", GUMBO_TAG_DEL},
|
122
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
123
|
+
{"source", GUMBO_TAG_SOURCE},
|
124
|
+
{"legend", GUMBO_TAG_LEGEND},
|
125
|
+
{"datalist", GUMBO_TAG_DATALIST},
|
126
|
+
{"meter", GUMBO_TAG_METER},
|
127
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
128
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
129
|
+
{"math", GUMBO_TAG_MATH},
|
130
|
+
{"label", GUMBO_TAG_LABEL},
|
131
|
+
{"table", GUMBO_TAG_TABLE},
|
132
|
+
{"template", GUMBO_TAG_TEMPLATE},
|
133
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
134
|
+
{"rp", GUMBO_TAG_RP},
|
135
|
+
{"time", GUMBO_TAG_TIME},
|
136
|
+
{"title", GUMBO_TAG_TITLE},
|
137
|
+
{"hr", GUMBO_TAG_HR},
|
138
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
139
|
+
{"tbody", GUMBO_TAG_TBODY},
|
140
|
+
{"samp", GUMBO_TAG_SAMP},
|
141
|
+
{"tr", GUMBO_TAG_TR},
|
142
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
143
|
+
{"marquee", GUMBO_TAG_MARQUEE},
|
144
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
145
|
+
{"menuitem", GUMBO_TAG_MENUITEM},
|
146
|
+
{"small", GUMBO_TAG_SMALL},
|
147
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
148
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
149
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
150
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
151
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
152
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
153
|
+
{"embed", GUMBO_TAG_EMBED},
|
154
|
+
{"map", GUMBO_TAG_MAP},
|
155
|
+
{"menu", GUMBO_TAG_MENU},
|
156
|
+
{"param", GUMBO_TAG_PARAM},
|
157
|
+
{"p", GUMBO_TAG_P},
|
158
|
+
{"nobr", GUMBO_TAG_NOBR},
|
159
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
160
|
+
{"span", GUMBO_TAG_SPAN},
|
161
|
+
{"u", GUMBO_TAG_U},
|
162
|
+
{"em", GUMBO_TAG_EM},
|
163
|
+
{"noframes", GUMBO_TAG_NOFRAMES},
|
164
|
+
{"section", GUMBO_TAG_SECTION},
|
165
|
+
{"noembed", GUMBO_TAG_NOEMBED},
|
166
|
+
{"nextid", GUMBO_TAG_NEXTID},
|
167
|
+
{"footer", GUMBO_TAG_FOOTER},
|
168
|
+
{"noscript", GUMBO_TAG_NOSCRIPT},
|
169
|
+
{"dl", GUMBO_TAG_DL},
|
170
|
+
{"progress", GUMBO_TAG_PROGRESS},
|
171
|
+
{"font", GUMBO_TAG_FONT},
|
172
|
+
{"mo", GUMBO_TAG_MO},
|
173
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
174
|
+
{"script", GUMBO_TAG_SCRIPT},
|
175
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
176
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
177
|
+
{"pre", GUMBO_TAG_PRE},
|
178
|
+
{"main", GUMBO_TAG_MAIN},
|
179
|
+
{"object", GUMBO_TAG_OBJECT},
|
180
|
+
{"foreignobject", GUMBO_TAG_FOREIGNOBJECT},
|
181
|
+
{"form", GUMBO_TAG_FORM},
|
182
|
+
{"data", GUMBO_TAG_DATA},
|
183
|
+
{"applet", GUMBO_TAG_APPLET},
|
184
|
+
{"fieldset", GUMBO_TAG_FIELDSET},
|
185
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
186
|
+
{"textarea", GUMBO_TAG_TEXTAREA},
|
187
|
+
{"abbr", GUMBO_TAG_ABBR},
|
188
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
189
|
+
{"figure", GUMBO_TAG_FIGURE},
|
190
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
191
|
+
{"optgroup", GUMBO_TAG_OPTGROUP},
|
192
|
+
{"meta", GUMBO_TAG_META},
|
193
|
+
{"tfoot", GUMBO_TAG_TFOOT},
|
194
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
195
|
+
{"ul", GUMBO_TAG_UL},
|
196
|
+
{"li", GUMBO_TAG_LI},
|
197
|
+
{"plaintext", GUMBO_TAG_PLAINTEXT},
|
198
|
+
{"rb", GUMBO_TAG_RB},
|
199
|
+
{"body", GUMBO_TAG_BODY},
|
200
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
201
|
+
{"basefont", GUMBO_TAG_BASEFONT},
|
202
|
+
{"ruby", GUMBO_TAG_RUBY},
|
203
|
+
{"mi", GUMBO_TAG_MI},
|
204
|
+
{"base", GUMBO_TAG_BASE},
|
205
|
+
{"frameset", GUMBO_TAG_FRAMESET},
|
206
|
+
{"summary", GUMBO_TAG_SUMMARY},
|
207
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
208
|
+
{"dd", GUMBO_TAG_DD},
|
209
|
+
{"frame", GUMBO_TAG_FRAME},
|
210
|
+
{"td", GUMBO_TAG_TD},
|
211
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
212
|
+
{"option", GUMBO_TAG_OPTION},
|
213
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
214
|
+
{"svg", GUMBO_TAG_SVG},
|
215
|
+
{"br", GUMBO_TAG_BR},
|
216
|
+
{"ol", GUMBO_TAG_OL},
|
217
|
+
{"dialog", GUMBO_TAG_DIALOG},
|
218
|
+
{"sup", GUMBO_TAG_SUP},
|
219
|
+
{"multicol", GUMBO_TAG_MULTICOL},
|
220
|
+
{"article", GUMBO_TAG_ARTICLE},
|
221
|
+
{"rt", GUMBO_TAG_RT},
|
222
|
+
{"image", GUMBO_TAG_IMAGE},
|
223
|
+
{"listing", GUMBO_TAG_LISTING},
|
224
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
225
|
+
{"dt", GUMBO_TAG_DT},
|
226
|
+
{"mglyph", GUMBO_TAG_MGLYPH},
|
227
|
+
{"tt", GUMBO_TAG_TT},
|
228
|
+
{"html", GUMBO_TAG_HTML},
|
229
|
+
{"wbr", GUMBO_TAG_WBR},
|
230
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
231
|
+
{"figcaption", GUMBO_TAG_FIGCAPTION},
|
232
|
+
{"style", GUMBO_TAG_STYLE},
|
233
|
+
{"strike", GUMBO_TAG_STRIKE},
|
234
|
+
{"dfn", GUMBO_TAG_DFN},
|
235
|
+
{"a", GUMBO_TAG_A},
|
236
|
+
{"th", GUMBO_TAG_TH},
|
237
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
238
|
+
{"hgroup", GUMBO_TAG_HGROUP},
|
239
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
240
|
+
{"mtext", GUMBO_TAG_MTEXT},
|
241
|
+
{"thead", GUMBO_TAG_THEAD},
|
242
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
243
|
+
{"var", GUMBO_TAG_VAR},
|
244
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
245
|
+
{"xmp", GUMBO_TAG_XMP},
|
246
|
+
{"kbd", GUMBO_TAG_KBD},
|
247
|
+
{"i", GUMBO_TAG_I},
|
248
|
+
{"link", GUMBO_TAG_LINK},
|
249
|
+
{"output", GUMBO_TAG_OUTPUT},
|
250
|
+
{"mark", GUMBO_TAG_MARK},
|
251
|
+
{"acronym", GUMBO_TAG_ACRONYM},
|
252
|
+
{"div", GUMBO_TAG_DIV},
|
253
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
254
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
255
|
+
{"ms", GUMBO_TAG_MS},
|
256
|
+
{"malignmark", GUMBO_TAG_MALIGNMARK},
|
257
|
+
{"blockquote", GUMBO_TAG_BLOCKQUOTE},
|
258
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
259
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
260
|
+
{"center", GUMBO_TAG_CENTER},
|
261
|
+
{"b", GUMBO_TAG_B},
|
262
|
+
{"desc", GUMBO_TAG_DESC},
|
263
|
+
{"canvas", GUMBO_TAG_CANVAS},
|
264
|
+
{"col", GUMBO_TAG_COL},
|
265
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
266
|
+
{"mn", GUMBO_TAG_MN},
|
267
|
+
{"track", GUMBO_TAG_TRACK},
|
268
|
+
{"iframe", GUMBO_TAG_IFRAME},
|
269
|
+
{"code", GUMBO_TAG_CODE},
|
270
|
+
{"sub", GUMBO_TAG_SUB},
|
271
|
+
{"area", GUMBO_TAG_AREA},
|
272
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
273
|
+
{"address", GUMBO_TAG_ADDRESS},
|
274
|
+
{"ins", GUMBO_TAG_INS},
|
275
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
276
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
277
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
278
|
+
{"cite", GUMBO_TAG_CITE},
|
279
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
280
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
281
|
+
{"input", GUMBO_TAG_INPUT},
|
282
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
283
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
284
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
285
|
+
{"keygen", GUMBO_TAG_KEYGEN},
|
286
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
287
|
+
{"annotation-xml", GUMBO_TAG_ANNOTATION_XML},
|
288
|
+
{"colgroup", GUMBO_TAG_COLGROUP},
|
289
|
+
{"q", GUMBO_TAG_Q},
|
290
|
+
{"big", GUMBO_TAG_BIG},
|
291
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
292
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
293
|
+
{"bgsound", GUMBO_TAG_BGSOUND},
|
294
|
+
{"nav", GUMBO_TAG_NAV},
|
295
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
296
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
297
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
298
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
299
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
300
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
301
|
+
{"video", GUMBO_TAG_VIDEO},
|
302
|
+
{"img", GUMBO_TAG_IMG},
|
303
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
304
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
305
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
306
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
307
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
308
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
309
|
+
{"audio", GUMBO_TAG_AUDIO},
|
310
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
311
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
312
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
313
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
314
|
+
{"caption", GUMBO_TAG_CAPTION},
|
315
|
+
{"strong", GUMBO_TAG_STRONG},
|
316
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
317
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
318
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
319
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
320
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
321
|
+
{"aside", GUMBO_TAG_ASIDE},
|
322
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
323
|
+
{"button", GUMBO_TAG_BUTTON},
|
324
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
325
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
326
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
327
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
328
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
329
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
330
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
331
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
332
|
+
{"bdo", GUMBO_TAG_BDO},
|
333
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
334
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
335
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
336
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
337
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
338
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
339
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
340
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
341
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
342
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
343
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
344
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
345
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
346
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
347
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
348
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
349
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
350
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
351
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
352
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
353
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
354
|
+
{"bdi", GUMBO_TAG_BDI},
|
355
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
356
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
357
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
358
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
359
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
360
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
361
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
362
|
+
{"blink", GUMBO_TAG_BLINK},
|
363
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
364
|
+
{(char*)0,GUMBO_TAG_UNKNOWN},
|
365
|
+
{"rtc", GUMBO_TAG_RTC}
|
366
|
+
};
|
367
|
+
|
368
|
+
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
369
|
+
{
|
370
|
+
register unsigned int key = hash (str, len);
|
371
|
+
|
372
|
+
if (key <= MAX_HASH_VALUE)
|
373
|
+
if (len == lengthtable[key])
|
374
|
+
{
|
375
|
+
register const char *s = wordlist[key].key;
|
376
|
+
|
377
|
+
if (s && (((unsigned char)*str ^ (unsigned char)*s) & ~32) == 0 && !gumbo_ascii_strncasecmp(str, s, len))
|
378
|
+
return &wordlist[key];
|
379
|
+
}
|
380
|
+
}
|
381
|
+
return 0;
|
382
|
+
}
|