mini-pro-gem 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. checksums.yaml +7 -0
  2. data/mini-pro-gem.gemspec +12 -0
  3. data/nokogiri-1.19.4/Gemfile +40 -0
  4. data/nokogiri-1.19.4/LICENSE-DEPENDENCIES.md +2411 -0
  5. data/nokogiri-1.19.4/LICENSE.md +9 -0
  6. data/nokogiri-1.19.4/README.md +308 -0
  7. data/nokogiri-1.19.4/bin/nokogiri +131 -0
  8. data/nokogiri-1.19.4/dependencies.yml +31 -0
  9. data/nokogiri-1.19.4/ext/nokogiri/depend +38 -0
  10. data/nokogiri-1.19.4/ext/nokogiri/extconf.rb +1165 -0
  11. data/nokogiri-1.19.4/ext/nokogiri/gumbo.c +610 -0
  12. data/nokogiri-1.19.4/ext/nokogiri/html4_document.c +171 -0
  13. data/nokogiri-1.19.4/ext/nokogiri/html4_element_description.c +299 -0
  14. data/nokogiri-1.19.4/ext/nokogiri/html4_entity_lookup.c +37 -0
  15. data/nokogiri-1.19.4/ext/nokogiri/html4_sax_parser.c +40 -0
  16. data/nokogiri-1.19.4/ext/nokogiri/html4_sax_parser_context.c +98 -0
  17. data/nokogiri-1.19.4/ext/nokogiri/html4_sax_push_parser.c +96 -0
  18. data/nokogiri-1.19.4/ext/nokogiri/libxml2_polyfill.c +114 -0
  19. data/nokogiri-1.19.4/ext/nokogiri/nokogiri.c +297 -0
  20. data/nokogiri-1.19.4/ext/nokogiri/nokogiri.h +247 -0
  21. data/nokogiri-1.19.4/ext/nokogiri/test_global_handlers.c +40 -0
  22. data/nokogiri-1.19.4/ext/nokogiri/xml_attr.c +108 -0
  23. data/nokogiri-1.19.4/ext/nokogiri/xml_attribute_decl.c +70 -0
  24. data/nokogiri-1.19.4/ext/nokogiri/xml_cdata.c +62 -0
  25. data/nokogiri-1.19.4/ext/nokogiri/xml_comment.c +57 -0
  26. data/nokogiri-1.19.4/ext/nokogiri/xml_document.c +796 -0
  27. data/nokogiri-1.19.4/ext/nokogiri/xml_document_fragment.c +29 -0
  28. data/nokogiri-1.19.4/ext/nokogiri/xml_dtd.c +208 -0
  29. data/nokogiri-1.19.4/ext/nokogiri/xml_element_content.c +131 -0
  30. data/nokogiri-1.19.4/ext/nokogiri/xml_element_decl.c +69 -0
  31. data/nokogiri-1.19.4/ext/nokogiri/xml_encoding_handler.c +112 -0
  32. data/nokogiri-1.19.4/ext/nokogiri/xml_entity_decl.c +112 -0
  33. data/nokogiri-1.19.4/ext/nokogiri/xml_entity_reference.c +50 -0
  34. data/nokogiri-1.19.4/ext/nokogiri/xml_namespace.c +181 -0
  35. data/nokogiri-1.19.4/ext/nokogiri/xml_node.c +2523 -0
  36. data/nokogiri-1.19.4/ext/nokogiri/xml_node_set.c +518 -0
  37. data/nokogiri-1.19.4/ext/nokogiri/xml_processing_instruction.c +54 -0
  38. data/nokogiri-1.19.4/ext/nokogiri/xml_reader.c +777 -0
  39. data/nokogiri-1.19.4/ext/nokogiri/xml_relax_ng.c +149 -0
  40. data/nokogiri-1.19.4/ext/nokogiri/xml_sax_parser.c +403 -0
  41. data/nokogiri-1.19.4/ext/nokogiri/xml_sax_parser_context.c +396 -0
  42. data/nokogiri-1.19.4/ext/nokogiri/xml_sax_push_parser.c +206 -0
  43. data/nokogiri-1.19.4/ext/nokogiri/xml_schema.c +226 -0
  44. data/nokogiri-1.19.4/ext/nokogiri/xml_syntax_error.c +93 -0
  45. data/nokogiri-1.19.4/ext/nokogiri/xml_text.c +59 -0
  46. data/nokogiri-1.19.4/ext/nokogiri/xml_xpath_context.c +496 -0
  47. data/nokogiri-1.19.4/ext/nokogiri/xslt_stylesheet.c +457 -0
  48. data/nokogiri-1.19.4/gumbo-parser/CHANGES.md +63 -0
  49. data/nokogiri-1.19.4/gumbo-parser/Makefile +129 -0
  50. data/nokogiri-1.19.4/gumbo-parser/THANKS +27 -0
  51. data/nokogiri-1.19.4/gumbo-parser/src/Makefile +34 -0
  52. data/nokogiri-1.19.4/gumbo-parser/src/README.md +41 -0
  53. data/nokogiri-1.19.4/gumbo-parser/src/ascii.c +75 -0
  54. data/nokogiri-1.19.4/gumbo-parser/src/ascii.h +115 -0
  55. data/nokogiri-1.19.4/gumbo-parser/src/attribute.c +42 -0
  56. data/nokogiri-1.19.4/gumbo-parser/src/attribute.h +17 -0
  57. data/nokogiri-1.19.4/gumbo-parser/src/char_ref.c +22225 -0
  58. data/nokogiri-1.19.4/gumbo-parser/src/char_ref.h +29 -0
  59. data/nokogiri-1.19.4/gumbo-parser/src/char_ref.rl +2154 -0
  60. data/nokogiri-1.19.4/gumbo-parser/src/error.c +658 -0
  61. data/nokogiri-1.19.4/gumbo-parser/src/error.h +152 -0
  62. data/nokogiri-1.19.4/gumbo-parser/src/foreign_attrs.c +103 -0
  63. data/nokogiri-1.19.4/gumbo-parser/src/foreign_attrs.gperf +27 -0
  64. data/nokogiri-1.19.4/gumbo-parser/src/insertion_mode.h +33 -0
  65. data/nokogiri-1.19.4/gumbo-parser/src/macros.h +91 -0
  66. data/nokogiri-1.19.4/gumbo-parser/src/nokogiri_gumbo.h +953 -0
  67. data/nokogiri-1.19.4/gumbo-parser/src/parser.c +4932 -0
  68. data/nokogiri-1.19.4/gumbo-parser/src/parser.h +41 -0
  69. data/nokogiri-1.19.4/gumbo-parser/src/replacement.h +33 -0
  70. data/nokogiri-1.19.4/gumbo-parser/src/string_buffer.c +103 -0
  71. data/nokogiri-1.19.4/gumbo-parser/src/string_buffer.h +68 -0
  72. data/nokogiri-1.19.4/gumbo-parser/src/string_piece.c +48 -0
  73. data/nokogiri-1.19.4/gumbo-parser/src/svg_attrs.c +174 -0
  74. data/nokogiri-1.19.4/gumbo-parser/src/svg_attrs.gperf +77 -0
  75. data/nokogiri-1.19.4/gumbo-parser/src/svg_tags.c +137 -0
  76. data/nokogiri-1.19.4/gumbo-parser/src/svg_tags.gperf +55 -0
  77. data/nokogiri-1.19.4/gumbo-parser/src/tag.c +223 -0
  78. data/nokogiri-1.19.4/gumbo-parser/src/tag_lookup.c +382 -0
  79. data/nokogiri-1.19.4/gumbo-parser/src/tag_lookup.gperf +170 -0
  80. data/nokogiri-1.19.4/gumbo-parser/src/tag_lookup.h +13 -0
  81. data/nokogiri-1.19.4/gumbo-parser/src/token_buffer.c +79 -0
  82. data/nokogiri-1.19.4/gumbo-parser/src/token_buffer.h +71 -0
  83. data/nokogiri-1.19.4/gumbo-parser/src/token_type.h +17 -0
  84. data/nokogiri-1.19.4/gumbo-parser/src/tokenizer.c +3464 -0
  85. data/nokogiri-1.19.4/gumbo-parser/src/tokenizer.h +112 -0
  86. data/nokogiri-1.19.4/gumbo-parser/src/tokenizer_states.h +339 -0
  87. data/nokogiri-1.19.4/gumbo-parser/src/utf8.c +245 -0
  88. data/nokogiri-1.19.4/gumbo-parser/src/utf8.h +164 -0
  89. data/nokogiri-1.19.4/gumbo-parser/src/util.c +66 -0
  90. data/nokogiri-1.19.4/gumbo-parser/src/util.h +34 -0
  91. data/nokogiri-1.19.4/gumbo-parser/src/vector.c +111 -0
  92. data/nokogiri-1.19.4/gumbo-parser/src/vector.h +45 -0
  93. data/nokogiri-1.19.4/lib/nokogiri/class_resolver.rb +65 -0
  94. data/nokogiri-1.19.4/lib/nokogiri/css/node.rb +58 -0
  95. data/nokogiri-1.19.4/lib/nokogiri/css/parser.rb +772 -0
  96. data/nokogiri-1.19.4/lib/nokogiri/css/parser.y +277 -0
  97. data/nokogiri-1.19.4/lib/nokogiri/css/parser_extras.rb +36 -0
  98. data/nokogiri-1.19.4/lib/nokogiri/css/selector_cache.rb +38 -0
  99. data/nokogiri-1.19.4/lib/nokogiri/css/syntax_error.rb +9 -0
  100. data/nokogiri-1.19.4/lib/nokogiri/css/tokenizer.rb +155 -0
  101. data/nokogiri-1.19.4/lib/nokogiri/css/tokenizer.rex +57 -0
  102. data/nokogiri-1.19.4/lib/nokogiri/css/xpath_visitor.rb +376 -0
  103. data/nokogiri-1.19.4/lib/nokogiri/css.rb +132 -0
  104. data/nokogiri-1.19.4/lib/nokogiri/decorators/slop.rb +42 -0
  105. data/nokogiri-1.19.4/lib/nokogiri/encoding_handler.rb +57 -0
  106. data/nokogiri-1.19.4/lib/nokogiri/extension.rb +32 -0
  107. data/nokogiri-1.19.4/lib/nokogiri/gumbo.rb +15 -0
  108. data/nokogiri-1.19.4/lib/nokogiri/html.rb +48 -0
  109. data/nokogiri-1.19.4/lib/nokogiri/html4/builder.rb +37 -0
  110. data/nokogiri-1.19.4/lib/nokogiri/html4/document.rb +235 -0
  111. data/nokogiri-1.19.4/lib/nokogiri/html4/document_fragment.rb +166 -0
  112. data/nokogiri-1.19.4/lib/nokogiri/html4/element_description.rb +25 -0
  113. data/nokogiri-1.19.4/lib/nokogiri/html4/element_description_defaults.rb +2040 -0
  114. data/nokogiri-1.19.4/lib/nokogiri/html4/encoding_reader.rb +121 -0
  115. data/nokogiri-1.19.4/lib/nokogiri/html4/entity_lookup.rb +15 -0
  116. data/nokogiri-1.19.4/lib/nokogiri/html4/sax/parser.rb +48 -0
  117. data/nokogiri-1.19.4/lib/nokogiri/html4/sax/parser_context.rb +15 -0
  118. data/nokogiri-1.19.4/lib/nokogiri/html4/sax/push_parser.rb +37 -0
  119. data/nokogiri-1.19.4/lib/nokogiri/html4.rb +42 -0
  120. data/nokogiri-1.19.4/lib/nokogiri/html5/builder.rb +40 -0
  121. data/nokogiri-1.19.4/lib/nokogiri/html5/document.rb +199 -0
  122. data/nokogiri-1.19.4/lib/nokogiri/html5/document_fragment.rb +200 -0
  123. data/nokogiri-1.19.4/lib/nokogiri/html5/node.rb +103 -0
  124. data/nokogiri-1.19.4/lib/nokogiri/html5.rb +368 -0
  125. data/nokogiri-1.19.4/lib/nokogiri/jruby/dependencies.rb +3 -0
  126. data/nokogiri-1.19.4/lib/nokogiri/jruby/nokogiri_jars.rb +48 -0
  127. data/nokogiri-1.19.4/lib/nokogiri/syntax_error.rb +6 -0
  128. data/nokogiri-1.19.4/lib/nokogiri/version/constant.rb +6 -0
  129. data/nokogiri-1.19.4/lib/nokogiri/version/info.rb +234 -0
  130. data/nokogiri-1.19.4/lib/nokogiri/version.rb +4 -0
  131. data/nokogiri-1.19.4/lib/nokogiri/xml/attr.rb +66 -0
  132. data/nokogiri-1.19.4/lib/nokogiri/xml/attribute_decl.rb +22 -0
  133. data/nokogiri-1.19.4/lib/nokogiri/xml/builder.rb +494 -0
  134. data/nokogiri-1.19.4/lib/nokogiri/xml/cdata.rb +13 -0
  135. data/nokogiri-1.19.4/lib/nokogiri/xml/character_data.rb +9 -0
  136. data/nokogiri-1.19.4/lib/nokogiri/xml/document.rb +515 -0
  137. data/nokogiri-1.19.4/lib/nokogiri/xml/document_fragment.rb +276 -0
  138. data/nokogiri-1.19.4/lib/nokogiri/xml/dtd.rb +34 -0
  139. data/nokogiri-1.19.4/lib/nokogiri/xml/element_content.rb +46 -0
  140. data/nokogiri-1.19.4/lib/nokogiri/xml/element_decl.rb +17 -0
  141. data/nokogiri-1.19.4/lib/nokogiri/xml/entity_decl.rb +23 -0
  142. data/nokogiri-1.19.4/lib/nokogiri/xml/entity_reference.rb +20 -0
  143. data/nokogiri-1.19.4/lib/nokogiri/xml/namespace.rb +57 -0
  144. data/nokogiri-1.19.4/lib/nokogiri/xml/node/save_options.rb +76 -0
  145. data/nokogiri-1.19.4/lib/nokogiri/xml/node.rb +1701 -0
  146. data/nokogiri-1.19.4/lib/nokogiri/xml/node_set.rb +449 -0
  147. data/nokogiri-1.19.4/lib/nokogiri/xml/notation.rb +19 -0
  148. data/nokogiri-1.19.4/lib/nokogiri/xml/parse_options.rb +217 -0
  149. data/nokogiri-1.19.4/lib/nokogiri/xml/pp/character_data.rb +21 -0
  150. data/nokogiri-1.19.4/lib/nokogiri/xml/pp/node.rb +73 -0
  151. data/nokogiri-1.19.4/lib/nokogiri/xml/pp.rb +4 -0
  152. data/nokogiri-1.19.4/lib/nokogiri/xml/processing_instruction.rb +11 -0
  153. data/nokogiri-1.19.4/lib/nokogiri/xml/reader.rb +139 -0
  154. data/nokogiri-1.19.4/lib/nokogiri/xml/relax_ng.rb +75 -0
  155. data/nokogiri-1.19.4/lib/nokogiri/xml/sax/document.rb +258 -0
  156. data/nokogiri-1.19.4/lib/nokogiri/xml/sax/parser.rb +199 -0
  157. data/nokogiri-1.19.4/lib/nokogiri/xml/sax/parser_context.rb +129 -0
  158. data/nokogiri-1.19.4/lib/nokogiri/xml/sax/push_parser.rb +64 -0
  159. data/nokogiri-1.19.4/lib/nokogiri/xml/sax.rb +54 -0
  160. data/nokogiri-1.19.4/lib/nokogiri/xml/schema.rb +140 -0
  161. data/nokogiri-1.19.4/lib/nokogiri/xml/searchable.rb +274 -0
  162. data/nokogiri-1.19.4/lib/nokogiri/xml/syntax_error.rb +94 -0
  163. data/nokogiri-1.19.4/lib/nokogiri/xml/text.rb +11 -0
  164. data/nokogiri-1.19.4/lib/nokogiri/xml/xpath/syntax_error.rb +13 -0
  165. data/nokogiri-1.19.4/lib/nokogiri/xml/xpath.rb +21 -0
  166. data/nokogiri-1.19.4/lib/nokogiri/xml/xpath_context.rb +27 -0
  167. data/nokogiri-1.19.4/lib/nokogiri/xml.rb +65 -0
  168. data/nokogiri-1.19.4/lib/nokogiri/xslt/stylesheet.rb +54 -0
  169. data/nokogiri-1.19.4/lib/nokogiri/xslt.rb +138 -0
  170. data/nokogiri-1.19.4/lib/nokogiri.rb +128 -0
  171. data/nokogiri-1.19.4/lib/xsd/xmlparser/nokogiri.rb +105 -0
  172. data/nokogiri-1.19.4/patches/libxml2/0001-Remove-script-macro-support.patch +40 -0
  173. data/nokogiri-1.19.4/patches/libxml2/0002-Update-entities-to-remove-handling-of-ssi.patch +44 -0
  174. data/nokogiri-1.19.4/patches/libxml2/0009-allow-wildcard-namespaces.patch +77 -0
  175. data/nokogiri-1.19.4/patches/libxml2/0010-update-config.guess-and-config.sub-for-libxml2.patch +224 -0
  176. data/nokogiri-1.19.4/patches/libxml2/0011-rip-out-libxml2-s-libc_single_threaded-support.patch +30 -0
  177. data/nokogiri-1.19.4/patches/libxml2/0019-xpath-Use-separate-static-hash-table-for-standard-fu.patch +244 -0
  178. data/nokogiri-1.19.4/patches/libxslt/0001-update-config.guess-and-config.sub-for-libxslt.patch +224 -0
  179. data/nokogiri-1.19.4/ports/archives/libxml2-2.13.9.tar.xz +0 -0
  180. data/nokogiri-1.19.4/ports/archives/libxslt-1.1.43.tar.xz +0 -0
  181. metadata +220 -0
@@ -0,0 +1,138 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ module Nokogiri
5
+ class << self
6
+ # Convenience method for Nokogiri::XSLT.parse
7
+ def XSLT(...)
8
+ XSLT.parse(...)
9
+ end
10
+ end
11
+
12
+ ###
13
+ # See Nokogiri::XSLT::Stylesheet for creating and manipulating Stylesheet objects.
14
+ #
15
+ # 🛡 <b>Do not use this module for untrusted stylesheet documents.</b> libxslt does not support
16
+ # safely processing untrusted stylesheets. Untrusted stylesheets may access the file system and
17
+ # network, consume large amounts of CPU, memory, or other system resources, and IO and file
18
+ # access are not restricted. Additionally, the stylesheet is parsed by libxml2 with +NOENT+ and
19
+ # +DTDLOAD+ enabled (see ParseOptions::DEFAULT_XSLT), meaning that <b>external entities will be
20
+ # resolved and external subsets will be loaded</b> during parsing.
21
+ module XSLT
22
+ class << self
23
+ # :call-seq:
24
+ # parse(xsl) → Nokogiri::XSLT::Stylesheet
25
+ # parse(xsl, modules) → Nokogiri::XSLT::Stylesheet
26
+ #
27
+ # Parse the stylesheet in +xsl+, registering optional +modules+ as custom class handlers.
28
+ #
29
+ # 🛡 <b>Do not pass untrusted stylesheet content to this method.</b> See Nokogiri::XSLT for more
30
+ # information.
31
+ #
32
+ # [Parameters]
33
+ # - +xsl+ (String) XSL content to be parsed into a stylesheet
34
+ # - +modules+ (Hash<String ⇒ Class>) A hash of URI-to-handler relations for linking a
35
+ # namespace to a custom function handler.
36
+ #
37
+ # ⚠ The XSLT handler classes are registered *globally*.
38
+ #
39
+ # Also see Nokogiri::XSLT.register
40
+ #
41
+ # *Example*
42
+ #
43
+ # xml = Nokogiri.XML(<<~XML)
44
+ # <nodes>
45
+ # <node>Foo</node>
46
+ # <node>Bar</node>
47
+ # </nodes>
48
+ # XML
49
+ #
50
+ # handler = Class.new do
51
+ # def reverse(node)
52
+ # node.text.reverse
53
+ # end
54
+ # end
55
+ #
56
+ # xsl = <<~XSL
57
+ # <xsl:stylesheet version="1.0"
58
+ # xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
59
+ # xmlns:myfuncs="http://nokogiri.org/xslt/myfuncs"
60
+ # extension-element-prefixes="myfuncs">
61
+ # <xsl:template match="/">
62
+ # <reversed>
63
+ # <xsl:for-each select="nodes/node">
64
+ # <reverse><xsl:copy-of select="myfuncs:reverse(.)"/></reverse>
65
+ # </xsl:for-each>
66
+ # </reversed>
67
+ # </xsl:template>
68
+ # </xsl:stylesheet>
69
+ # XSL
70
+ #
71
+ # xsl = Nokogiri.XSLT(xsl, "http://nokogiri.org/xslt/myfuncs" => handler)
72
+ # xsl.transform(xml).to_xml
73
+ # # => "<?xml version=\"1.0\"?>\n" +
74
+ # # "<reversed>\n" +
75
+ # # " <reverse>ooF</reverse>\n" +
76
+ # # " <reverse>raB</reverse>\n" +
77
+ # # "</reversed>\n"
78
+ #
79
+ def parse(string, modules = {})
80
+ modules.each do |url, klass|
81
+ XSLT.register(url, klass)
82
+ end
83
+
84
+ doc = XML::Document.parse(string, nil, nil, XML::ParseOptions::DEFAULT_XSLT)
85
+ if Nokogiri.jruby?
86
+ Stylesheet.parse_stylesheet_doc(doc, string)
87
+ else
88
+ Stylesheet.parse_stylesheet_doc(doc)
89
+ end
90
+ end
91
+
92
+ # :call-seq:
93
+ # quote_params(params) → Array
94
+ #
95
+ # Quote parameters in +params+ for stylesheet safety.
96
+ # See Nokogiri::XSLT::Stylesheet.transform for example usage.
97
+ #
98
+ # [Parameters]
99
+ # - +params+ (Hash, Array) XSLT parameters (key->value, or tuples of [key, value])
100
+ #
101
+ # [Returns] Array of string parameters, with quotes correctly escaped for use with XSLT::Stylesheet.transform
102
+ #
103
+ def quote_params(params)
104
+ params.flatten.each_slice(2).with_object([]) do |kv, quoted_params|
105
+ key, value = kv.map(&:to_s)
106
+ value = if value.include?("'")
107
+ "concat('#{value.gsub("'", %q{', "'", '})}')"
108
+ else
109
+ "'#{value}'"
110
+ end
111
+ quoted_params << key
112
+ quoted_params << value
113
+ end
114
+ end
115
+
116
+ # call-seq:
117
+ # register(uri, custom_handler_class)
118
+ #
119
+ # Register a class that implements custom XSLT transformation functions.
120
+ #
121
+ # ⚠ The XSLT handler classes are registered *globally*.
122
+ #
123
+ # [Parameters}
124
+ # - +uri+ (String) The namespace for the custom handlers
125
+ # - +custom_handler_class+ (Class) A class with ruby methods that can be called during
126
+ # transformation
127
+ #
128
+ # See Nokogiri::XSLT.parse for usage.
129
+ #
130
+ def register(uri, custom_handler_class)
131
+ # NOTE: this is implemented in the C extension, see ext/nokogiri/xslt_stylesheet.c
132
+ raise NotImplementedError, "Nokogiri::XSLT.register is not implemented on JRuby"
133
+ end if Nokogiri.jruby?
134
+ end
135
+ end
136
+ end
137
+
138
+ require_relative "xslt/stylesheet"
@@ -0,0 +1,128 @@
1
+ # coding: utf-8
2
+ # frozen_string_literal: true
3
+
4
+ if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
5
+ require_relative "nokogiri/jruby/dependencies"
6
+ end
7
+
8
+ require_relative "nokogiri/extension"
9
+
10
+ # Nokogiri parses and searches XML/HTML very quickly, and also has
11
+ # correctly implemented CSS3 selector support as well as XPath 1.0
12
+ # support.
13
+ #
14
+ # Parsing a document returns either a Nokogiri::XML::Document, or a
15
+ # Nokogiri::HTML4::Document depending on the kind of document you parse.
16
+ #
17
+ # Here is an example:
18
+ #
19
+ # require 'nokogiri'
20
+ # require 'open-uri'
21
+ #
22
+ # # Get a Nokogiri::HTML4::Document for the page we’re interested in...
23
+ #
24
+ # doc = Nokogiri::HTML4(URI.open('http://www.google.com/search?q=tenderlove'))
25
+ #
26
+ # # Do funky things with it using Nokogiri::XML::Node methods...
27
+ #
28
+ # ####
29
+ # # Search for nodes by css
30
+ # doc.css('h3.r a.l').each do |link|
31
+ # puts link.content
32
+ # end
33
+ #
34
+ # See also:
35
+ #
36
+ # - Nokogiri::XML::Searchable#css for more information about CSS searching
37
+ # - Nokogiri::XML::Searchable#xpath for more information about XPath searching
38
+ module Nokogiri
39
+ class << self
40
+ ###
41
+ # Parse an HTML or XML document. +string+ contains the document.
42
+ def parse(string, url = nil, encoding = nil, options = nil)
43
+ if string.respond_to?(:read) ||
44
+ /^\s*<(?:!DOCTYPE\s+)?html[\s>]/i.match?(string[0, 512])
45
+ # Expect an HTML indicator to appear within the first 512
46
+ # characters of a document. (<?xml ?> + <?xml-stylesheet ?>
47
+ # shouldn't be that long)
48
+ Nokogiri.HTML4(
49
+ string,
50
+ url,
51
+ encoding,
52
+ options || XML::ParseOptions::DEFAULT_HTML,
53
+ )
54
+ else
55
+ Nokogiri.XML(
56
+ string,
57
+ url,
58
+ encoding,
59
+ options || XML::ParseOptions::DEFAULT_XML,
60
+ )
61
+ end.tap do |doc|
62
+ yield doc if block_given?
63
+ end
64
+ end
65
+
66
+ ###
67
+ # Create a new Nokogiri::XML::DocumentFragment
68
+ def make(input = nil, opts = {}, &blk)
69
+ if input
70
+ Nokogiri::HTML4.fragment(input).children.first
71
+ else
72
+ Nokogiri(&blk)
73
+ end
74
+ end
75
+
76
+ ###
77
+ # Parse a document and add the Slop decorator. The Slop decorator
78
+ # implements method_missing such that methods may be used instead of CSS
79
+ # or XPath. For example:
80
+ #
81
+ # doc = Nokogiri::Slop(<<-eohtml)
82
+ # <html>
83
+ # <body>
84
+ # <p>first</p>
85
+ # <p>second</p>
86
+ # </body>
87
+ # </html>
88
+ # eohtml
89
+ # assert_equal('second', doc.html.body.p[1].text)
90
+ #
91
+ def Slop(*args, &block)
92
+ Nokogiri(*args, &block).slop!
93
+ end
94
+
95
+ # :nodoc:
96
+ def install_default_aliases
97
+ warn("Nokogiri.install_default_aliases is deprecated. Please call Nokogiri::EncodingHandler.install_default_aliases instead. This will become an error in Nokogiri v1.17.0.", uplevel: 1, category: :deprecated) # deprecated in v1.14.0, remove in v1.17.0
98
+ Nokogiri::EncodingHandler.install_default_aliases
99
+ end
100
+ end
101
+ end
102
+
103
+ ###
104
+ # Parse a document contained in +args+. Nokogiri will try to guess what type of document you are
105
+ # attempting to parse. For more information, see Nokogiri.parse
106
+ #
107
+ # To specify the type of document, use {Nokogiri.XML}, {Nokogiri.HTML4}, or {Nokogiri.HTML5}.
108
+ def Nokogiri(*args, &block)
109
+ if block
110
+ Nokogiri::HTML4::Builder.new(&block).doc.root
111
+ else
112
+ Nokogiri.parse(*args)
113
+ end
114
+ end
115
+
116
+ require_relative "nokogiri/version"
117
+ require_relative "nokogiri/class_resolver"
118
+ require_relative "nokogiri/syntax_error"
119
+ require_relative "nokogiri/xml"
120
+ require_relative "nokogiri/xslt"
121
+ require_relative "nokogiri/html4"
122
+ require_relative "nokogiri/html"
123
+ require_relative "nokogiri/decorators/slop"
124
+ require_relative "nokogiri/css"
125
+ require_relative "nokogiri/html4/builder"
126
+ require_relative "nokogiri/encoding_handler"
127
+
128
+ require_relative "nokogiri/html5" if Nokogiri.uses_gumbo?
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "nokogiri"
4
+
5
+ module XSD
6
+ module XMLParser
7
+ ###
8
+ # Nokogiri XML parser for soap4r.
9
+ #
10
+ # Nokogiri may be used as the XML parser in soap4r. Require 'xsd/xmlparser/nokogiri' in your
11
+ # soap4r applications, and soap4r will use Nokogiri as its XML parser. No other changes should
12
+ # be required to use Nokogiri as the XML parser.
13
+ #
14
+ # Example (using UW ITS Web Services):
15
+ #
16
+ # require 'rubygems'
17
+ # require 'nokogiri'
18
+ # gem 'soap4r'
19
+ # require 'defaultDriver'
20
+ # require 'xsd/xmlparser/nokogiri'
21
+ #
22
+ # obj = AvlPortType.new
23
+ # obj.getLatestByRoute(obj.getAgencies.first, 8).each do |bus|
24
+ # p "#{bus.routeID}, #{bus.longitude}, #{bus.latitude}"
25
+ # end
26
+ #
27
+ class Nokogiri < XSD::XMLParser::Parser
28
+ ###
29
+ # Create a new XSD parser with +host+ and +opt+
30
+ def initialize(host, opt = {})
31
+ super
32
+ @parser = ::Nokogiri::XML::SAX::Parser.new(self, @charset || "UTF-8")
33
+ end
34
+
35
+ ###
36
+ # Start parsing +string_or_readable+
37
+ def do_parse(string_or_readable)
38
+ @parser.parse(string_or_readable)
39
+ end
40
+
41
+ ###
42
+ # Handle the start_element event with +name+ and +attrs+
43
+ def start_element(name, attrs = [])
44
+ super(name, Hash[*attrs.flatten])
45
+ end
46
+
47
+ ###
48
+ # Handle the end_element event with +name+
49
+ def end_element(name)
50
+ super
51
+ end
52
+
53
+ ###
54
+ # Handle errors with message +msg+
55
+ def error(msg)
56
+ raise ParseError, msg
57
+ end
58
+ alias_method :warning, :error
59
+
60
+ ###
61
+ # Handle cdata_blocks containing +string+
62
+ def cdata_block(string)
63
+ characters(string)
64
+ end
65
+
66
+ ###
67
+ # Called at the beginning of an element
68
+ # +name+ is the element name
69
+ # +attrs+ is a list of attributes
70
+ # +prefix+ is the namespace prefix for the element
71
+ # +uri+ is the associated namespace URI
72
+ # +ns+ is a hash of namespace prefix:urls associated with the element
73
+ def start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = []) # rubocop:disable Metrics/ParameterLists
74
+ ###
75
+ # Deal with SAX v1 interface
76
+ name = [prefix, name].compact.join(":")
77
+ attributes = ns.map do |ns_prefix, ns_uri|
78
+ [["xmlns", ns_prefix].compact.join(":"), ns_uri]
79
+ end + attrs.map do |attr|
80
+ [[attr.prefix, attr.localname].compact.join(":"), attr.value]
81
+ end.flatten
82
+ start_element(name, attributes)
83
+ end
84
+
85
+ ###
86
+ # Called at the end of an element
87
+ # +name+ is the element's name
88
+ # +prefix+ is the namespace prefix associated with the element
89
+ # +uri+ is the associated namespace URI
90
+ def end_element_namespace(name, prefix = nil, uri = nil)
91
+ ###
92
+ # Deal with SAX v1 interface
93
+ end_element([prefix, name].compact.join(":"))
94
+ end
95
+
96
+ ["xmldecl", "start_document", "end_document", "comment"].each do |name|
97
+ class_eval <<~RUBY, __FILE__, __LINE__ + 1
98
+ def #{name}(*args); end
99
+ RUBY
100
+ end
101
+
102
+ add_factory(self)
103
+ end
104
+ end
105
+ end
@@ -0,0 +1,40 @@
1
+ From 27e4aa8d885e47a296ea78d114dbbe8fc7aa3508 Mon Sep 17 00:00:00 2001
2
+ From: Kevin Solorio <soloriok@gmail.com>
3
+ Date: Fri, 1 Feb 2019 14:32:42 -0800
4
+ Subject: [PATCH] Revert-support-html-h-b-7-1
5
+
6
+ ---
7
+ entities.c | 17 -----------------
8
+ 1 file changed, 17 deletions(-)
9
+
10
+ diff --git a/entities.c b/entities.c
11
+ index 43549bc5..82652f6d 100644
12
+ --- a/entities.c
13
+ +++ b/entities.c
14
+ @@ -623,23 +623,6 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) {
15
+ *out++ = 't';
16
+ *out++ = ';';
17
+ } else if (*cur == '&') {
18
+ - /*
19
+ - * Special handling of &{...} construct from HTML 4, see
20
+ - * http://www.w3.org/TR/html401/appendix/notes.html#h-B.7.1
21
+ - */
22
+ - if (html && attr && (cur[1] == '{') &&
23
+ - (strchr((const char *) cur, '}'))) {
24
+ - while (*cur != '}') {
25
+ - *out++ = *cur++;
26
+ - indx = out - buffer;
27
+ - if (indx + 100 > buffer_size) {
28
+ - growBufferReentrant();
29
+ - out = &buffer[indx];
30
+ - }
31
+ - }
32
+ - *out++ = *cur++;
33
+ - continue;
34
+ - }
35
+ *out++ = '&';
36
+ *out++ = 'a';
37
+ *out++ = 'm';
38
+ --
39
+ 2.16.2
40
+
@@ -0,0 +1,44 @@
1
+ From ffc08467744bd2305d41ca882c37fa30adf3a067 Mon Sep 17 00:00:00 2001
2
+ From: Kevin Solorio <soloriok@gmail.com>
3
+ Date: Wed, 27 Feb 2019 14:34:17 -0800
4
+ Subject: [PATCH 2/2] update entities.c to remove handling of ssi
5
+
6
+ ---
7
+ entities.c | 21 ---------------------
8
+ 1 file changed, 21 deletions(-)
9
+
10
+ diff --git a/entities.c b/entities.c
11
+ index 43549bc5..5c4a2a60 100644
12
+ --- a/entities.c
13
+ +++ b/entities.c
14
+ @@ -592,27 +592,6 @@ xmlEncodeEntitiesInternal(xmlDocPtr doc, const xmlChar *input, int attr) {
15
+ * By default one have to encode at least '<', '>', '"' and '&' !
16
+ */
17
+ if (*cur == '<') {
18
+ - const xmlChar *end;
19
+ -
20
+ - /*
21
+ - * Special handling of server side include in HTML attributes
22
+ - */
23
+ - if (html && attr &&
24
+ - (cur[1] == '!') && (cur[2] == '-') && (cur[3] == '-') &&
25
+ - ((end = xmlStrstr(cur, BAD_CAST "-->")) != NULL)) {
26
+ - while (cur != end) {
27
+ - *out++ = *cur++;
28
+ - indx = out - buffer;
29
+ - if (indx + 100 > buffer_size) {
30
+ - growBufferReentrant();
31
+ - out = &buffer[indx];
32
+ - }
33
+ - }
34
+ - *out++ = *cur++;
35
+ - *out++ = *cur++;
36
+ - *out++ = *cur++;
37
+ - continue;
38
+ - }
39
+ *out++ = '&';
40
+ *out++ = 'l';
41
+ *out++ = 't';
42
+ --
43
+ 2.16.2
44
+
@@ -0,0 +1,77 @@
1
+ From 74c95ec5932c737d4fcb06b8646b0017364ada14 Mon Sep 17 00:00:00 2001
2
+ From: Mike Dalessio <mike.dalessio@gmail.com>
3
+ Date: Fri, 24 Dec 2021 19:08:01 -0500
4
+ Subject: [PATCH] attempt to hack in wildcard namespaces to xpath
5
+
6
+ I'm not confident this is a bulletproof patch.
7
+ ---
8
+ xpath.c | 24 ++++++++++++++++++------
9
+ 1 file changed, 18 insertions(+), 6 deletions(-)
10
+
11
+ diff --git a/xpath.c b/xpath.c
12
+ index 1aa2f1a..c7f0885 100644
13
+ --- a/xpath.c
14
+ +++ b/xpath.c
15
+ @@ -146,6 +146,9 @@
16
+ #define XPATH_MAX_RECURSION_DEPTH 5000
17
+ #endif
18
+
19
+ +#define WILDCARD_PREFIX "*"
20
+ +#define IS_WILDCARD_PREFIX(p) xmlStrEqual((xmlChar*)WILDCARD_PREFIX, p)
21
+ +
22
+ /*
23
+ * TODO:
24
+ * There are a few spots where some tests are done which depend upon ascii
25
+ @@ -11073,12 +11076,15 @@ xmlXPathCompNodeTest(xmlXPathParserContextPtr ctxt, xmlXPathTestVal *test,
26
+ SKIP_BLANKS;
27
+
28
+ if ((name == NULL) && (CUR == '*')) {
29
+ - /*
30
+ - * All elements
31
+ - */
32
+ NEXT;
33
+ - *test = NODE_TEST_ALL;
34
+ - return(NULL);
35
+ + if (CUR != ':') {
36
+ + /*
37
+ + * All elements
38
+ + */
39
+ + *test = NODE_TEST_ALL;
40
+ + return(NULL);
41
+ + }
42
+ + name = xmlCharStrdup(WILDCARD_PREFIX);
43
+ }
44
+
45
+ if (name == NULL)
46
+ @@ -11327,6 +11333,10 @@ xmlXPathCompStep(xmlXPathParserContextPtr ctxt) {
47
+ }
48
+ #endif
49
+ if (CUR == '*') {
50
+ + if (NXT(1) == ':') {
51
+ + NEXT;
52
+ + name = xmlCharStrdup(WILDCARD_PREFIX);
53
+ + }
54
+ axis = AXIS_CHILD;
55
+ } else {
56
+ if (name == NULL)
57
+ @@ -12030,7 +12040,7 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
58
+ /*
59
+ * Setup namespaces.
60
+ */
61
+ - if (prefix != NULL) {
62
+ + if (prefix != NULL && !IS_WILDCARD_PREFIX(prefix)) {
63
+ URI = xmlXPathNsLookup(xpctxt, prefix);
64
+ if (URI == NULL) {
65
+ xmlXPathReleaseObject(xpctxt, obj);
66
+ @@ -12369,6 +12379,8 @@ xmlXPathNodeCollectAndTest(xmlXPathParserContextPtr ctxt,
67
+ {
68
+ XP_TEST_HIT
69
+ }
70
+ + } else if (IS_WILDCARD_PREFIX(prefix)) {
71
+ + XP_TEST_HIT
72
+ } else {
73
+ if ((cur->ns != NULL) &&
74
+ (xmlStrEqual(URI, cur->ns->href)))
75
+ --
76
+ 2.31.0
77
+