nokogiri 1.10.10 → 1.14.3-aarch64-linux
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 +44 -0
- data/LICENSE-DEPENDENCIES.md +1632 -1022
- data/LICENSE.md +1 -1
- data/README.md +185 -96
- data/bin/nokogiri +63 -50
- data/dependencies.yml +33 -66
- data/ext/nokogiri/depend +38 -358
- data/ext/nokogiri/extconf.rb +819 -421
- data/ext/nokogiri/gumbo.c +594 -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 +114 -0
- data/ext/nokogiri/html4_sax_push_parser.c +95 -0
- data/ext/nokogiri/include/libexslt/exslt.h +108 -0
- data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
- data/ext/nokogiri/include/libexslt/exsltexports.h +63 -0
- data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +306 -0
- data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX.h +204 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX2.h +172 -0
- data/ext/nokogiri/include/libxml2/libxml/c14n.h +128 -0
- data/ext/nokogiri/include/libxml2/libxml/catalog.h +182 -0
- data/ext/nokogiri/include/libxml2/libxml/chvalid.h +230 -0
- data/ext/nokogiri/include/libxml2/libxml/debugXML.h +217 -0
- data/ext/nokogiri/include/libxml2/libxml/dict.h +81 -0
- data/ext/nokogiri/include/libxml2/libxml/encoding.h +232 -0
- data/ext/nokogiri/include/libxml2/libxml/entities.h +153 -0
- data/ext/nokogiri/include/libxml2/libxml/globals.h +499 -0
- data/ext/nokogiri/include/libxml2/libxml/hash.h +236 -0
- data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
- data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +186 -0
- data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +81 -0
- data/ext/nokogiri/include/libxml2/libxml/parser.h +1244 -0
- data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +656 -0
- data/ext/nokogiri/include/libxml2/libxml/pattern.h +100 -0
- data/ext/nokogiri/include/libxml2/libxml/relaxng.h +218 -0
- data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +958 -0
- data/ext/nokogiri/include/libxml2/libxml/schematron.h +142 -0
- data/ext/nokogiri/include/libxml2/libxml/threads.h +91 -0
- data/ext/nokogiri/include/libxml2/libxml/tree.h +1312 -0
- data/ext/nokogiri/include/libxml2/libxml/uri.h +94 -0
- data/ext/nokogiri/include/libxml2/libxml/valid.h +463 -0
- data/ext/nokogiri/include/libxml2/libxml/xinclude.h +129 -0
- data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +368 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +947 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +77 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +226 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +428 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +222 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +88 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +246 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +152 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +202 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +503 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +488 -0
- data/ext/nokogiri/include/libxml2/libxml/xpath.h +575 -0
- data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +632 -0
- data/ext/nokogiri/include/libxml2/libxml/xpointer.h +137 -0
- data/ext/nokogiri/include/libxslt/attributes.h +38 -0
- data/ext/nokogiri/include/libxslt/documents.h +93 -0
- data/ext/nokogiri/include/libxslt/extensions.h +262 -0
- data/ext/nokogiri/include/libxslt/extra.h +72 -0
- data/ext/nokogiri/include/libxslt/functions.h +78 -0
- data/ext/nokogiri/include/libxslt/imports.h +75 -0
- data/ext/nokogiri/include/libxslt/keys.h +53 -0
- data/ext/nokogiri/include/libxslt/namespaces.h +68 -0
- data/ext/nokogiri/include/libxslt/numbersInternals.h +73 -0
- data/ext/nokogiri/include/libxslt/pattern.h +84 -0
- data/ext/nokogiri/include/libxslt/preproc.h +43 -0
- data/ext/nokogiri/include/libxslt/security.h +104 -0
- data/ext/nokogiri/include/libxslt/templates.h +77 -0
- data/ext/nokogiri/include/libxslt/transform.h +207 -0
- data/ext/nokogiri/include/libxslt/variables.h +118 -0
- data/ext/nokogiri/include/libxslt/xslt.h +110 -0
- data/ext/nokogiri/include/libxslt/xsltInternals.h +1982 -0
- data/ext/nokogiri/include/libxslt/xsltconfig.h +179 -0
- data/ext/nokogiri/include/libxslt/xsltexports.h +64 -0
- data/ext/nokogiri/include/libxslt/xsltlocale.h +76 -0
- data/ext/nokogiri/include/libxslt/xsltutils.h +310 -0
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +228 -104
- data/ext/nokogiri/nokogiri.h +204 -90
- data/ext/nokogiri/test_global_handlers.c +40 -0
- data/ext/nokogiri/xml_attr.c +17 -17
- data/ext/nokogiri/xml_attribute_decl.c +22 -22
- data/ext/nokogiri/xml_cdata.c +15 -20
- data/ext/nokogiri/xml_comment.c +19 -26
- data/ext/nokogiri/xml_document.c +306 -225
- data/ext/nokogiri/xml_document_fragment.c +12 -16
- data/ext/nokogiri/xml_dtd.c +64 -58
- data/ext/nokogiri/xml_element_content.c +33 -28
- data/ext/nokogiri/xml_element_decl.c +26 -26
- data/ext/nokogiri/xml_encoding_handler.c +45 -20
- data/ext/nokogiri/xml_entity_decl.c +37 -35
- data/ext/nokogiri/xml_entity_reference.c +16 -18
- data/ext/nokogiri/xml_namespace.c +136 -61
- data/ext/nokogiri/xml_node.c +1344 -672
- data/ext/nokogiri/xml_node_set.c +178 -168
- data/ext/nokogiri/xml_processing_instruction.c +17 -19
- data/ext/nokogiri/xml_reader.c +316 -190
- data/ext/nokogiri/xml_relax_ng.c +52 -30
- data/ext/nokogiri/xml_sax_parser.c +130 -124
- data/ext/nokogiri/xml_sax_parser_context.c +110 -89
- data/ext/nokogiri/xml_sax_push_parser.c +36 -29
- data/ext/nokogiri/xml_schema.c +98 -50
- data/ext/nokogiri/xml_syntax_error.c +42 -21
- data/ext/nokogiri/xml_text.c +14 -18
- data/ext/nokogiri/xml_xpath_context.c +263 -148
- data/ext/nokogiri/xslt_stylesheet.c +271 -178
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +111 -0
- data/gumbo-parser/THANKS +27 -0
- data/lib/nokogiri/2.7/nokogiri.so +0 -0
- data/lib/nokogiri/3.0/nokogiri.so +0 -0
- data/lib/nokogiri/3.1/nokogiri.so +0 -0
- data/lib/nokogiri/3.2/nokogiri.so +0 -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 +5 -3
- data/lib/nokogiri/css/tokenizer.rex +3 -2
- data/lib/nokogiri/css/xpath_visitor.rb +223 -94
- data/lib/nokogiri/css.rb +56 -17
- data/lib/nokogiri/decorators/slop.rb +9 -7
- data/lib/nokogiri/encoding_handler.rb +57 -0
- data/lib/nokogiri/extension.rb +32 -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/html4/document.rb +214 -0
- 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 +572 -0
- data/lib/nokogiri/html4/encoding_reader.rb +121 -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 +47 -0
- data/lib/nokogiri/html5/document.rb +168 -0
- data/lib/nokogiri/html5/document_fragment.rb +90 -0
- data/lib/nokogiri/html5/node.rb +98 -0
- data/lib/nokogiri/html5.rb +389 -0
- data/lib/nokogiri/jruby/dependencies.rb +3 -0
- data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
- data/lib/nokogiri/syntax_error.rb +2 -0
- data/lib/nokogiri/version/constant.rb +6 -0
- data/lib/nokogiri/version/info.rb +223 -0
- data/lib/nokogiri/version.rb +3 -108
- data/lib/nokogiri/xml/attr.rb +55 -3
- data/lib/nokogiri/xml/attribute_decl.rb +3 -1
- data/lib/nokogiri/xml/builder.rb +75 -34
- data/lib/nokogiri/xml/cdata.rb +3 -1
- data/lib/nokogiri/xml/character_data.rb +2 -0
- data/lib/nokogiri/xml/document.rb +312 -126
- data/lib/nokogiri/xml/document_fragment.rb +93 -48
- 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 +45 -0
- data/lib/nokogiri/xml/node/save_options.rb +15 -8
- data/lib/nokogiri/xml/node.rb +1067 -406
- data/lib/nokogiri/xml/node_set.rb +135 -59
- data/lib/nokogiri/xml/notation.rb +13 -0
- data/lib/nokogiri/xml/parse_options.rb +145 -52
- data/lib/nokogiri/xml/pp/character_data.rb +9 -6
- data/lib/nokogiri/xml/pp/node.rb +27 -26
- data/lib/nokogiri/xml/pp.rb +4 -2
- data/lib/nokogiri/xml/processing_instruction.rb +4 -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 +39 -36
- 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 +48 -72
- data/lib/xsd/xmlparser/nokogiri.rb +29 -25
- metadata +146 -307
- 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 -14
- 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.rb +0 -335
- 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-Remove-script-macro-support.patch +0 -40
- data/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch +0 -44
- data/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch +0 -25
- data/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch +0 -32
- data/ports/archives/libxml2-2.9.10.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
@@ -0,0 +1,111 @@
|
|
1
|
+
.PHONY: all clean check coverage
|
2
|
+
|
3
|
+
gumbo_objs := $(patsubst %.c,build/%.o,$(wildcard src/*.c))
|
4
|
+
test_objs := $(patsubst %.cc,build/%.o,$(wildcard test/*.cc))
|
5
|
+
gtest_lib := googletest/make/gtest_main.a
|
6
|
+
|
7
|
+
# make SANITIZEFLAGS='-fsanitize=undefined -fsanitize=address'
|
8
|
+
SANITIZEFLAGS :=
|
9
|
+
CPPFLAGS := -Isrc
|
10
|
+
CFLAGS := -std=c99 -Os -Wall
|
11
|
+
CXXFLAGS := -isystem googletest/include -std=c++11 -Os -Wall
|
12
|
+
LDFLAGS := -pthread
|
13
|
+
|
14
|
+
all: check
|
15
|
+
|
16
|
+
# don't try to regenerate ragel or gperf files in CI, that should be a development-only action and
|
17
|
+
# the generated files should be committed to SCM
|
18
|
+
ifneq ($(CI),true)
|
19
|
+
src/foreign_attrs.c: src/foreign_attrs.gperf
|
20
|
+
gperf -m100 -n $< | ./gperf-filter.sed > $@
|
21
|
+
|
22
|
+
src/%.c: src/%.gperf
|
23
|
+
gperf -m100 $< | ./gperf-filter.sed > $@
|
24
|
+
|
25
|
+
src/%.c: src/%.rl
|
26
|
+
ragel -F1 -o $@ $<
|
27
|
+
endif
|
28
|
+
|
29
|
+
build/src:
|
30
|
+
mkdir -p $@
|
31
|
+
|
32
|
+
build/test:
|
33
|
+
mkdir -p $@
|
34
|
+
|
35
|
+
build/src/%.o: src/%.c build/src/flags | build/src
|
36
|
+
$(CC) -MMD $(CPPFLAGS) $(CFLAGS) $(SANITIZEFLAGS) -c -o $@ $<
|
37
|
+
|
38
|
+
build/test/%.o: test/%.cc build/test/flags | build/test
|
39
|
+
$(CXX) -MMD $(CPPFLAGS) $(CXXFLAGS) $(SANITIZEFLAGS) -c -o $@ $<
|
40
|
+
|
41
|
+
build/run_tests: $(gumbo_objs) $(test_objs) $(gtest_lib)
|
42
|
+
$(CXX) -o $@ $+ $(LDFLAGS) $(SANITIZEFLAGS)
|
43
|
+
|
44
|
+
check: build/run_tests
|
45
|
+
./build/run_tests
|
46
|
+
|
47
|
+
coverage:
|
48
|
+
$(RM) build/{src,test}/*.gcda
|
49
|
+
$(RM) build/*.info
|
50
|
+
$(MAKE) CPPFLAGS='-Isrc -DNDEBUG=1' \
|
51
|
+
CFLAGS='-std=c99 --coverage -g -O0' \
|
52
|
+
CXXFLAGS='-isystem googletest/include -std=c++11 --coverage -g -O0' \
|
53
|
+
LDFLAGS='--coverage' \
|
54
|
+
build/run_tests
|
55
|
+
lcov --no-external \
|
56
|
+
--initial \
|
57
|
+
--capture \
|
58
|
+
--base-directory . \
|
59
|
+
--directory build \
|
60
|
+
--output-file build/coverage-pre.info
|
61
|
+
awk -F '[:,]' \
|
62
|
+
'/^SF:/ { delete defs } /^FN:/ { defs[$$2]=1 } /^DA:/ { if ($$3 == 0 && $$2 in defs) next } { print }' \
|
63
|
+
build/coverage-pre.info > build/coverage-initial.info
|
64
|
+
./build/run_tests
|
65
|
+
lcov --no-external \
|
66
|
+
--capture \
|
67
|
+
--base-directory . \
|
68
|
+
--directory build \
|
69
|
+
--rc lcov_branch_coverage=1 \
|
70
|
+
--output-file build/coverage-test.info
|
71
|
+
lcov --add-tracefile build/coverage-initial.info \
|
72
|
+
--add-tracefile build/coverage-test.info \
|
73
|
+
--rc lcov_branch_coverage=1 \
|
74
|
+
--output-file build/coverage.info
|
75
|
+
lcov --remove build/coverage.info '$(CURDIR)/googletest/*' \
|
76
|
+
--rc lcov_branch_coverage=1 \
|
77
|
+
--output-file build/coverage.info
|
78
|
+
genhtml --branch-coverage \
|
79
|
+
--output-directory build/coverage \
|
80
|
+
build/coverage.info
|
81
|
+
|
82
|
+
clean:
|
83
|
+
$(RM) -r build
|
84
|
+
|
85
|
+
build/src/flags: | build/src
|
86
|
+
@echo 'old_CC := $(CC)' > $@
|
87
|
+
@echo 'old_CPPFLAGS := $(CPPFLAGS)' >> $@
|
88
|
+
@echo 'old_CFLAGS := $(CFLAGS)' >>$@
|
89
|
+
@echo 'old_SANITIZEFLAGS := $(SANITIZEFLAGS)' >> $@
|
90
|
+
@echo 'old_LDFLAGS := $(LDFLAGS)' >> $@
|
91
|
+
|
92
|
+
build/test/flags: | build/test
|
93
|
+
@echo 'old_CXX := $(CXX)' > $@
|
94
|
+
@echo 'old_CPPFLAGS := $(CPPFLAGS)' >> $@
|
95
|
+
@echo 'old_CXXFLAGS := $(CXXFLAGS)' >> $@
|
96
|
+
@echo 'old_SANITIZEFLAGS := $(SANITIZEFLAGS)' >> $@
|
97
|
+
@echo 'old_LDFLAGS := $(LDFLAGS)' >> $@
|
98
|
+
|
99
|
+
ifeq (,$(filter clean coverage,$(MAKECMDGOALS)))
|
100
|
+
# Ensure that the flags are up to date.
|
101
|
+
-include build/src/flags build/test/flags
|
102
|
+
ifneq ($(old_CC) | $(old_CPPFLAGS) | $(old_CFLAGS) | $(old_SANITIZEFLAGS) | $(old_LDFLAGS),$(CC) | $(CPPFLAGS) | $(CFLAGS) | $(SANITIZEFLAGS) | $(LDFLAGS))
|
103
|
+
.PHONY: build/src/flags
|
104
|
+
endif
|
105
|
+
ifneq ($(old_CXX) | $(old_CPPFLAGS) | $(old_CXXFLAGS) | $(old_SANITIZEFLAGS) | $(old_LDFLAGS),$(CXX) | $(CPPFLAGS) | $(CXXFLAGS) | $(SANITIZEFLAGS) | $(LDFLAGS))
|
106
|
+
.PHONY: build/test/flags
|
107
|
+
endif
|
108
|
+
|
109
|
+
# Include dependencies.
|
110
|
+
-include $(test_objs:.o=.d) $(gumbo_objs:.o=.d)
|
111
|
+
endif
|
data/gumbo-parser/THANKS
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Gumbo HTML parser THANKS file
|
2
|
+
|
3
|
+
Gumbo was originally written by Jonathan Tang, but many people helped out through suggestions, question-answering, code reviews, bugfixes, and organizational support. Here is a list of these people. Help me keep it complete and exempt of errors.
|
4
|
+
|
5
|
+
Adam Barth
|
6
|
+
Adam Roben
|
7
|
+
Ben Noordhuis
|
8
|
+
Bowen Han
|
9
|
+
Constantinos Michael
|
10
|
+
Craig Barnes
|
11
|
+
Geoffrey Sneddon
|
12
|
+
Ian Hickson
|
13
|
+
Jack Deng
|
14
|
+
Joel Low
|
15
|
+
Jonathan Shneier
|
16
|
+
Kevin Hendricks
|
17
|
+
Mason Tang
|
18
|
+
Maxim Zakharov
|
19
|
+
Michal Zalewski
|
20
|
+
Neal Norwitz
|
21
|
+
Othar Hansson
|
22
|
+
Ryan Grove
|
23
|
+
Stefan Haustein
|
24
|
+
Steffen Meschkat
|
25
|
+
Steven Kabbes
|
26
|
+
Thiago Farina
|
27
|
+
Vicent Marti
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "set"
|
5
|
+
|
6
|
+
module Nokogiri
|
7
|
+
#
|
8
|
+
# Some classes in Nokogiri are namespaced as a group, for example
|
9
|
+
# Document, DocumentFragment, and Builder.
|
10
|
+
#
|
11
|
+
# It's sometimes necessary to look up the related class, e.g.:
|
12
|
+
#
|
13
|
+
# XML::Builder → XML::Document
|
14
|
+
# HTML4::Builder → HTML4::Document
|
15
|
+
# HTML5::Document → HTML5::DocumentFragment
|
16
|
+
#
|
17
|
+
# This module is included into those key classes who need to do this.
|
18
|
+
#
|
19
|
+
module ClassResolver
|
20
|
+
# #related_class restricts matching namespaces to those matching this set.
|
21
|
+
VALID_NAMESPACES = Set.new(["HTML", "HTML4", "HTML5", "XML"])
|
22
|
+
|
23
|
+
# :call-seq:
|
24
|
+
# related_class(class_name) → Class
|
25
|
+
#
|
26
|
+
# Find a class constant within the
|
27
|
+
#
|
28
|
+
# Some examples:
|
29
|
+
#
|
30
|
+
# Nokogiri::XML::Document.new.related_class("DocumentFragment")
|
31
|
+
# # => Nokogiri::XML::DocumentFragment
|
32
|
+
# Nokogiri::HTML4::Document.new.related_class("DocumentFragment")
|
33
|
+
# # => Nokogiri::HTML4::DocumentFragment
|
34
|
+
#
|
35
|
+
# Note this will also work for subclasses that follow the same convention, e.g.:
|
36
|
+
#
|
37
|
+
# Loofah::HTML::Document.new.related_class("DocumentFragment")
|
38
|
+
# # => Loofah::HTML::DocumentFragment
|
39
|
+
#
|
40
|
+
# And even if it's a subclass, this will iterate through the superclasses:
|
41
|
+
#
|
42
|
+
# class ThisIsATopLevelClass < Nokogiri::HTML4::Builder ; end
|
43
|
+
# ThisIsATopLevelClass.new.related_class("Document")
|
44
|
+
# # => Nokogiri::HTML4::Document
|
45
|
+
#
|
46
|
+
def related_class(class_name)
|
47
|
+
klass = nil
|
48
|
+
inspecting = self.class
|
49
|
+
|
50
|
+
while inspecting
|
51
|
+
namespace_path = inspecting.name.split("::")[0..-2]
|
52
|
+
inspecting = inspecting.superclass
|
53
|
+
|
54
|
+
next unless VALID_NAMESPACES.include?(namespace_path.last)
|
55
|
+
|
56
|
+
related_class_name = (namespace_path << class_name).join("::")
|
57
|
+
klass = begin
|
58
|
+
Object.const_get(related_class_name)
|
59
|
+
rescue NameError
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
break if klass
|
63
|
+
end
|
64
|
+
klass
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
data/lib/nokogiri/css/node.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Nokogiri
|
2
4
|
module CSS
|
3
|
-
class Node
|
5
|
+
class Node # :nodoc:
|
4
6
|
ALLOW_COMBINATOR_ON_SELF = [:DIRECT_ADJACENT_SELECTOR, :FOLLOWING_SELECTOR, :CHILD_SELECTOR]
|
5
7
|
|
6
8
|
# Get the type of this node
|
@@ -9,25 +11,25 @@ module Nokogiri
|
|
9
11
|
attr_accessor :value
|
10
12
|
|
11
13
|
# Create a new Node with +type+ and +value+
|
12
|
-
def initialize
|
14
|
+
def initialize(type, value)
|
13
15
|
@type = type
|
14
16
|
@value = value
|
15
17
|
end
|
16
18
|
|
17
19
|
# Accept +visitor+
|
18
|
-
def accept
|
20
|
+
def accept(visitor)
|
19
21
|
visitor.send(:"visit_#{type.to_s.downcase}", self)
|
20
22
|
end
|
21
23
|
|
22
24
|
###
|
23
25
|
# Convert this CSS node to xpath with +prefix+ using +visitor+
|
24
|
-
def to_xpath
|
25
|
-
prefix =
|
26
|
+
def to_xpath(prefix, visitor)
|
27
|
+
prefix = "." if ALLOW_COMBINATOR_ON_SELF.include?(type) && value.first.nil?
|
26
28
|
prefix + visitor.accept(self)
|
27
29
|
end
|
28
30
|
|
29
31
|
# Find a node by type using +types+
|
30
|
-
def find_by_type
|
32
|
+
def find_by_type(types)
|
31
33
|
matches = []
|
32
34
|
matches << self if to_type == types
|
33
35
|
@value.each do |v|
|
@@ -38,9 +40,9 @@ module Nokogiri
|
|
38
40
|
|
39
41
|
# Convert to_type
|
40
42
|
def to_type
|
41
|
-
[@type] + @value.
|
43
|
+
[@type] + @value.filter_map do |n|
|
42
44
|
n.to_type if n.respond_to?(:to_type)
|
43
|
-
|
45
|
+
end
|
44
46
|
end
|
45
47
|
|
46
48
|
# Convert to array
|