nokogiri 1.5.10 → 1.12.5

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 (328) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE-DEPENDENCIES.md +1903 -0
  4. data/LICENSE.md +9 -0
  5. data/README.md +278 -0
  6. data/bin/nokogiri +50 -10
  7. data/dependencies.yml +74 -0
  8. data/ext/nokogiri/depend +38 -358
  9. data/ext/nokogiri/extconf.rb +944 -100
  10. data/ext/nokogiri/gumbo.c +584 -0
  11. data/ext/nokogiri/html4_document.c +166 -0
  12. data/ext/nokogiri/html4_element_description.c +294 -0
  13. data/ext/nokogiri/html4_entity_lookup.c +37 -0
  14. data/ext/nokogiri/html4_sax_parser_context.c +120 -0
  15. data/ext/nokogiri/html4_sax_push_parser.c +95 -0
  16. data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
  17. data/ext/nokogiri/nokogiri.c +232 -87
  18. data/ext/nokogiri/nokogiri.h +188 -129
  19. data/ext/nokogiri/test_global_handlers.c +40 -0
  20. data/ext/nokogiri/xml_attr.c +49 -40
  21. data/ext/nokogiri/xml_attribute_decl.c +18 -18
  22. data/ext/nokogiri/xml_cdata.c +24 -23
  23. data/ext/nokogiri/xml_comment.c +29 -21
  24. data/ext/nokogiri/xml_document.c +305 -201
  25. data/ext/nokogiri/xml_document_fragment.c +13 -15
  26. data/ext/nokogiri/xml_dtd.c +54 -48
  27. data/ext/nokogiri/xml_element_content.c +31 -26
  28. data/ext/nokogiri/xml_element_decl.c +22 -22
  29. data/ext/nokogiri/xml_encoding_handler.c +30 -19
  30. data/ext/nokogiri/xml_entity_decl.c +32 -30
  31. data/ext/nokogiri/xml_entity_reference.c +16 -18
  32. data/ext/nokogiri/xml_namespace.c +74 -32
  33. data/ext/nokogiri/xml_node.c +808 -503
  34. data/ext/nokogiri/xml_node_set.c +239 -208
  35. data/ext/nokogiri/xml_processing_instruction.c +17 -19
  36. data/ext/nokogiri/xml_reader.c +198 -186
  37. data/ext/nokogiri/xml_relax_ng.c +52 -28
  38. data/ext/nokogiri/xml_sax_parser.c +123 -125
  39. data/ext/nokogiri/xml_sax_parser_context.c +138 -79
  40. data/ext/nokogiri/xml_sax_push_parser.c +88 -35
  41. data/ext/nokogiri/xml_schema.c +112 -33
  42. data/ext/nokogiri/xml_syntax_error.c +50 -23
  43. data/ext/nokogiri/xml_text.c +14 -18
  44. data/ext/nokogiri/xml_xpath_context.c +162 -98
  45. data/ext/nokogiri/xslt_stylesheet.c +162 -168
  46. data/gumbo-parser/CHANGES.md +63 -0
  47. data/gumbo-parser/Makefile +101 -0
  48. data/gumbo-parser/THANKS +27 -0
  49. data/gumbo-parser/src/Makefile +34 -0
  50. data/gumbo-parser/src/README.md +41 -0
  51. data/gumbo-parser/src/ascii.c +75 -0
  52. data/gumbo-parser/src/ascii.h +115 -0
  53. data/gumbo-parser/src/attribute.c +42 -0
  54. data/gumbo-parser/src/attribute.h +17 -0
  55. data/gumbo-parser/src/char_ref.c +22225 -0
  56. data/gumbo-parser/src/char_ref.h +29 -0
  57. data/gumbo-parser/src/char_ref.rl +2154 -0
  58. data/gumbo-parser/src/error.c +626 -0
  59. data/gumbo-parser/src/error.h +148 -0
  60. data/gumbo-parser/src/foreign_attrs.c +104 -0
  61. data/gumbo-parser/src/foreign_attrs.gperf +27 -0
  62. data/gumbo-parser/src/gumbo.h +943 -0
  63. data/gumbo-parser/src/insertion_mode.h +33 -0
  64. data/gumbo-parser/src/macros.h +91 -0
  65. data/gumbo-parser/src/parser.c +4886 -0
  66. data/gumbo-parser/src/parser.h +41 -0
  67. data/gumbo-parser/src/replacement.h +33 -0
  68. data/gumbo-parser/src/string_buffer.c +103 -0
  69. data/gumbo-parser/src/string_buffer.h +68 -0
  70. data/gumbo-parser/src/string_piece.c +48 -0
  71. data/gumbo-parser/src/svg_attrs.c +174 -0
  72. data/gumbo-parser/src/svg_attrs.gperf +77 -0
  73. data/gumbo-parser/src/svg_tags.c +137 -0
  74. data/gumbo-parser/src/svg_tags.gperf +55 -0
  75. data/gumbo-parser/src/tag.c +222 -0
  76. data/gumbo-parser/src/tag_lookup.c +382 -0
  77. data/gumbo-parser/src/tag_lookup.gperf +169 -0
  78. data/gumbo-parser/src/tag_lookup.h +13 -0
  79. data/gumbo-parser/src/token_buffer.c +79 -0
  80. data/gumbo-parser/src/token_buffer.h +71 -0
  81. data/gumbo-parser/src/token_type.h +17 -0
  82. data/gumbo-parser/src/tokenizer.c +3463 -0
  83. data/gumbo-parser/src/tokenizer.h +112 -0
  84. data/gumbo-parser/src/tokenizer_states.h +339 -0
  85. data/gumbo-parser/src/utf8.c +245 -0
  86. data/gumbo-parser/src/utf8.h +164 -0
  87. data/gumbo-parser/src/util.c +68 -0
  88. data/gumbo-parser/src/util.h +30 -0
  89. data/gumbo-parser/src/vector.c +111 -0
  90. data/gumbo-parser/src/vector.h +45 -0
  91. data/lib/nokogiri/css/node.rb +1 -50
  92. data/lib/nokogiri/css/parser.rb +317 -286
  93. data/lib/nokogiri/css/parser.y +57 -43
  94. data/lib/nokogiri/css/parser_extras.rb +39 -36
  95. data/lib/nokogiri/css/syntax_error.rb +2 -1
  96. data/lib/nokogiri/css/tokenizer.rb +105 -103
  97. data/lib/nokogiri/css/tokenizer.rex +5 -5
  98. data/lib/nokogiri/css/xpath_visitor.rb +137 -48
  99. data/lib/nokogiri/css.rb +15 -14
  100. data/lib/nokogiri/decorators/slop.rb +13 -5
  101. data/lib/nokogiri/extension.rb +31 -0
  102. data/lib/nokogiri/gumbo.rb +14 -0
  103. data/lib/nokogiri/html.rb +32 -27
  104. data/lib/nokogiri/{html → html4}/builder.rb +3 -2
  105. data/lib/nokogiri/{html → html4}/document.rb +118 -50
  106. data/lib/nokogiri/{html → html4}/document_fragment.rb +20 -11
  107. data/lib/nokogiri/{html → html4}/element_description.rb +2 -1
  108. data/lib/nokogiri/{html → html4}/element_description_defaults.rb +2 -1
  109. data/lib/nokogiri/{html → html4}/entity_lookup.rb +2 -1
  110. data/lib/nokogiri/{html → html4}/sax/parser.rb +22 -14
  111. data/lib/nokogiri/html4/sax/parser_context.rb +19 -0
  112. data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
  113. data/lib/nokogiri/html4.rb +40 -0
  114. data/lib/nokogiri/html5/document.rb +74 -0
  115. data/lib/nokogiri/html5/document_fragment.rb +80 -0
  116. data/lib/nokogiri/html5/node.rb +93 -0
  117. data/lib/nokogiri/html5.rb +473 -0
  118. data/lib/nokogiri/jruby/dependencies.rb +20 -0
  119. data/lib/nokogiri/syntax_error.rb +1 -0
  120. data/lib/nokogiri/version/constant.rb +5 -0
  121. data/lib/nokogiri/version/info.rb +215 -0
  122. data/lib/nokogiri/version.rb +3 -91
  123. data/lib/nokogiri/xml/attr.rb +1 -0
  124. data/lib/nokogiri/xml/attribute_decl.rb +1 -0
  125. data/lib/nokogiri/xml/builder.rb +75 -33
  126. data/lib/nokogiri/xml/cdata.rb +1 -0
  127. data/lib/nokogiri/xml/character_data.rb +1 -0
  128. data/lib/nokogiri/xml/document.rb +157 -54
  129. data/lib/nokogiri/xml/document_fragment.rb +55 -8
  130. data/lib/nokogiri/xml/dtd.rb +15 -4
  131. data/lib/nokogiri/xml/element_content.rb +1 -0
  132. data/lib/nokogiri/xml/element_decl.rb +1 -0
  133. data/lib/nokogiri/xml/entity_decl.rb +1 -0
  134. data/lib/nokogiri/xml/entity_reference.rb +19 -0
  135. data/lib/nokogiri/xml/namespace.rb +1 -0
  136. data/lib/nokogiri/xml/node/save_options.rb +2 -1
  137. data/lib/nokogiri/xml/node.rb +712 -431
  138. data/lib/nokogiri/xml/node_set.rb +140 -123
  139. data/lib/nokogiri/xml/notation.rb +1 -0
  140. data/lib/nokogiri/xml/parse_options.rb +31 -0
  141. data/lib/nokogiri/xml/pp/character_data.rb +1 -0
  142. data/lib/nokogiri/xml/pp/node.rb +1 -0
  143. data/lib/nokogiri/xml/pp.rb +3 -2
  144. data/lib/nokogiri/xml/processing_instruction.rb +1 -0
  145. data/lib/nokogiri/xml/reader.rb +9 -12
  146. data/lib/nokogiri/xml/relax_ng.rb +7 -2
  147. data/lib/nokogiri/xml/sax/document.rb +25 -30
  148. data/lib/nokogiri/xml/sax/parser.rb +8 -8
  149. data/lib/nokogiri/xml/sax/parser_context.rb +1 -0
  150. data/lib/nokogiri/xml/sax/push_parser.rb +1 -0
  151. data/lib/nokogiri/xml/sax.rb +5 -4
  152. data/lib/nokogiri/xml/schema.rb +13 -4
  153. data/lib/nokogiri/xml/searchable.rb +239 -0
  154. data/lib/nokogiri/xml/syntax_error.rb +25 -1
  155. data/lib/nokogiri/xml/text.rb +1 -0
  156. data/lib/nokogiri/xml/xpath/syntax_error.rb +2 -1
  157. data/lib/nokogiri/xml/xpath.rb +4 -5
  158. data/lib/nokogiri/xml/xpath_context.rb +1 -0
  159. data/lib/nokogiri/xml.rb +37 -35
  160. data/lib/nokogiri/xslt/stylesheet.rb +2 -1
  161. data/lib/nokogiri/xslt.rb +17 -16
  162. data/lib/nokogiri.rb +55 -58
  163. data/lib/xsd/xmlparser/nokogiri.rb +1 -0
  164. data/patches/libxml2/0001-Remove-script-macro-support.patch +40 -0
  165. data/patches/libxml2/0002-Update-entities-to-remove-handling-of-ssi.patch +44 -0
  166. data/patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch +25 -0
  167. data/patches/libxml2/0004-use-glibc-strlen.patch +53 -0
  168. data/patches/libxml2/0005-avoid-isnan-isinf.patch +81 -0
  169. data/patches/libxml2/0006-update-automake-files-for-arm64.patch +2511 -0
  170. data/patches/libxml2/0007-Fix-XPath-recursion-limit.patch +31 -0
  171. data/patches/libxslt/0001-update-automake-files-for-arm64.patch +2511 -0
  172. data/patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch +19 -0
  173. data/ports/archives/libxml2-2.9.12.tar.gz +0 -0
  174. data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
  175. metadata +307 -459
  176. data/.autotest +0 -26
  177. data/.gemtest +0 -0
  178. data/CHANGELOG.ja.rdoc +0 -785
  179. data/CHANGELOG.rdoc +0 -783
  180. data/C_CODING_STYLE.rdoc +0 -33
  181. data/Manifest.txt +0 -303
  182. data/README.ja.rdoc +0 -106
  183. data/README.rdoc +0 -175
  184. data/ROADMAP.md +0 -90
  185. data/Rakefile +0 -228
  186. data/STANDARD_RESPONSES.md +0 -47
  187. data/Y_U_NO_GEMSPEC.md +0 -155
  188. data/build_all +0 -105
  189. data/ext/nokogiri/html_document.c +0 -170
  190. data/ext/nokogiri/html_document.h +0 -10
  191. data/ext/nokogiri/html_element_description.c +0 -279
  192. data/ext/nokogiri/html_element_description.h +0 -10
  193. data/ext/nokogiri/html_entity_lookup.c +0 -32
  194. data/ext/nokogiri/html_entity_lookup.h +0 -8
  195. data/ext/nokogiri/html_sax_parser_context.c +0 -116
  196. data/ext/nokogiri/html_sax_parser_context.h +0 -11
  197. data/ext/nokogiri/html_sax_push_parser.c +0 -87
  198. data/ext/nokogiri/html_sax_push_parser.h +0 -9
  199. data/ext/nokogiri/xml_attr.h +0 -9
  200. data/ext/nokogiri/xml_attribute_decl.h +0 -9
  201. data/ext/nokogiri/xml_cdata.h +0 -9
  202. data/ext/nokogiri/xml_comment.h +0 -9
  203. data/ext/nokogiri/xml_document.h +0 -23
  204. data/ext/nokogiri/xml_document_fragment.h +0 -10
  205. data/ext/nokogiri/xml_dtd.h +0 -10
  206. data/ext/nokogiri/xml_element_content.h +0 -10
  207. data/ext/nokogiri/xml_element_decl.h +0 -9
  208. data/ext/nokogiri/xml_encoding_handler.h +0 -8
  209. data/ext/nokogiri/xml_entity_decl.h +0 -10
  210. data/ext/nokogiri/xml_entity_reference.h +0 -9
  211. data/ext/nokogiri/xml_io.c +0 -56
  212. data/ext/nokogiri/xml_io.h +0 -11
  213. data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
  214. data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
  215. data/ext/nokogiri/xml_namespace.h +0 -13
  216. data/ext/nokogiri/xml_node.h +0 -13
  217. data/ext/nokogiri/xml_node_set.h +0 -14
  218. data/ext/nokogiri/xml_processing_instruction.h +0 -9
  219. data/ext/nokogiri/xml_reader.h +0 -10
  220. data/ext/nokogiri/xml_relax_ng.h +0 -9
  221. data/ext/nokogiri/xml_sax_parser.h +0 -39
  222. data/ext/nokogiri/xml_sax_parser_context.h +0 -10
  223. data/ext/nokogiri/xml_sax_push_parser.h +0 -9
  224. data/ext/nokogiri/xml_schema.h +0 -9
  225. data/ext/nokogiri/xml_syntax_error.h +0 -13
  226. data/ext/nokogiri/xml_text.h +0 -9
  227. data/ext/nokogiri/xml_xpath_context.h +0 -10
  228. data/ext/nokogiri/xslt_stylesheet.h +0 -14
  229. data/lib/nokogiri/html/sax/parser_context.rb +0 -16
  230. data/lib/nokogiri/html/sax/push_parser.rb +0 -16
  231. data/tasks/cross_compile.rb +0 -150
  232. data/tasks/nokogiri.org.rb +0 -24
  233. data/tasks/test.rb +0 -95
  234. data/test/css/test_nthiness.rb +0 -159
  235. data/test/css/test_parser.rb +0 -341
  236. data/test/css/test_tokenizer.rb +0 -198
  237. data/test/css/test_xpath_visitor.rb +0 -91
  238. data/test/decorators/test_slop.rb +0 -16
  239. data/test/files/2ch.html +0 -108
  240. data/test/files/address_book.rlx +0 -12
  241. data/test/files/address_book.xml +0 -10
  242. data/test/files/bar/bar.xsd +0 -4
  243. data/test/files/dont_hurt_em_why.xml +0 -422
  244. data/test/files/encoding.html +0 -82
  245. data/test/files/encoding.xhtml +0 -84
  246. data/test/files/exslt.xml +0 -8
  247. data/test/files/exslt.xslt +0 -35
  248. data/test/files/foo/foo.xsd +0 -4
  249. data/test/files/metacharset.html +0 -10
  250. data/test/files/noencoding.html +0 -47
  251. data/test/files/po.xml +0 -32
  252. data/test/files/po.xsd +0 -66
  253. data/test/files/shift_jis.html +0 -10
  254. data/test/files/shift_jis.xml +0 -5
  255. data/test/files/snuggles.xml +0 -3
  256. data/test/files/staff.dtd +0 -10
  257. data/test/files/staff.xml +0 -59
  258. data/test/files/staff.xslt +0 -32
  259. data/test/files/test_document_url/bar.xml +0 -2
  260. data/test/files/test_document_url/document.dtd +0 -4
  261. data/test/files/test_document_url/document.xml +0 -6
  262. data/test/files/tlm.html +0 -850
  263. data/test/files/to_be_xincluded.xml +0 -2
  264. data/test/files/valid_bar.xml +0 -2
  265. data/test/files/xinclude.xml +0 -4
  266. data/test/helper.rb +0 -154
  267. data/test/html/sax/test_parser.rb +0 -141
  268. data/test/html/sax/test_parser_context.rb +0 -46
  269. data/test/html/test_builder.rb +0 -164
  270. data/test/html/test_document.rb +0 -552
  271. data/test/html/test_document_encoding.rb +0 -138
  272. data/test/html/test_document_fragment.rb +0 -261
  273. data/test/html/test_element_description.rb +0 -105
  274. data/test/html/test_named_characters.rb +0 -14
  275. data/test/html/test_node.rb +0 -196
  276. data/test/html/test_node_encoding.rb +0 -27
  277. data/test/namespaces/test_additional_namespaces_in_builder_doc.rb +0 -14
  278. data/test/namespaces/test_namespaces_in_builder_doc.rb +0 -75
  279. data/test/namespaces/test_namespaces_in_created_doc.rb +0 -75
  280. data/test/namespaces/test_namespaces_in_parsed_doc.rb +0 -66
  281. data/test/test_convert_xpath.rb +0 -135
  282. data/test/test_css_cache.rb +0 -45
  283. data/test/test_encoding_handler.rb +0 -46
  284. data/test/test_memory_leak.rb +0 -156
  285. data/test/test_nokogiri.rb +0 -132
  286. data/test/test_reader.rb +0 -555
  287. data/test/test_soap4r_sax.rb +0 -52
  288. data/test/test_xslt_transforms.rb +0 -254
  289. data/test/xml/node/test_save_options.rb +0 -28
  290. data/test/xml/node/test_subclass.rb +0 -44
  291. data/test/xml/sax/test_parser.rb +0 -366
  292. data/test/xml/sax/test_parser_context.rb +0 -106
  293. data/test/xml/sax/test_push_parser.rb +0 -157
  294. data/test/xml/test_attr.rb +0 -64
  295. data/test/xml/test_attribute_decl.rb +0 -86
  296. data/test/xml/test_builder.rb +0 -306
  297. data/test/xml/test_c14n.rb +0 -151
  298. data/test/xml/test_cdata.rb +0 -48
  299. data/test/xml/test_comment.rb +0 -29
  300. data/test/xml/test_document.rb +0 -828
  301. data/test/xml/test_document_encoding.rb +0 -28
  302. data/test/xml/test_document_fragment.rb +0 -223
  303. data/test/xml/test_dtd.rb +0 -103
  304. data/test/xml/test_dtd_encoding.rb +0 -33
  305. data/test/xml/test_element_content.rb +0 -56
  306. data/test/xml/test_element_decl.rb +0 -73
  307. data/test/xml/test_entity_decl.rb +0 -122
  308. data/test/xml/test_entity_reference.rb +0 -245
  309. data/test/xml/test_namespace.rb +0 -95
  310. data/test/xml/test_node.rb +0 -1137
  311. data/test/xml/test_node_attributes.rb +0 -96
  312. data/test/xml/test_node_encoding.rb +0 -107
  313. data/test/xml/test_node_inheritance.rb +0 -32
  314. data/test/xml/test_node_reparenting.rb +0 -374
  315. data/test/xml/test_node_set.rb +0 -755
  316. data/test/xml/test_parse_options.rb +0 -64
  317. data/test/xml/test_processing_instruction.rb +0 -30
  318. data/test/xml/test_reader_encoding.rb +0 -142
  319. data/test/xml/test_relax_ng.rb +0 -60
  320. data/test/xml/test_schema.rb +0 -103
  321. data/test/xml/test_syntax_error.rb +0 -12
  322. data/test/xml/test_text.rb +0 -45
  323. data/test/xml/test_unparented_node.rb +0 -422
  324. data/test/xml/test_xinclude.rb +0 -83
  325. data/test/xml/test_xpath.rb +0 -295
  326. data/test/xslt/test_custom_functions.rb +0 -133
  327. data/test/xslt/test_exception_handling.rb +0 -37
  328. data/test_all +0 -81
data/ROADMAP.md DELETED
@@ -1,90 +0,0 @@
1
- # Roadmap for 2.0
2
-
3
- ## overhaul serialize/pretty printing API
4
-
5
- * https://github.com/sparklemotion/nokogiri/issues/530
6
- XHTML formatting can't be turned off
7
-
8
- * https://github.com/sparklemotion/nokogiri/issues/415
9
- XML formatting should be no formatting
10
-
11
-
12
- ## overhaul and optimize the SAX parsing
13
-
14
- * see fairy wing throwdown - SAX parsing is wicked slow.
15
-
16
-
17
- ## Node should not be Enumerable; and should have a better attributes API
18
-
19
- * https://github.com/sparklemotion/nokogiri/issues/679
20
- Mixing in Enumerable has some unintended consequences; plus we want to improve the attributes API
21
-
22
- * Some ideas for a better attributes API?
23
- * (closed) https://github.com/sparklemotion/nokogiri/issues/666
24
- * https://github.com/sparklemotion/nokogiri/issues/765
25
-
26
-
27
- ## improve CSS query parsing
28
-
29
- * https://github.com/sparklemotion/nokogiri/issues/528
30
- support `:not()` with a nontrivial argument, like `:not(div p.c)`
31
-
32
- * https://github.com/sparklemotion/nokogiri/issues/451
33
- chained :not pseudoselectors
34
-
35
- * better jQuery selector support:
36
- * https://github.com/sparklemotion/nokogiri/issues/621
37
- * https://github.com/sparklemotion/nokogiri/issues/342
38
- * https://github.com/sparklemotion/nokogiri/issues/628
39
- * https://github.com/sparklemotion/nokogiri/issues/652
40
- * https://github.com/sparklemotion/nokogiri/issues/688
41
-
42
- * https://github.com/sparklemotion/nokogiri/issues/394
43
- nth-of-type is wrong, and possibly other selectors as well
44
-
45
- * https://github.com/sparklemotion/nokogiri/issues/309
46
- incorrect query being executed
47
-
48
- * https://github.com/sparklemotion/nokogiri/issues/350
49
- :has is wrong?
50
-
51
-
52
- ## DocumentFragment
53
-
54
- * there are a few tickets about searches not working properly if you
55
- use or do not use the context node as part of the search.
56
- - https://github.com/sparklemotion/nokogiri/issues/213
57
- - https://github.com/sparklemotion/nokogiri/issues/370
58
- - https://github.com/sparklemotion/nokogiri/issues/454
59
- - https://github.com/sparklemotion/nokogiri/issues/572
60
-
61
-
62
- ## Better Syntax for custom XPath function handler
63
-
64
- * https://github.com/sparklemotion/nokogiri/pull/464
65
-
66
-
67
- ## Better Syntax around Node#xpath and NodeSet#xpath
68
-
69
- * look at those methods, and use of Node#extract_params in Node#{css,search}
70
- * we should standardize on a hash of options for these and other calls
71
- * what should NodeSet#xpath return?
72
- * https://github.com/sparklemotion/nokogiri/issues/656
73
- * also, clean up or unify the implementations of #xpath-and-friends in Node and NodeSet
74
- * implementations are very similar, but no shared code :(
75
- * decorate nodes in a consistent manner
76
-
77
- ## Encoding
78
-
79
- We have a lot of issues open around encoding. How bad are things?
80
- Would it help if we deprecated support for Ruby 1.8.7? Somebody who
81
- knows encoding well should head this up.
82
-
83
- * Extract EncodingReader as a real object that can be injected
84
- https://groups.google.com/forum/#!msg/nokogiri-talk/arJeAtMqvkg/tGihB-iBRSAJ
85
-
86
-
87
- ## Reader
88
-
89
- It's fundamentally broken, in that we can't stop people from crashing
90
- their application if they want to use object reference unsafely.
data/Rakefile DELETED
@@ -1,228 +0,0 @@
1
- # -*- ruby -*-
2
- require 'rubygems'
3
-
4
- gem 'hoe'
5
- require 'hoe'
6
- Hoe.plugin :debugging
7
- Hoe.plugin :git
8
- Hoe.plugin :gemspec
9
- Hoe.plugin :bundler
10
- Hoe.add_include_dirs '.'
11
-
12
- GENERATED_PARSER = "lib/nokogiri/css/parser.rb"
13
- GENERATED_TOKENIZER = "lib/nokogiri/css/tokenizer.rb"
14
- CROSS_DIR = File.join(File.dirname(__FILE__), 'ports')
15
-
16
- def java?
17
- !! (RUBY_PLATFORM =~ /java/)
18
- end
19
-
20
- ENV['LANG'] = "en_US.UTF-8" # UBUNTU 10.04, Y U NO DEFAULT TO UTF-8?
21
-
22
- require 'tasks/nokogiri.org'
23
-
24
- HOE = Hoe.spec 'nokogiri' do
25
- developer 'Aaron Patterson', 'aaronp@rubyforge.org'
26
- developer 'Mike Dalessio', 'mike.dalessio@gmail.com'
27
- developer 'Yoko Harada', 'yokolet@gmail.com'
28
- developer 'Tim Elliott', 'tle@holymonkey.com'
29
-
30
- self.readme_file = ['README', ENV['HLANG'], 'rdoc'].compact.join('.')
31
- self.history_file = ['CHANGELOG', ENV['HLANG'], 'rdoc'].compact.join('.')
32
-
33
- self.extra_rdoc_files = FileList['*.rdoc','ext/nokogiri/*.c']
34
-
35
- self.clean_globs += [
36
- 'nokogiri.gemspec',
37
- 'lib/nokogiri/nokogiri.{bundle,jar,rb,so}',
38
- 'lib/nokogiri/{1.8,1.9,2.0}',
39
- # GENERATED_PARSER,
40
- # GENERATED_TOKENIZER
41
- ]
42
-
43
- self.extra_dev_deps += [
44
- ["hoe-bundler", ">= 1.1"],
45
- ["hoe-debugging", ">= 1.0.3"],
46
- ["hoe-gemspec", ">= 1.0"],
47
- ["hoe-git", ">= 1.4"],
48
- ["mini_portile", ">= 0.2.2"],
49
- ["minitest", "~> 2.2.2"],
50
- ["rake", ">= 0.9"],
51
- ["rake-compiler", "~> 0.8.0"],
52
- ["racc", ">= 1.4.6"],
53
- ["rexical", ">= 1.0.5"]
54
- ]
55
-
56
- if java?
57
- self.spec_extras = { :platform => 'java' }
58
- else
59
- self.spec_extras = {
60
- :extensions => ["ext/nokogiri/extconf.rb"],
61
- :required_ruby_version => '>= 1.8.7'
62
- }
63
- end
64
-
65
- self.testlib = :minitest
66
- end
67
-
68
- # ----------------------------------------
69
-
70
- def add_file_to_gem relative_path
71
- target_path = File.join gem_build_path, relative_path
72
- target_dir = File.dirname(target_path)
73
- mkdir_p target_dir unless File.directory?(target_dir)
74
- rm_f target_path
75
- ln relative_path, target_path
76
- HOE.spec.files += [relative_path]
77
- end
78
-
79
- def gem_build_path
80
- File.join 'pkg', HOE.spec.full_name
81
- end
82
-
83
- if java?
84
- # TODO: clean this section up.
85
- require "rake/javaextensiontask"
86
- Rake::JavaExtensionTask.new("nokogiri", HOE.spec) do |ext|
87
- jruby_home = RbConfig::CONFIG['prefix']
88
- ext.ext_dir = 'ext/java'
89
- ext.lib_dir = 'lib/nokogiri'
90
- jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
91
- ext.classpath = jars.map { |x| File.expand_path x }.join ':'
92
- end
93
-
94
- task gem_build_path => [:compile] do
95
- add_file_to_gem 'lib/nokogiri/nokogiri.jar'
96
- end
97
- else
98
- mingw_available = true
99
- begin
100
- require 'tasks/cross_compile'
101
- rescue
102
- puts "WARNING: cross compilation not available: #{$!}"
103
- mingw_available = false
104
- end
105
- require "rake/extensiontask"
106
-
107
- HOE.spec.files.reject! { |f| f =~ %r{\.(java|jar)$} }
108
-
109
- Rake::ExtensionTask.new("nokogiri", HOE.spec) do |ext|
110
- ext.lib_dir = File.join(*['lib', 'nokogiri', ENV['FAT_DIR']].compact)
111
- ext.config_options << ENV['EXTOPTS']
112
- if mingw_available
113
- ext.cross_compile = true
114
- ext.cross_platform = ["x86-mswin32-60", "x86-mingw32"]
115
- ext.cross_config_options << "--with-xml2-include=#{File.join($recipes["libxml2"].path, 'include', 'libxml2')}"
116
- ext.cross_config_options << "--with-xml2-lib=#{File.join($recipes["libxml2"].path, 'lib')}"
117
- ext.cross_config_options << "--with-iconv-dir=#{$recipes["libiconv"].path}"
118
- ext.cross_config_options << "--with-xslt-dir=#{$recipes["libxslt"].path}"
119
- ext.cross_config_options << "--with-zlib-dir=#{CROSS_DIR}"
120
- end
121
- end
122
- end
123
-
124
- # ----------------------------------------
125
-
126
- desc "Generate css/parser.rb and css/tokenizer.rex"
127
- task 'generate' => [GENERATED_PARSER, GENERATED_TOKENIZER]
128
- task 'gem:spec' => 'generate' if Rake::Task.task_defined?("gem:spec")
129
-
130
- # This is a big hack to make sure that the racc and rexical
131
- # dependencies in the Gemfile are constrainted to ruby platforms
132
- # (i.e. MRI and Rubinius). There's no way to do that through hoe,
133
- # and any solution will require changing hoe and hoe-bundler.
134
- old_gemfile_task = Rake::Task['bundler:gemfile'] rescue nil
135
- task 'bundler:gemfile' do
136
- old_gemfile_task.invoke if old_gemfile_task
137
-
138
- lines = File.open('Gemfile', 'r') { |f| f.readlines }.map do |line|
139
- line =~ /racc|rexical/ ? "#{line.strip}, :platform => :ruby" : line
140
- end
141
- File.open('Gemfile', 'w') { |f| lines.each { |line| f.puts line } }
142
- end
143
-
144
- file GENERATED_PARSER => "lib/nokogiri/css/parser.y" do |t|
145
- racc = RbConfig::CONFIG['target_os'] =~ /mswin32/ ? '' : `which racc`.strip
146
- racc = "#{::RbConfig::CONFIG['bindir']}/racc" if racc.empty?
147
- racc = %x{command -v racc}.strip if racc.empty?
148
- sh "#{racc} -l -o #{t.name} #{t.prerequisites.first}"
149
- end
150
-
151
- file GENERATED_TOKENIZER => "lib/nokogiri/css/tokenizer.rex" do |t|
152
- sh "rex --independent -o #{t.name} #{t.prerequisites.first}"
153
- end
154
-
155
- [:compile, :check_manifest].each do |task_name|
156
- Rake::Task[task_name].prerequisites << GENERATED_PARSER
157
- Rake::Task[task_name].prerequisites << GENERATED_TOKENIZER
158
- end
159
-
160
- # ----------------------------------------
161
-
162
- desc "set environment variables to build and/or test with debug options"
163
- task :debug do
164
- ENV['NOKOGIRI_DEBUG'] = "true"
165
- ENV['CFLAGS'] ||= ""
166
- ENV['CFLAGS'] += " -DDEBUG"
167
- end
168
-
169
- require 'tasks/test'
170
-
171
- task :java_debug do
172
- ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if java? && ENV['JAVA_DEBUG']
173
- end
174
-
175
- if java?
176
- task :test_18 => :test
177
- task :test_19 do
178
- ENV['JRUBY_OPTS'] = "--1.9"
179
- Rake::Task["test"].invoke
180
- end
181
- end
182
-
183
- Rake::Task[:test].prerequisites << :compile
184
- Rake::Task[:test].prerequisites << :java_debug
185
- Rake::Task[:test].prerequisites << :check_extra_deps unless java?
186
-
187
- if Hoe.plugins.include?(:debugging)
188
- ['valgrind', 'valgrind:mem', 'valgrind:mem0'].each do |task_name|
189
- Rake::Task["test:#{task_name}"].prerequisites << :compile
190
- end
191
- end
192
-
193
- # ----------------------------------------
194
-
195
- desc "build a windows gem without all the ceremony."
196
- task "gem:windows" => "gem" do
197
- cross_rubies = ["1.8.7-p358", "1.9.3-p194", "2.0.0-p0"]
198
- ruby_cc_version = cross_rubies.collect { |_| _.split("-").first }.join(":") # e.g., "1.8.7:1.9.2"
199
- rake_compiler_config_path = "#{ENV['HOME']}/.rake-compiler/config.yml"
200
-
201
- unless File.exists? rake_compiler_config_path
202
- raise "rake-compiler has not installed any cross rubies. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{cross_rubies.first}'"
203
- end
204
- rake_compiler_config = YAML.load_file(rake_compiler_config_path)
205
-
206
- # check that rake-compiler config contains the right patchlevels. see #279 for background,
207
- # and http://blog.mmediasys.com/2011/01/22/rake-compiler-updated-list-of-supported-ruby-versions-for-cross-compilation/
208
- # for more up-to-date docs.
209
- cross_rubies.each do |version|
210
- majmin, patchlevel = version.split("-")
211
- rbconfig = "rbconfig-#{majmin}"
212
- unless rake_compiler_config.key?(rbconfig) && rake_compiler_config[rbconfig] =~ /-#{patchlevel}/
213
- raise "rake-compiler '#{rbconfig}' not #{patchlevel}. try running 'env --unset=HOST rake-compiler cross-ruby VERSION=#{version}'"
214
- end
215
- end
216
-
217
- # verify that --export-all is in the 1.9 rbconfig. see #279,#374,#375.
218
- rbconfig_19 = rake_compiler_config["rbconfig-1.9.3"]
219
- raise "rbconfig #{rbconfig_19} needs --export-all in its DLDFLAGS value" if File.read(rbconfig_19).split("\n").grep(/CONFIG\["DLDFLAGS"\].*--export-all/).empty?
220
-
221
- rbconfig_20 = rake_compiler_config["rbconfig-2.0.0"]
222
- raise "rbconfig #{rbconfig_20} needs --export-all in its DLDFLAGS value" if File.read(rbconfig_20).split("\n").grep(/CONFIG\["DLDFLAGS"\].*--export-all/).empty?
223
-
224
- pkg_config_path = %w[libxslt libxml2].collect { |pkg| File.join($recipes[pkg].path, "lib/pkgconfig") }.join(":")
225
- sh("env PKG_CONFIG_PATH=#{pkg_config_path} RUBY_CC_VERSION=#{ruby_cc_version} rake cross native gem") || raise("build failed!")
226
- end
227
-
228
- # vim: syntax=Ruby
@@ -1,47 +0,0 @@
1
- # Standard Responses to Requests
2
-
3
- These responses are needed often enough that I figured, let's just
4
- check them in for future reference and use.
5
-
6
-
7
- # Not enough information to help
8
-
9
- Hello!
10
-
11
- Thanks for asking this question! However, without more information,
12
- Team Nokogiri cannot reproduce your issue, and so we cannot offer much
13
- help.
14
-
15
- Please provide us with:
16
-
17
- * A self-contained script (one that we can run without modification,
18
- and preferably without making external network connections).
19
-
20
- * Please note that you need to include the XML/HTML that you are
21
- operating on.
22
-
23
- * The output of `nokogiri -v`, which will provide details about your
24
- platform and versions of ruby, libxml2 and nokogiri.
25
-
26
- For more information about requesting help or reporting bugs, please
27
- take a look at http://bit.ly/nokohelp
28
-
29
- Thank you so much!
30
-
31
-
32
- # Not a bug
33
-
34
- Hello!
35
-
36
- Thanks for asking this question! Your request for assistance using
37
- Nokogiri will not go unanswered!
38
-
39
- However, Nokogiri's Github Issues is reserved for reporting bugs or
40
- submitting patches. If you ask your question on the mailing list, Team
41
- Nokogiri promises someone will provide you with an answer in a timely
42
- manner.
43
-
44
- If you'd like to read up on Team Nokogiri's rationale for this policy,
45
- please go to http://bit.ly/nokohelp.
46
-
47
- Thank you so much for understanding! And thank you for using Nokogiri.
data/Y_U_NO_GEMSPEC.md DELETED
@@ -1,155 +0,0 @@
1
- (note: this was originally a blog post published at http://blog.flavorjon.es/2012/03/y-u-no-gemspec.html)
2
-
3
- ## tl;dr
4
-
5
- 1. Team Nokogiri are not 10-foot-tall code-crunching robots, so `master` is usually unstable.
6
- 2. Unstable code can corrupt your data and crash your application, which would make everybody look bad.
7
- 3. Therefore, the _risk_ associated with using unstable code is severe; for you _and_ for Team Nokogiri.
8
- 4. The absence of a gemspec is a risk mitigation tactic.
9
- 5. You can always ask for an RC release.
10
-
11
-
12
- ## Why Isn't There a Gemspec!?
13
-
14
- OHAI! Thank you for asking this question!
15
-
16
- Team Nokogiri gets asked this pretty frequently. Just a sample from
17
- the historical record:
18
-
19
- * [Issue #274](https://github.com/sparklemotion/nokogiri/issues/274)
20
- * [Issue #371](https://github.com/sparklemotion/nokogiri/issues/371)
21
- * [A commit removing nokogiri.gemspec](https://github.com/sparklemotion/nokogiri/commit/7f17a643a05ca381d65131515b54d4a3a61ca2e1#commitcomment-667477)
22
- * [A nokogiri-talk thread](http://groups.google.com/group/nokogiri-talk/browse_thread/thread/4706b002e492d23f)
23
- * [Another nokogiri-talk thread](http://groups.google.com/group/nokogiri-talk/browse_thread/thread/0b201bb80ea3eea0)
24
-
25
- Sometimes people imply that we've forgotten, or that we don't how to
26
- properly manage our codebase. Those people are super fun to respond
27
- to!
28
-
29
- We've gone back and forth a couple of times over the past few years,
30
- but the current policy of Team Nokogiri is to **not** provide a
31
- gemspec in the Github repo. This is a conscious choice, not an
32
- oversight.
33
-
34
-
35
- ## But You Didn't Answer the Question!
36
-
37
- Ah, I was hoping you wouldn't notice. Well, OK, let's do this, if
38
- you're serious about it.
39
-
40
- I'd like to start by talking about _risk_. Specifically, the risk
41
- associated with using a known-unstable version of Nokogiri.
42
-
43
-
44
- ### Risk
45
-
46
- One common way to evaluate the _risk_ of an incident is:
47
-
48
- risk = probability x impact
49
-
50
- You can read more about this on [the internets](http://en.wikipedia.org/wiki/Risk_Matrix).
51
-
52
- The _risk_ associated with a Nokogiri bug could be loosely defined by
53
- answering the questions:
54
-
55
- * "How likely is it that a bug exists?" (probability)
56
- * "How severe will the consequences of a bug be?" (impact)
57
-
58
-
59
- ### Probability
60
-
61
- The `master` branch should be considered unstable. Team Nokogiri are
62
- not 10-foot-tall code-crunching robots; we are humans. We make
63
- mistakes, and as a result, any arbitrary commit on `master` is likely
64
- to contain bugs.
65
-
66
- Just as an example, Nokogiri `master` was unstable for about five
67
- months between November 2011 and March 2012. It was unstable not
68
- because we were sloppy, or didn't care, but because the fixes were
69
- hard and unobvious.
70
-
71
- When we release Nokogiri, we test for memory leaks and invalid memory
72
- access on all kinds of platforms with many flavors of Ruby and lots of
73
- versions of libxml2. Because these tests are time-consuming, we don't
74
- run them on every commit. We run them often when preparing a release.
75
-
76
- If we're releasing Nokogiri, it means we think it's rock solid.
77
-
78
- And if we're not releasing it, it means there are probably bugs.
79
-
80
-
81
- ### Impact
82
-
83
- Nokogiri is a gem with native extensions. This means it's not pure
84
- Ruby -- there's C or Java code being compiled and run, which means
85
- that there's always a chance that the gem will crash your application,
86
- or worse. Possible outcomes include:
87
-
88
- * leaking memory
89
- * corrupting data
90
- * making benign code crash (due to memory corruption)
91
-
92
- So, then, a bug in a native extension can have much worse downside
93
- than you might think. It's not just going to do something unexpected;
94
- it's possibly going to do terrible, awful things to your application
95
- and data.
96
-
97
- **Nobody** wants that to happen. Especially Team Nokogiri.
98
-
99
-
100
- ### Risk, Redux
101
-
102
- So, if you accept the equation
103
-
104
- risk = probability x impact
105
-
106
- and you believe me when I say that:
107
-
108
- * the probablility of a bug in unreleased code is high, and
109
- * the impact of a bug is likely to be severe,
110
-
111
- then you should easily see that the _risk_ associated with a bug in
112
- Nokogiri is quite high.
113
-
114
- Part of Team Nokogiri's job is to try to mitigate this risk. We have a
115
- number of tactics that we use to accomplish this:
116
-
117
- * we respond quickly to bug reports, particularly when they are possible memory issues
118
- * we review each others' commits
119
- * we have a thorough test suite, and we test-drive new features
120
- * we discuss code design and issues on a core developer mailing list
121
- * we use valgrind to test for memory issues (leaks and invalid
122
- access) on multiple combinations of OS, libxml2 and Ruby
123
- * we package release candidates, and encourage devs to use them
124
- * **we do NOT commit a gemspec in our git repository**
125
-
126
- Yes, that's right, the absence of a gemspec is a risk mitigation
127
- tactic. Not only does Team Nokogiri not want to imply support for
128
- `master`, we want to **actively discourage** people from using
129
- it. Because it's not stable.
130
-
131
-
132
- ## But I Want to Do It Anyway
133
-
134
- Another option, is to email the [nokogiri-talk
135
- list](http://groups.google.com/group/nokogiri-talk) and ask for a
136
- release candidate to be built. We're pretty accommodating if there's a
137
- bugfix that's a blocker for you. And if we can't release an RC, we'll
138
- tell you why.
139
-
140
- And in the end, nothing is stopping you from cloning the repo and
141
- generating a private gemspec. This is an extra step or two, but it has
142
- the benefit of making sure developers have thought through the costs
143
- and risks involved; and it tends to select for developers who know
144
- what they're doing.
145
-
146
-
147
- ## In Conclusion
148
-
149
- Team Nokogiri takes stability very seriously. We want everybody who
150
- uses Nokogiri to have a pleasant experience. And so we want to make
151
- sure that you're using the best software we can make.
152
-
153
- Please keep in mind that we're trying very hard to do the right thing
154
- for all Nokogiri users out there in Rubyland. Nokogiri loves you very
155
- much, and we hope you love it back.
data/build_all DELETED
@@ -1,105 +0,0 @@
1
- #! /usr/bin/env bash
2
- #
3
- # script to build gems for all relevant platforms:
4
- # - MRI et al (standard gem)
5
- # - windows (x86-mingw32 and x86-mswin32-60)
6
- # - jruby
7
- #
8
- # here's what I recommend for building all the gems:
9
- #
10
- # 1. set up a vagrant VM guest running ubuntu lucid 32-bit.
11
- # 2. install rvm, and install 1.8.7, 1.9.3 and jruby.
12
- # 3. `sudo apt-get install mingw32`
13
- #
14
- # as you build, you may run into these problems:
15
- #
16
- # - if you're using Virtualbox shared directories, you'll get a mingw
17
- # "Protocol error" at linktime. Boo! Either use NFS or a
18
- # locally-checked-out repository.
19
- #
20
- # - on ubuntus 11 and later, you may have issues with building
21
- # rake-compiler's rubies against openssl v2. Just comment the lines
22
- # out from ossl_ssl.c and you'll be fine.
23
- #
24
- # - you may have issues with Pathname conversion to String in
25
- # bundler. Add this to the offending bundler file:
26
- #
27
- # class Pathname
28
- # def to_str
29
- # to_s
30
- # end
31
- # end
32
- #
33
- # - you may also have to hack rubygems.rb to eliminate a reference to
34
- # RUBY_ENGINE (just comment it out)
35
- #
36
-
37
- HOST=
38
-
39
- # Load RVM into a shell session *as a function*
40
- if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
41
- source "$HOME/.rvm/scripts/rvm"
42
- elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
43
- source "/usr/local/rvm/scripts/rvm"
44
- else
45
- echo "ERROR: An RVM installation was not found.\n"
46
- fi
47
-
48
- function rvm_use {
49
- current_ruby=$1
50
- rvm use "${1}@nokogiri" --create || rvm -v
51
- }
52
-
53
- set -o errexit
54
-
55
- # initialize
56
- rvm_use 1.8.7
57
- bundle install --quiet --local || bundle install
58
- rm -rf tmp pkg
59
- bundle exec rake clean
60
-
61
- # holding pen
62
- rm -rf gems
63
- mkdir -p gems
64
-
65
- # windows
66
- platform=$(uname -i)
67
- if [[ $platform =~ "64" ]] ; then
68
- echo ""
69
- echo "ERROR: You need to build the windows gem on a 32-bit machine!"
70
- echo ""
71
- exit 1
72
- fi
73
- rvm_use 1.8.7
74
- if [[ ! -a ${HOME}/.rake-compiler/ruby/ruby-1.8.7-p358/lib/ruby/1.8.7/x86_64-linux/rbconfig.rb ]] ; then
75
-
76
- # if this fails around the purelib.rb thing, try varying the ruby
77
- # used to run this script, and whether the HOST env var is set
78
- # below.
79
-
80
- bundle exec rake-compiler cross-ruby VERSION=1.8.7-p358 # HOST=i386-mingw32
81
- fi
82
- if [[ ! -a ${HOME}/.rake-compiler/ruby/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-linux/rbconfig.rb ]] ; then
83
- bundle exec rake-compiler cross-ruby VERSION=1.9.3-p194
84
- fi
85
- if [[ ! -a ${HOME}/.rake-compiler/ruby/ruby-2.0.0-p0/lib/ruby/2.0.0/x86_64-linux/rbconfig.rb ]] ; then
86
- bundle exec rake-compiler cross-ruby VERSION=2.0.0-p0
87
- fi
88
- bundle exec rake cross
89
- bundle exec rake gem:windows
90
- cp -v pkg/nokogiri*x86-{mingw32,mswin32}*.gem gems
91
-
92
- # MRI
93
- rvm_use 1.8.7
94
- bundle exec rake gem
95
- cp -v pkg/nokogiri*.gem gems # should only be one at this point in the script
96
-
97
- # jruby
98
- rvm_use jruby
99
- bundle install --quiet --local || bundle install
100
- bundle exec rake clean clobber
101
- rvm_use 1.8.7
102
- bundle exec rake generate
103
- rvm_use jruby
104
- bundle exec rake gem
105
- cp -v pkg/nokogiri*java.gem gems