nokogiri 1.11.0-arm64-darwin

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.

Files changed (219) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE-DEPENDENCIES.md +1682 -0
  4. data/LICENSE.md +9 -0
  5. data/README.md +272 -0
  6. data/bin/nokogiri +118 -0
  7. data/dependencies.yml +74 -0
  8. data/ext/nokogiri/depend +477 -0
  9. data/ext/nokogiri/extconf.rb +836 -0
  10. data/ext/nokogiri/html_document.c +171 -0
  11. data/ext/nokogiri/html_document.h +10 -0
  12. data/ext/nokogiri/html_element_description.c +279 -0
  13. data/ext/nokogiri/html_element_description.h +10 -0
  14. data/ext/nokogiri/html_entity_lookup.c +32 -0
  15. data/ext/nokogiri/html_entity_lookup.h +8 -0
  16. data/ext/nokogiri/html_sax_parser_context.c +116 -0
  17. data/ext/nokogiri/html_sax_parser_context.h +11 -0
  18. data/ext/nokogiri/html_sax_push_parser.c +87 -0
  19. data/ext/nokogiri/html_sax_push_parser.h +9 -0
  20. data/ext/nokogiri/include/libexslt/exslt.h +102 -0
  21. data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
  22. data/ext/nokogiri/include/libexslt/exsltexports.h +140 -0
  23. data/ext/nokogiri/include/libxml2/libxml/DOCBparser.h +96 -0
  24. data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +306 -0
  25. data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
  26. data/ext/nokogiri/include/libxml2/libxml/SAX.h +173 -0
  27. data/ext/nokogiri/include/libxml2/libxml/SAX2.h +178 -0
  28. data/ext/nokogiri/include/libxml2/libxml/c14n.h +126 -0
  29. data/ext/nokogiri/include/libxml2/libxml/catalog.h +182 -0
  30. data/ext/nokogiri/include/libxml2/libxml/chvalid.h +230 -0
  31. data/ext/nokogiri/include/libxml2/libxml/debugXML.h +217 -0
  32. data/ext/nokogiri/include/libxml2/libxml/dict.h +79 -0
  33. data/ext/nokogiri/include/libxml2/libxml/encoding.h +245 -0
  34. data/ext/nokogiri/include/libxml2/libxml/entities.h +151 -0
  35. data/ext/nokogiri/include/libxml2/libxml/globals.h +508 -0
  36. data/ext/nokogiri/include/libxml2/libxml/hash.h +236 -0
  37. data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
  38. data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +163 -0
  39. data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +81 -0
  40. data/ext/nokogiri/include/libxml2/libxml/parser.h +1241 -0
  41. data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +644 -0
  42. data/ext/nokogiri/include/libxml2/libxml/pattern.h +100 -0
  43. data/ext/nokogiri/include/libxml2/libxml/relaxng.h +217 -0
  44. data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +958 -0
  45. data/ext/nokogiri/include/libxml2/libxml/schematron.h +142 -0
  46. data/ext/nokogiri/include/libxml2/libxml/threads.h +89 -0
  47. data/ext/nokogiri/include/libxml2/libxml/tree.h +1311 -0
  48. data/ext/nokogiri/include/libxml2/libxml/uri.h +94 -0
  49. data/ext/nokogiri/include/libxml2/libxml/valid.h +458 -0
  50. data/ext/nokogiri/include/libxml2/libxml/xinclude.h +129 -0
  51. data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
  52. data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +366 -0
  53. data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
  54. data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +945 -0
  55. data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +153 -0
  56. data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +224 -0
  57. data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
  58. data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +428 -0
  59. data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +222 -0
  60. data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +88 -0
  61. data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +246 -0
  62. data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +151 -0
  63. data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
  64. data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +202 -0
  65. data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +485 -0
  66. data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +488 -0
  67. data/ext/nokogiri/include/libxml2/libxml/xpath.h +566 -0
  68. data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +632 -0
  69. data/ext/nokogiri/include/libxml2/libxml/xpointer.h +114 -0
  70. data/ext/nokogiri/include/libxslt/attributes.h +38 -0
  71. data/ext/nokogiri/include/libxslt/documents.h +93 -0
  72. data/ext/nokogiri/include/libxslt/extensions.h +262 -0
  73. data/ext/nokogiri/include/libxslt/extra.h +72 -0
  74. data/ext/nokogiri/include/libxslt/functions.h +78 -0
  75. data/ext/nokogiri/include/libxslt/imports.h +75 -0
  76. data/ext/nokogiri/include/libxslt/keys.h +53 -0
  77. data/ext/nokogiri/include/libxslt/namespaces.h +68 -0
  78. data/ext/nokogiri/include/libxslt/numbersInternals.h +73 -0
  79. data/ext/nokogiri/include/libxslt/pattern.h +84 -0
  80. data/ext/nokogiri/include/libxslt/preproc.h +43 -0
  81. data/ext/nokogiri/include/libxslt/security.h +104 -0
  82. data/ext/nokogiri/include/libxslt/templates.h +77 -0
  83. data/ext/nokogiri/include/libxslt/transform.h +207 -0
  84. data/ext/nokogiri/include/libxslt/variables.h +118 -0
  85. data/ext/nokogiri/include/libxslt/xslt.h +110 -0
  86. data/ext/nokogiri/include/libxslt/xsltInternals.h +1978 -0
  87. data/ext/nokogiri/include/libxslt/xsltconfig.h +180 -0
  88. data/ext/nokogiri/include/libxslt/xsltexports.h +142 -0
  89. data/ext/nokogiri/include/libxslt/xsltlocale.h +76 -0
  90. data/ext/nokogiri/include/libxslt/xsltutils.h +313 -0
  91. data/ext/nokogiri/nokogiri.c +135 -0
  92. data/ext/nokogiri/nokogiri.h +130 -0
  93. data/ext/nokogiri/xml_attr.c +103 -0
  94. data/ext/nokogiri/xml_attr.h +9 -0
  95. data/ext/nokogiri/xml_attribute_decl.c +70 -0
  96. data/ext/nokogiri/xml_attribute_decl.h +9 -0
  97. data/ext/nokogiri/xml_cdata.c +62 -0
  98. data/ext/nokogiri/xml_cdata.h +9 -0
  99. data/ext/nokogiri/xml_comment.c +69 -0
  100. data/ext/nokogiri/xml_comment.h +9 -0
  101. data/ext/nokogiri/xml_document.c +622 -0
  102. data/ext/nokogiri/xml_document.h +23 -0
  103. data/ext/nokogiri/xml_document_fragment.c +48 -0
  104. data/ext/nokogiri/xml_document_fragment.h +10 -0
  105. data/ext/nokogiri/xml_dtd.c +202 -0
  106. data/ext/nokogiri/xml_dtd.h +10 -0
  107. data/ext/nokogiri/xml_element_content.c +123 -0
  108. data/ext/nokogiri/xml_element_content.h +10 -0
  109. data/ext/nokogiri/xml_element_decl.c +69 -0
  110. data/ext/nokogiri/xml_element_decl.h +9 -0
  111. data/ext/nokogiri/xml_encoding_handler.c +79 -0
  112. data/ext/nokogiri/xml_encoding_handler.h +8 -0
  113. data/ext/nokogiri/xml_entity_decl.c +110 -0
  114. data/ext/nokogiri/xml_entity_decl.h +10 -0
  115. data/ext/nokogiri/xml_entity_reference.c +52 -0
  116. data/ext/nokogiri/xml_entity_reference.h +9 -0
  117. data/ext/nokogiri/xml_io.c +63 -0
  118. data/ext/nokogiri/xml_io.h +11 -0
  119. data/ext/nokogiri/xml_libxml2_hacks.c +112 -0
  120. data/ext/nokogiri/xml_libxml2_hacks.h +12 -0
  121. data/ext/nokogiri/xml_namespace.c +111 -0
  122. data/ext/nokogiri/xml_namespace.h +14 -0
  123. data/ext/nokogiri/xml_node.c +1773 -0
  124. data/ext/nokogiri/xml_node.h +13 -0
  125. data/ext/nokogiri/xml_node_set.c +486 -0
  126. data/ext/nokogiri/xml_node_set.h +12 -0
  127. data/ext/nokogiri/xml_processing_instruction.c +56 -0
  128. data/ext/nokogiri/xml_processing_instruction.h +9 -0
  129. data/ext/nokogiri/xml_reader.c +657 -0
  130. data/ext/nokogiri/xml_reader.h +10 -0
  131. data/ext/nokogiri/xml_relax_ng.c +179 -0
  132. data/ext/nokogiri/xml_relax_ng.h +9 -0
  133. data/ext/nokogiri/xml_sax_parser.c +305 -0
  134. data/ext/nokogiri/xml_sax_parser.h +39 -0
  135. data/ext/nokogiri/xml_sax_parser_context.c +262 -0
  136. data/ext/nokogiri/xml_sax_parser_context.h +10 -0
  137. data/ext/nokogiri/xml_sax_push_parser.c +159 -0
  138. data/ext/nokogiri/xml_sax_push_parser.h +9 -0
  139. data/ext/nokogiri/xml_schema.c +276 -0
  140. data/ext/nokogiri/xml_schema.h +9 -0
  141. data/ext/nokogiri/xml_syntax_error.c +64 -0
  142. data/ext/nokogiri/xml_syntax_error.h +13 -0
  143. data/ext/nokogiri/xml_text.c +52 -0
  144. data/ext/nokogiri/xml_text.h +9 -0
  145. data/ext/nokogiri/xml_xpath_context.c +374 -0
  146. data/ext/nokogiri/xml_xpath_context.h +10 -0
  147. data/ext/nokogiri/xslt_stylesheet.c +263 -0
  148. data/ext/nokogiri/xslt_stylesheet.h +14 -0
  149. data/lib/nokogiri.rb +144 -0
  150. data/lib/nokogiri/2.5/nokogiri.bundle +0 -0
  151. data/lib/nokogiri/2.6/nokogiri.bundle +0 -0
  152. data/lib/nokogiri/2.7/nokogiri.bundle +0 -0
  153. data/lib/nokogiri/3.0/nokogiri.bundle +0 -0
  154. data/lib/nokogiri/css.rb +28 -0
  155. data/lib/nokogiri/css/node.rb +53 -0
  156. data/lib/nokogiri/css/parser.rb +751 -0
  157. data/lib/nokogiri/css/parser.y +272 -0
  158. data/lib/nokogiri/css/parser_extras.rb +94 -0
  159. data/lib/nokogiri/css/syntax_error.rb +8 -0
  160. data/lib/nokogiri/css/tokenizer.rb +154 -0
  161. data/lib/nokogiri/css/tokenizer.rex +55 -0
  162. data/lib/nokogiri/css/xpath_visitor.rb +260 -0
  163. data/lib/nokogiri/decorators/slop.rb +43 -0
  164. data/lib/nokogiri/html.rb +38 -0
  165. data/lib/nokogiri/html/builder.rb +36 -0
  166. data/lib/nokogiri/html/document.rb +322 -0
  167. data/lib/nokogiri/html/document_fragment.rb +50 -0
  168. data/lib/nokogiri/html/element_description.rb +24 -0
  169. data/lib/nokogiri/html/element_description_defaults.rb +672 -0
  170. data/lib/nokogiri/html/entity_lookup.rb +14 -0
  171. data/lib/nokogiri/html/sax/parser.rb +63 -0
  172. data/lib/nokogiri/html/sax/parser_context.rb +17 -0
  173. data/lib/nokogiri/html/sax/push_parser.rb +37 -0
  174. data/lib/nokogiri/jruby/dependencies.rb +20 -0
  175. data/lib/nokogiri/syntax_error.rb +5 -0
  176. data/lib/nokogiri/version.rb +3 -0
  177. data/lib/nokogiri/version/constant.rb +5 -0
  178. data/lib/nokogiri/version/info.rb +182 -0
  179. data/lib/nokogiri/xml.rb +76 -0
  180. data/lib/nokogiri/xml/attr.rb +15 -0
  181. data/lib/nokogiri/xml/attribute_decl.rb +19 -0
  182. data/lib/nokogiri/xml/builder.rb +447 -0
  183. data/lib/nokogiri/xml/cdata.rb +12 -0
  184. data/lib/nokogiri/xml/character_data.rb +8 -0
  185. data/lib/nokogiri/xml/document.rb +290 -0
  186. data/lib/nokogiri/xml/document_fragment.rb +159 -0
  187. data/lib/nokogiri/xml/dtd.rb +33 -0
  188. data/lib/nokogiri/xml/element_content.rb +37 -0
  189. data/lib/nokogiri/xml/element_decl.rb +14 -0
  190. data/lib/nokogiri/xml/entity_decl.rb +20 -0
  191. data/lib/nokogiri/xml/entity_reference.rb +19 -0
  192. data/lib/nokogiri/xml/namespace.rb +14 -0
  193. data/lib/nokogiri/xml/node.rb +1240 -0
  194. data/lib/nokogiri/xml/node/save_options.rb +62 -0
  195. data/lib/nokogiri/xml/node_set.rb +372 -0
  196. data/lib/nokogiri/xml/notation.rb +7 -0
  197. data/lib/nokogiri/xml/parse_options.rb +127 -0
  198. data/lib/nokogiri/xml/pp.rb +3 -0
  199. data/lib/nokogiri/xml/pp/character_data.rb +19 -0
  200. data/lib/nokogiri/xml/pp/node.rb +57 -0
  201. data/lib/nokogiri/xml/processing_instruction.rb +9 -0
  202. data/lib/nokogiri/xml/reader.rb +116 -0
  203. data/lib/nokogiri/xml/relax_ng.rb +37 -0
  204. data/lib/nokogiri/xml/sax.rb +5 -0
  205. data/lib/nokogiri/xml/sax/document.rb +172 -0
  206. data/lib/nokogiri/xml/sax/parser.rb +123 -0
  207. data/lib/nokogiri/xml/sax/parser_context.rb +17 -0
  208. data/lib/nokogiri/xml/sax/push_parser.rb +61 -0
  209. data/lib/nokogiri/xml/schema.rb +72 -0
  210. data/lib/nokogiri/xml/searchable.rb +239 -0
  211. data/lib/nokogiri/xml/syntax_error.rb +71 -0
  212. data/lib/nokogiri/xml/text.rb +10 -0
  213. data/lib/nokogiri/xml/xpath.rb +11 -0
  214. data/lib/nokogiri/xml/xpath/syntax_error.rb +12 -0
  215. data/lib/nokogiri/xml/xpath_context.rb +17 -0
  216. data/lib/nokogiri/xslt.rb +57 -0
  217. data/lib/nokogiri/xslt/stylesheet.rb +26 -0
  218. data/lib/xsd/xmlparser/nokogiri.rb +103 -0
  219. metadata +499 -0
@@ -0,0 +1,9 @@
1
+ The MIT License
2
+
3
+ Copyright 2008 -- 2018 by Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo, Patrick Mahoney, Yoko Harada, Akinori MUSHA, John Shahid, Lars Kanis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,272 @@
1
+ <div><img src="https://nokogiri.org/images/nokogiri-serif-black.png" align="right"/></div>
2
+
3
+ # Nokogiri
4
+
5
+ Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a sensible, easy-to-understand API for reading, writing, modifying, and querying documents. It is fast and standards-compliant by relying on native parsers like libxml2 (C) and xerces (Java).
6
+
7
+ ## Guiding Principles
8
+
9
+ Some guiding principles Nokogiri tries to follow:
10
+
11
+ - be secure-by-default by treating all documents as **untrusted** by default
12
+ - be a **thin-as-reasonable layer** on top of the underlying parsers, and don't attempt to fix behavioral differences between the parsers
13
+
14
+
15
+ ## Features Overview
16
+
17
+ - DOM Parser for XML and HTML4
18
+ - SAX Parser for XML and HTML4
19
+ - Push Parser for XML and HTML4
20
+ - Document search via XPath 1.0
21
+ - Document search via CSS3 selectors, with some jquery-like extensions
22
+ - XSD Schema validation
23
+ - XSLT transformation
24
+ - "Builder" DSL for XML and HTML documents
25
+
26
+
27
+ ## Status
28
+
29
+ [![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/nokogiri/jobs/cruby-2.7/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/nokogiri)
30
+ [![Appveyor CI](https://ci.appveyor.com/api/projects/status/xj2pqwvlxwuwgr06/branch/master?svg=true)](https://ci.appveyor.com/project/flavorjones/nokogiri/branch/master)
31
+ [![Code Climate](https://codeclimate.com/github/sparklemotion/nokogiri.svg)](https://codeclimate.com/github/sparklemotion/nokogiri)
32
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/59c67b0e8976027a45ad/test_coverage)](https://codeclimate.com/github/sparklemotion/nokogiri/test_coverage)
33
+
34
+ [![Gem Version](https://badge.fury.io/rb/nokogiri.svg)](https://rubygems.org/gems/nokogiri)
35
+ [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score/?dependency-name=nokogiri&package-manager=bundler)
36
+ [![Tidelift dependencies](https://tidelift.com/badges/package/rubygems/nokogiri)](https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme)
37
+
38
+
39
+ ## Support and Help
40
+
41
+ All official documentation is posted at https://nokogiri.org (the source for which is at https://github.com/sparklemotion/nokogiri.org/, and we welcome contributions).
42
+
43
+ ### Reading
44
+
45
+ Your first stops for API documentation should be:
46
+
47
+ - RDocs: https://nokogiri.org/rdoc/index.html
48
+ - An excellent community-maintained [Cheat Sheet](https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet)
49
+
50
+
51
+ ### Questions
52
+
53
+ If you'd like to talk to a human:
54
+
55
+ - The Discord chat channel is `#nokogiri-💎` at https://discord.gg/UyQnKrT
56
+ - The Gitter chat channel is https://gitter.im/sparklemotion/nokogiri
57
+ - The IRC chat channel is `#nokogiri` on freenode.
58
+ - The Nokogiri mailing list is active at https://groups.google.com/group/nokogiri-talk
59
+ - The Nokogiri bug tracker is at https://github.com/sparklemotion/nokogiri/issues
60
+
61
+ Consider subscribing to [Tidelift][tidelift] which provides license assurances and timely security notifications for your open source dependencies, including Nokogiri. [Tidelift][tidelift] subscriptions also help the Nokogiri maintainers fund our [automated testing](https://ci.nokogiri.org) which in turn allows us to ship releases, bugfixes, and security updates more often.
62
+
63
+ [tidelift]: https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme
64
+
65
+
66
+ ### Security and Vulnerability Reporting
67
+
68
+ Please report vulnerabilities at https://hackerone.com/nokogiri
69
+
70
+ Full information and description of our security policy is in [`SECURITY.md`](SECURITY.md)
71
+
72
+
73
+ ### Semantic Versioning Policy
74
+
75
+ Nokogiri follows [Semantic Versioning](https://semver.org/) (since 2017 or so). [![Dependabot's SemVer compatibility score for Nokogiri](https://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score/?dependency-name=nokogiri&package-manager=bundler)
76
+
77
+ We bump `Major.Minor.Patch` versions following this guidance:
78
+
79
+ `Major`: (we've never done this)
80
+
81
+ - Significant backwards-incompatible changes to the public API that would require rewriting existing application code.
82
+ - Some examples of backwards-incompatible changes we might someday consider for a Major release are at [`ROADMAP.md`](ROADMAP.md).
83
+
84
+ `Minor`:
85
+
86
+ - Features and bugfixes.
87
+ - Updating packaged libraries for non-security-related reasons.
88
+ - Dropping support for EOLed Ruby versions. [Some folks find this objectionable](https://github.com/sparklemotion/nokogiri/issues/1568), but [SemVer says this is OK if the public API hasn't changed](https://semver.org/#what-should-i-do-if-i-update-my-own-dependencies-without-changing-the-public-api).
89
+ - Backwards-incompatible changes to internal or private methods and constants. These are detailed in the "Changes" section of each changelog entry.
90
+
91
+ `Patch`:
92
+
93
+ - Bugfixes.
94
+ - Security updates.
95
+ - Updating packaged libraries for security-related reasons.
96
+
97
+
98
+ ## Installation
99
+
100
+ Requirements:
101
+
102
+ - Ruby >= 2.5
103
+ - JRuby >= 9.2.0.0
104
+
105
+
106
+ ### Native Gems: Faster, more reliable installation
107
+
108
+ "Native gems" contain pre-compiled libraries for a specific machine architecture. On supported platforms, this removes the need for compiling the C extension and the packaged libraries, or for system dependencies to exist. This results in **much faster installation** and **more reliable installation**, which as you probably know are the biggest headaches for Nokogiri users.
109
+
110
+ ### Supported Platforms
111
+
112
+ As of v1.11.0, Nokogiri ships pre-compiled, "native" gems for the following platforms:
113
+
114
+ - Linux: `x86-linux` and `x86_64-linux` (req: `glibc >= 2.17`), including musl platforms like Alpine
115
+ - Darwin/MacOS: `x86_64-darwin` and `arm64-darwin`
116
+ - Windows: `x86-mingw32` and `x64-mingw32`
117
+ - Java: any platform running JRuby 9.2 or higher
118
+
119
+ To determine whether your system supports one of these gems, look at the output of `bundle platform` or `ruby -e 'puts Gem::Platform.local.to_s'`.
120
+
121
+ If you're on a supported platform, either `gem install` or `bundle install` should install a native gem without any additional action on your part. This installation should only take a few seconds, and your output should look something like:
122
+
123
+ ``` sh
124
+ $ gem install nokogiri
125
+ Fetching nokogiri-1.11.0-x86_64-linux.gem
126
+ Successfully installed nokogiri-1.11.0-x86_64-linux
127
+ 1 gem installed
128
+ ```
129
+
130
+
131
+ ### Other Installation Options
132
+
133
+ Because Nokogiri is a C extension, it requires that you have a C compiler toolchain, Ruby development header files, and some system dependencies installed.
134
+
135
+ The following may work for you if you have an appropriately-configured system:
136
+
137
+ ``` bash
138
+ gem install nokogiri
139
+ ```
140
+
141
+ If you have any issues, please visit [Installing Nokogiri](https://nokogiri.org/tutorials/installing_nokogiri.html) for more complete instructions and troubleshooting.
142
+
143
+
144
+ ## How To Use Nokogiri
145
+
146
+ Nokogiri is a large library, and so it's challenging to briefly summarize it. We've tried to provide long, real-world examples at [Tutorials](https://nokogiri.org/tutorials/toc.html).
147
+
148
+ ### Parsing and Querying
149
+
150
+ Here is example usage for parsing and querying a document:
151
+
152
+ ```ruby
153
+ #! /usr/bin/env ruby
154
+
155
+ require 'nokogiri'
156
+ require 'open-uri'
157
+
158
+ # Fetch and parse HTML document
159
+ doc = Nokogiri::HTML(URI.open('https://nokogiri.org/tutorials/installing_nokogiri.html'))
160
+
161
+ # Search for nodes by css
162
+ doc.css('nav ul.menu li a', 'article h2').each do |link|
163
+ puts link.content
164
+ end
165
+
166
+ # Search for nodes by xpath
167
+ doc.xpath('//nav//ul//li/a', '//article//h2').each do |link|
168
+ puts link.content
169
+ end
170
+
171
+ # Or mix and match
172
+ doc.search('nav ul.menu li a', '//article//h2').each do |link|
173
+ puts link.content
174
+ end
175
+ ```
176
+
177
+
178
+ ### Encoding
179
+
180
+ Strings are always stored as UTF-8 internally. Methods that return
181
+ text values will always return UTF-8 encoded strings. Methods that
182
+ return a string containing markup (like `to_xml`, `to_html` and
183
+ `inner_html`) will return a string encoded like the source document.
184
+
185
+ __WARNING__
186
+
187
+ Some documents declare one encoding, but actually use a different
188
+ one. In these cases, which encoding should the parser choose?
189
+
190
+ Data is just a stream of bytes. Humans add meaning to that stream. Any
191
+ particular set of bytes could be valid characters in multiple
192
+ encodings, so detecting encoding with 100% accuracy is not
193
+ possible. `libxml2` does its best, but it can't be right all the time.
194
+
195
+ If you want Nokogiri to handle the document encoding properly, your
196
+ best bet is to explicitly set the encoding. Here is an example of
197
+ explicitly setting the encoding to EUC-JP on the parser:
198
+
199
+ ```ruby
200
+ doc = Nokogiri.XML('<foo><bar /></foo>', nil, 'EUC-JP')
201
+ ```
202
+
203
+
204
+ ## Technical Overview
205
+
206
+ ### Guiding Principles
207
+
208
+ As noted above, two guiding principles of the software are:
209
+
210
+ - be secure-by-default by treating all documents as **untrusted** by default
211
+ - be a **thin-as-reasonable layer** on top of the underlying parsers, and don't attempt to fix behavioral differences between the parsers
212
+
213
+ Notably, despite all parsers being standards-compliant, there are behavioral inconsistencies between the parsers used in the CRuby and JRuby implementations, and Nokogiri does not and should not attempt to remove these inconsistencies. Instead, we surface these differences in the test suite when they are important/semantic; or we intentionally write tests to depend only on the important/semantic bits (omitting whitespace from regex matchers on results, for example).
214
+
215
+
216
+ ### CRuby
217
+
218
+ The Ruby (a.k.a., CRuby, MRI, YARV) implementation is a C extension that depends on libxml2 and libxslt (which in turn depend on zlib and possibly libiconv).
219
+
220
+ These dependencies are met by default by Nokogiri's packaged versions of the libxml2 and libxslt source code, but a configuration option `--use-system-libraries` is provided to allow specification of alternative library locations. See [Installing Nokogiri](https://nokogiri.org/tutorials/installing_nokogiri.html) for full documentation.
221
+
222
+ We provide native gems by pre-compiling libxml2 and libxslt (and potentially zlib and libiconv) and packaging them into the gem file. In this case, no compilation is necessary at installation time, which leads to faster and more reliable installation.
223
+
224
+ See [`LICENSE-DEPENDENCIES.md`](LICENSE-DEPENDENCIES.md) for more information on which dependencies are provided in which native and source gems.
225
+
226
+
227
+ ### JRuby
228
+
229
+ The Java (a.k.a. JRuby) implementation is a Java extension that depends primarily on Xerces and NekoHTML for parsing, though additional dependencies are on `isorelax`, `nekodtd`, `jing`, `serializer`, `xalan-j`, and `xml-apis`.
230
+
231
+ These dependencies are provided by pre-compiled jar files packaged in the `java` platform gem.
232
+
233
+ See [`LICENSE-DEPENDENCIES.md`](LICENSE-DEPENDENCIES.md) for more information on which dependencies are provided in which native and source gems.
234
+
235
+
236
+ ## Contributing
237
+
238
+ ```bash
239
+ bundle install
240
+ bundle exec rake compile test
241
+ ```
242
+
243
+
244
+ ## Code of Conduct
245
+
246
+ We've adopted the Contributor Covenant code of conduct, which you can read in full in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md).
247
+
248
+
249
+ ## License
250
+
251
+ This project is licensed under the terms of the MIT license.
252
+
253
+ See this license at [`LICENSE.md`](LICENSE.md).
254
+
255
+
256
+ ### Dependencies
257
+
258
+ Some additional libraries may be distributed with your version of Nokogiri. Please see [`LICENSE-DEPENDENCIES.md`](LICENSE-DEPENDENCIES.md) for a discussion of the variations as well as the licenses thereof.
259
+
260
+
261
+ ## Authors
262
+
263
+ - Mike Dalessio
264
+ - Aaron Patterson
265
+ - Yoko Harada
266
+ - Akinori MUSHA
267
+ - John Shahid
268
+ - Karol Bucek
269
+ - Lars Kanis
270
+ - Sergio Arbeo
271
+ - Timothy Elliott
272
+ - Nobuyoshi Nakada
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env ruby
2
+ require 'optparse'
3
+ require 'open-uri'
4
+ require 'uri'
5
+ require 'rubygems'
6
+ require 'nokogiri'
7
+ autoload :IRB, 'irb'
8
+
9
+ parse_class = Nokogiri
10
+ encoding = nil
11
+
12
+ # This module provides some tunables with the nokogiri CLI for use in
13
+ # your ~/.nokogirirc.
14
+ module Nokogiri::CLI
15
+ class << self
16
+ # Specify the console engine, defaulted to IRB.
17
+ #
18
+ # call-seq:
19
+ # require 'pry'
20
+ # Nokogiri::CLI.console = Pry
21
+ attr_writer :console
22
+
23
+ def console
24
+ case @console
25
+ when Symbol
26
+ Kernel.const_get(@console)
27
+ else
28
+ @console
29
+ end
30
+ end
31
+
32
+ attr_accessor :rcfile
33
+ end
34
+
35
+ self.rcfile = File.expand_path('~/.nokogirirc')
36
+ self.console = :IRB
37
+ end
38
+
39
+ opts = OptionParser.new do |opts|
40
+ opts.banner = "Nokogiri: an HTML, XML, SAX, and Reader parser"
41
+ opts.define_head "Usage: nokogiri <uri|path> [options]"
42
+ opts.separator ""
43
+ opts.separator "Examples:"
44
+ opts.separator " nokogiri https://www.ruby-lang.org/"
45
+ opts.separator " nokogiri ./public/index.html"
46
+ opts.separator " curl -s http://www.nokogiri.org | nokogiri -e'p $_.css(\"h1\").length'"
47
+ opts.separator ""
48
+ opts.separator "Options:"
49
+
50
+ opts.on("--type type", "Parse as type: xml or html (default: auto)", [:xml, :html]) do |v|
51
+ parse_class = {:xml => Nokogiri::XML, :html => Nokogiri::HTML}[v]
52
+ end
53
+
54
+ opts.on("-C file", "Specifies initialization file to load (default #{Nokogiri::CLI.rcfile})") do |v|
55
+ Nokogiri::CLI.rcfile = v
56
+ end
57
+
58
+ opts.on("-E", "--encoding encoding", "Read as encoding (default: #{encoding || 'none'})") do |v|
59
+ encoding = v
60
+ end
61
+
62
+ opts.on("-e command", "Specifies script from command-line.") do |v|
63
+ @script = v
64
+ end
65
+
66
+ opts.on("--rng <uri|path>", "Validate using this rng file.") do |v|
67
+ @rng = open(v) {|f| Nokogiri::XML::RelaxNG(f)}
68
+ end
69
+
70
+ opts.on_tail("-?", "--help", "Show this message") do
71
+ puts opts
72
+ exit
73
+ end
74
+
75
+ opts.on_tail("-v", "--version", "Show version") do
76
+ puts Nokogiri::VersionInfo.instance.to_markdown
77
+ exit
78
+ end
79
+ end
80
+ opts.parse!
81
+
82
+ url = ARGV.shift
83
+
84
+ if url.to_s.strip.empty? && $stdin.tty?
85
+ puts opts
86
+ exit 1
87
+ end
88
+
89
+ if File.file?(Nokogiri::CLI.rcfile)
90
+ load Nokogiri::CLI.rcfile
91
+ end
92
+
93
+ if url || $stdin.tty?
94
+ case uri = (URI(url) rescue url)
95
+ when URI::HTTP
96
+ @doc = parse_class.parse(uri.read, url, encoding)
97
+ else
98
+ @doc = parse_class.parse(open(url).read, nil, encoding)
99
+ end
100
+ else
101
+ @doc = parse_class.parse($stdin, nil, encoding)
102
+ end
103
+
104
+ $_ = @doc
105
+
106
+ if @rng
107
+ @rng.validate(@doc).each do |error|
108
+ puts error.message
109
+ end
110
+ else
111
+ if @script
112
+ eval @script, binding, '<main>'
113
+ else
114
+ puts "Your document is stored in @doc..."
115
+ Nokogiri::CLI.console.start
116
+ end
117
+ end
118
+
@@ -0,0 +1,74 @@
1
+ libxml2:
2
+ version: "2.9.10"
3
+ sha256: "aafee193ffb8fe0c82d4afef6ef91972cbaf5feea100edc2f262750611b4be1f"
4
+ # manually verified checksum:
5
+ #
6
+ # $ gpg --verify libxml2-2.9.10.tar.gz.asc ports/archives/libxml2-2.9.10.tar.gz
7
+ # gpg: Signature made Wed 30 Oct 2019 03:15:42 PM EDT
8
+ # gpg: using RSA key DB46681BB91ADCEA170FA2D415588B26596BEA5D
9
+ # gpg: Good signature from "Daniel Veillard (Red Hat work email) <veillard@redhat.com>" [unknown]
10
+ # gpg: aka "Daniel Veillard <Daniel.Veillard@w3.org>" [unknown]
11
+ # gpg: WARNING: This key is not certified with a trusted signature!
12
+ # gpg: There is no indication that the signature belongs to the owner.
13
+ # Primary key fingerprint: C744 15BA 7C9C 7F78 F02E 1DC3 4606 B8A5 DE95 BC1F
14
+ # Subkey fingerprint: DB46 681B B91A DCEA 170F A2D4 1558 8B26 596B EA5D
15
+ #
16
+ # using this pgp signature:
17
+ #
18
+ # -----BEGIN PGP SIGNATURE-----
19
+ #
20
+ # iQEzBAABCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAl254V4ACgkQFViLJllr
21
+ # 6l0ldAf6Azt4/oKDfMKRd+xaykUrb+34dr2ZRsjRDS1cnelAtL9TCWhE5lOkLI3c
22
+ # 3FyNRaLhOEOOluZmKTJYyzS42JSSHDhxGj14gIeyafOjvRhHG3h1m5GvMmvgKWkd
23
+ # qzxFrVFSG26iWJxMvxIA88t7M+QHb7ff7xR29ETJscewEmAd3LmZITglK02lWeGz
24
+ # LfxfLuakM6RnCUu0dzacJKO0nMOKju+RL/N9bciI/UOhNYEkWqPnzC0GzbvFLqDu
25
+ # rM+OvCSewSTziiejpdrUwYXkY5Ui2+cxUbacLauEr8iRLg7xXKqv27NORE4yeQcS
26
+ # LgIhxG/qSNfihMS6E1ZO5bK2DbGCZQ==
27
+ # =ZNuc
28
+ # -----END PGP SIGNATURE-----
29
+ #
30
+
31
+ libxslt:
32
+ version: "1.1.34"
33
+ sha256: "98b1bd46d6792925ad2dfe9a87452ea2adebf69dcb9919ffd55bf926a7f93f7f"
34
+ # manually verified checksum:
35
+ #
36
+ # $ gpg --verify ~/Downloads/libxslt-1.1.34.tar.gz.asc ports/archives/libxslt-1.1.34.tar.gz
37
+ # gpg: Signature made Wed 30 Oct 2019 04:02:48 PM EDT
38
+ # gpg: using RSA key DB46681BB91ADCEA170FA2D415588B26596BEA5D
39
+ # gpg: Good signature from "Daniel Veillard (Red Hat work email) <veillard@redhat.com>" [unknown]
40
+ # gpg: aka "Daniel Veillard <Daniel.Veillard@w3.org>" [unknown]
41
+ # gpg: WARNING: This key is not certified with a trusted signature!
42
+ # gpg: There is no indication that the signature belongs to the owner.
43
+ # Primary key fingerprint: C744 15BA 7C9C 7F78 F02E 1DC3 4606 B8A5 DE95 BC1F
44
+ # Subkey fingerprint: DB46 681B B91A DCEA 170F A2D4 1558 8B26 596B EA5D
45
+ #
46
+ # using this pgp signature:
47
+ #
48
+ # -----BEGIN PGP SIGNATURE-----
49
+ #
50
+ # iQEzBAABCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAl257GgACgkQFViLJllr
51
+ # 6l2vVggAjJEHmASiS56SxhPOsGqbfBihM66gQFoIymQfMu2430N1GSTkLsfbkJO8
52
+ # 8yBX11NjzK/m9uxwshMW3rVCU7EpL3PUimN3reXdPiQj9hAOAWF1V3BZNevbQC2E
53
+ # FCIraioukaidf8sjUG4/sGpK/gOcP/3hYoN0HUoBigCNJjDqhijxM3M3GJJtCASp
54
+ # jL4CQbs2OmxW8ixOZbuWEESvFFHUgYRsdZjRVN+GRfSOvJjxypurmYwQ3RjO7JxL
55
+ # 2FY8qKQ+xpeID8NV8F5OUEvWBjk1QS133VTqBZNlONdnEtV/og6jNu5k0O/Kvhup
56
+ # caR+8TMErOcLr9OgDklO6DoYyAsf9Q==
57
+ # =g4i4
58
+ # -----END PGP SIGNATURE-----
59
+ #
60
+
61
+ zlib:
62
+ version: "1.2.11"
63
+ sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1"
64
+ # SHA-256 hash provided on http://zlib.net/
65
+
66
+ libiconv:
67
+ version: "1.15"
68
+ sha256: "ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178"
69
+ # gpg: Signature made Fri Feb 3 00:38:12 2017 CET
70
+ # gpg: using RSA key 4F494A942E4616C2
71
+ # gpg: Good signature from "Bruno Haible (Open Source Development) <bruno@clisp.org>" [unknown]
72
+ # gpg: WARNING: This key is not certified with a trusted signature!
73
+ # gpg: There is no indication that the signature belongs to the owner.
74
+ # Primary key fingerprint: 68D9 4D8A AEEA D48A E7DC 5B90 4F49 4A94 2E46 16C2