nokogiri 1.14.5-x64-mingw32 → 1.15.0-x64-mingw32

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 (111) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -8
  3. data/dependencies.yml +6 -6
  4. data/ext/nokogiri/extconf.rb +66 -22
  5. data/ext/nokogiri/html4_document.c +1 -2
  6. data/ext/nokogiri/html4_element_description.c +19 -14
  7. data/ext/nokogiri/html4_sax_parser_context.c +10 -16
  8. data/ext/nokogiri/html4_sax_push_parser.c +2 -2
  9. data/ext/nokogiri/include/libexslt/exsltconfig.h +3 -3
  10. data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +52 -38
  11. data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +18 -18
  12. data/ext/nokogiri/include/libxml2/libxml/SAX.h +36 -36
  13. data/ext/nokogiri/include/libxml2/libxml/SAX2.h +37 -36
  14. data/ext/nokogiri/include/libxml2/libxml/c14n.h +4 -4
  15. data/ext/nokogiri/include/libxml2/libxml/catalog.h +36 -36
  16. data/ext/nokogiri/include/libxml2/libxml/chvalid.h +9 -9
  17. data/ext/nokogiri/include/libxml2/libxml/debugXML.h +28 -28
  18. data/ext/nokogiri/include/libxml2/libxml/dict.h +13 -13
  19. data/ext/nokogiri/include/libxml2/libxml/encoding.h +20 -19
  20. data/ext/nokogiri/include/libxml2/libxml/entities.h +19 -21
  21. data/ext/nokogiri/include/libxml2/libxml/globals.h +89 -59
  22. data/ext/nokogiri/include/libxml2/libxml/hash.h +25 -25
  23. data/ext/nokogiri/include/libxml2/libxml/list.h +26 -26
  24. data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +22 -22
  25. data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +17 -17
  26. data/ext/nokogiri/include/libxml2/libxml/parser.h +100 -79
  27. data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +149 -143
  28. data/ext/nokogiri/include/libxml2/libxml/pattern.h +15 -15
  29. data/ext/nokogiri/include/libxml2/libxml/relaxng.h +26 -26
  30. data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +2 -2
  31. data/ext/nokogiri/include/libxml2/libxml/schematron.h +18 -18
  32. data/ext/nokogiri/include/libxml2/libxml/threads.h +23 -20
  33. data/ext/nokogiri/include/libxml2/libxml/tree.h +166 -164
  34. data/ext/nokogiri/include/libxml2/libxml/uri.h +15 -15
  35. data/ext/nokogiri/include/libxml2/libxml/valid.h +72 -87
  36. data/ext/nokogiri/include/libxml2/libxml/xinclude.h +10 -10
  37. data/ext/nokogiri/include/libxml2/libxml/xlink.h +5 -5
  38. data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +60 -59
  39. data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +21 -21
  40. data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +18 -46
  41. data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +14 -41
  42. data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +26 -24
  43. data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +4 -4
  44. data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +87 -87
  45. data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +30 -30
  46. data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +10 -10
  47. data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +30 -30
  48. data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +34 -34
  49. data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +30 -30
  50. data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +166 -166
  51. data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +50 -27
  52. data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +80 -80
  53. data/ext/nokogiri/include/libxml2/libxml/xpath.h +41 -41
  54. data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +117 -117
  55. data/ext/nokogiri/include/libxml2/libxml/xpointer.h +21 -21
  56. data/ext/nokogiri/include/libxslt/attributes.h +1 -0
  57. data/ext/nokogiri/include/libxslt/variables.h +3 -3
  58. data/ext/nokogiri/include/libxslt/xsltInternals.h +14 -4
  59. data/ext/nokogiri/include/libxslt/xsltconfig.h +4 -4
  60. data/ext/nokogiri/include/libxslt/xsltlocale.h +14 -54
  61. data/ext/nokogiri/include/libxslt/xsltutils.h +35 -2
  62. data/ext/nokogiri/nokogiri.c +46 -24
  63. data/ext/nokogiri/nokogiri.h +13 -2
  64. data/ext/nokogiri/xml_attr.c +1 -1
  65. data/ext/nokogiri/xml_cdata.c +10 -2
  66. data/ext/nokogiri/xml_comment.c +1 -1
  67. data/ext/nokogiri/xml_document.c +102 -22
  68. data/ext/nokogiri/xml_document_fragment.c +1 -1
  69. data/ext/nokogiri/xml_dtd.c +1 -1
  70. data/ext/nokogiri/xml_element_content.c +32 -29
  71. data/ext/nokogiri/xml_element_decl.c +5 -5
  72. data/ext/nokogiri/xml_encoding_handler.c +12 -4
  73. data/ext/nokogiri/xml_entity_reference.c +1 -1
  74. data/ext/nokogiri/xml_namespace.c +11 -12
  75. data/ext/nokogiri/xml_node.c +7 -7
  76. data/ext/nokogiri/xml_node_set.c +125 -105
  77. data/ext/nokogiri/xml_processing_instruction.c +1 -1
  78. data/ext/nokogiri/xml_reader.c +37 -28
  79. data/ext/nokogiri/xml_relax_ng.c +65 -78
  80. data/ext/nokogiri/xml_sax_parser.c +24 -5
  81. data/ext/nokogiri/xml_sax_parser_context.c +46 -25
  82. data/ext/nokogiri/xml_sax_push_parser.c +29 -8
  83. data/ext/nokogiri/xml_schema.c +90 -116
  84. data/ext/nokogiri/xml_text.c +10 -2
  85. data/ext/nokogiri/xml_xpath_context.c +156 -83
  86. data/ext/nokogiri/xslt_stylesheet.c +103 -50
  87. data/lib/nokogiri/2.7/nokogiri.so +0 -0
  88. data/lib/nokogiri/3.0/nokogiri.so +0 -0
  89. data/lib/nokogiri/css/xpath_visitor.rb +2 -2
  90. data/lib/nokogiri/extension.rb +1 -1
  91. data/lib/nokogiri/html4/document_fragment.rb +1 -1
  92. data/lib/nokogiri/html4/element_description_defaults.rb +1821 -353
  93. data/lib/nokogiri/html5/document_fragment.rb +1 -1
  94. data/lib/nokogiri/html5/node.rb +5 -0
  95. data/lib/nokogiri/html5.rb +5 -2
  96. data/lib/nokogiri/jruby/nokogiri_jars.rb +3 -3
  97. data/lib/nokogiri/version/constant.rb +1 -1
  98. data/lib/nokogiri/xml/attribute_decl.rb +4 -2
  99. data/lib/nokogiri/xml/document_fragment.rb +1 -1
  100. data/lib/nokogiri/xml/element_content.rb +10 -2
  101. data/lib/nokogiri/xml/element_decl.rb +4 -2
  102. data/lib/nokogiri/xml/entity_decl.rb +4 -2
  103. data/lib/nokogiri/xml/node/save_options.rb +8 -0
  104. data/lib/nokogiri/xml/node.rb +22 -13
  105. data/lib/nokogiri/xml/pp/node.rb +23 -12
  106. data/lib/nokogiri/xml/sax/document.rb +1 -1
  107. data/lib/nokogiri/xml/searchable.rb +18 -10
  108. data/lib/nokogiri/xslt.rb +73 -3
  109. data/lib/nokogiri.rb +12 -4
  110. data/lib/xsd/xmlparser/nokogiri.rb +1 -1
  111. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97a3425a2737c5ecf24d615f79ed83c8be001125b490844a0154f43983bd04d3
4
- data.tar.gz: 0e0fbf8be3768177591ee2655d46d8c1f6df38aad13efa35344c16dbe0357d2d
3
+ metadata.gz: a7f6f08929b04b3a978edfaabfb476e618aeebfbb22f8537f1034964a927671b
4
+ data.tar.gz: 06554057bf9eac44abbbd294794994038f40cc030f5ac46a6a61d3734871de0a
5
5
  SHA512:
6
- metadata.gz: cc817e2058f4713b7b8679dd98ce6e29f2ac9939267eba490a0f55667ce542533cab5d06e921f2b0559697553ca57d52fcbeda1cd16ba9795ece1b67775c49a1
7
- data.tar.gz: a6e56063b4f938662a4273ee0cd8320e049dca9b86ab2c3654149e966c56071fce7c0a8958b1cd2274ed24e8acb5f9e2ec582f6ebdc78d7f84d9d2d2323de03a
6
+ metadata.gz: 36c3122b65fb367fbb6f6e69664eb7780d7548963ffd54184b4096000c710e9f92903e12ae964da82945837f7353d2a67aafc6ed34cbcac2ad5064ad06a5fe85
7
+ data.tar.gz: e95ef1309b1646f11fdd24742532f80e829d97232e087084791db929ee343f7b035b48caf4f3a5a4863a7846058907e8f8e7553efcafe7354359ecdef07a94d4
data/Gemfile CHANGED
@@ -20,19 +20,20 @@ group :development do
20
20
  gem "rexical", "= 1.0.7"
21
21
 
22
22
  # tests
23
- gem "minitest", "5.17.0"
24
- gem "minitest-reporters", "= 1.5.0"
25
- gem "ruby_memcheck", "1.2.0" unless RUBY_PLATFORM == "java"
26
- gem "simplecov", "= 0.21.2"
23
+ gem "minitest", "5.18.0"
24
+ gem "minitest-reporters", "1.6.0"
25
+ gem "ruby_memcheck", git: "https://github.com/flavorjones/ruby_memcheck", ref: "flavorjones-nokogiri-huge-parse-option"
27
26
  gem "rubyzip", "~> 2.3.2"
27
+ gem "simplecov", "= 0.21.2"
28
28
 
29
29
  # rubocop
30
30
  if Gem::Requirement.new("~> 3.0").satisfied_by?(Gem::Version.new(RUBY_VERSION))
31
- gem "rubocop", "1.44.1"
32
- gem "rubocop-minitest", "0.27.0"
33
- gem "rubocop-performance", "1.15.2"
31
+ gem "rubocop", "1.50.2"
32
+ gem "rubocop-minitest", "0.31.0"
33
+ gem "rubocop-packaging", "0.5.2"
34
+ gem "rubocop-performance", "1.17.1"
34
35
  gem "rubocop-rake", "= 0.6.0"
35
- gem "rubocop-shopify", "2.10.1"
36
+ gem "rubocop-shopify", "2.13.0"
36
37
  end
37
38
  end
38
39
 
data/dependencies.yml CHANGED
@@ -1,12 +1,12 @@
1
1
  libxml2:
2
- version: "2.10.4"
3
- sha256: "ed0c91c5845008f1936739e4eee2035531c1c94742c6541f44ee66d885948d45"
4
- # sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.10/libxml2-2.10.4.sha256sum
2
+ version: "2.11.3"
3
+ sha256: "f1acae1664bda006cd81bfc238238217043d586d06659d5c0e3d1bcebe040870"
4
+ # sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.11/libxml2-2.11.3.sha256sum
5
5
 
6
6
  libxslt:
7
- version: "1.1.37"
8
- sha256: "3a4b27dc8027ccd6146725950336f1ec520928f320f144eb5fa7990ae6123ab4"
9
- # sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.37.sha256sum
7
+ version: "1.1.38"
8
+ sha256: "1f32450425819a09acaff2ab7a5a7f8a2ec7956e505d7beeb45e843d0e1ecab1"
9
+ # sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.38.sha256sum
10
10
 
11
11
  zlib:
12
12
  version: "1.2.13"
@@ -15,7 +15,7 @@ PACKAGE_ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."
15
15
  REQUIRED_LIBXML_VERSION = "2.6.21"
16
16
  RECOMMENDED_LIBXML_VERSION = "2.9.3"
17
17
 
18
- REQUIRED_MINI_PORTILE_VERSION = "~> 2.8.0" # keep this version in sync with the one in the gemspec
18
+ REQUIRED_MINI_PORTILE_VERSION = "~> 2.8.2" # keep this version in sync with the one in the gemspec
19
19
  REQUIRED_PKG_CONFIG_VERSION = "~> 1.1"
20
20
 
21
21
  # Keep track of what versions of what libraries we build against
@@ -229,7 +229,7 @@ def gnome_source
229
229
  if ENV["NOKOGIRI_USE_CANONICAL_GNOME_SOURCE"]
230
230
  "https://download.gnome.org"
231
231
  else
232
- "https://mirror.csclub.uwaterloo.ca/gnome" # old reliable
232
+ "https://muug.ca/mirror/gnome" # old reliable
233
233
  end
234
234
  end
235
235
 
@@ -372,7 +372,7 @@ def try_link_iconv(using = nil)
372
372
  preserving_globals do
373
373
  yield if block_given?
374
374
 
375
- try_link(<<~'SRC', opt)
375
+ try_link(<<~SRC, opt)
376
376
  #include <stdlib.h>
377
377
  #include <iconv.h>
378
378
  int main(void)
@@ -695,14 +695,34 @@ append_cppflags(' "-Idummypath"') if windows?
695
695
 
696
696
  if config_system_libraries?
697
697
  message "Building nokogiri using system libraries.\n"
698
- ensure_package_configuration(opt: "zlib", pc: "zlib", lib: "z",
699
- headers: "zlib.h", func: "gzdopen")
700
- ensure_package_configuration(opt: "xml2", pc: "libxml-2.0", lib: "xml2",
701
- headers: "libxml/parser.h", func: "xmlParseDoc")
702
- ensure_package_configuration(opt: "xslt", pc: "libxslt", lib: "xslt",
703
- headers: "libxslt/xslt.h", func: "xsltParseStylesheetDoc")
704
- ensure_package_configuration(opt: "exslt", pc: "libexslt", lib: "exslt",
705
- headers: "libexslt/exslt.h", func: "exsltFuncRegister")
698
+ ensure_package_configuration(
699
+ opt: "zlib",
700
+ pc: "zlib",
701
+ lib: "z",
702
+ headers: "zlib.h",
703
+ func: "gzdopen",
704
+ )
705
+ ensure_package_configuration(
706
+ opt: "xml2",
707
+ pc: "libxml-2.0",
708
+ lib: "xml2",
709
+ headers: "libxml/parser.h",
710
+ func: "xmlParseDoc",
711
+ )
712
+ ensure_package_configuration(
713
+ opt: "xslt",
714
+ pc: "libxslt",
715
+ lib: "xslt",
716
+ headers: "libxslt/xslt.h",
717
+ func: "xsltParseStylesheetDoc",
718
+ )
719
+ ensure_package_configuration(
720
+ opt: "exslt",
721
+ pc: "libexslt",
722
+ lib: "exslt",
723
+ headers: "libexslt/exslt.h",
724
+ func: "exsltFuncRegister",
725
+ )
706
726
 
707
727
  have_libxml_headers?(REQUIRED_LIBXML_VERSION) ||
708
728
  abort("ERROR: libxml2 version #{REQUIRED_LIBXML_VERSION} or later is required!")
@@ -785,8 +805,12 @@ else
785
805
  end
786
806
 
787
807
  unless nix?
788
- libiconv_recipe = process_recipe("libiconv", dependencies["libiconv"]["version"], static_p,
789
- cross_build_p) do |recipe|
808
+ libiconv_recipe = process_recipe(
809
+ "libiconv",
810
+ dependencies["libiconv"]["version"],
811
+ static_p,
812
+ cross_build_p,
813
+ ) do |recipe|
790
814
  recipe.files = [{
791
815
  url: "https://ftp.gnu.org/pub/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz",
792
816
  sha256: dependencies["libiconv"]["sha256"],
@@ -824,15 +848,25 @@ else
824
848
  if zlib_recipe
825
849
  append_cppflags("-I#{zlib_recipe.path}/include")
826
850
  $LIBPATH = ["#{zlib_recipe.path}/lib"] | $LIBPATH
827
- ensure_package_configuration(opt: "zlib", pc: "zlib", lib: "z",
828
- headers: "zlib.h", func: "gzdopen")
851
+ ensure_package_configuration(
852
+ opt: "zlib",
853
+ pc: "zlib",
854
+ lib: "z",
855
+ headers: "zlib.h",
856
+ func: "gzdopen",
857
+ )
829
858
  end
830
859
 
831
860
  if libiconv_recipe
832
861
  append_cppflags("-I#{libiconv_recipe.path}/include")
833
862
  $LIBPATH = ["#{libiconv_recipe.path}/lib"] | $LIBPATH
834
- ensure_package_configuration(opt: "iconv", pc: "iconv", lib: "iconv",
835
- headers: "iconv.h", func: "iconv_open")
863
+ ensure_package_configuration(
864
+ opt: "iconv",
865
+ pc: "iconv",
866
+ lib: "iconv",
867
+ headers: "iconv.h",
868
+ func: "iconv_open",
869
+ )
836
870
  end
837
871
 
838
872
  libxml2_recipe = process_recipe("libxml2", dependencies["libxml2"]["version"], static_p, cross_build_p) do |recipe|
@@ -848,8 +882,13 @@ else
848
882
  recipe.patch_files = Dir[File.join(PACKAGE_ROOT_DIR, "patches", "libxml2", "*.patch")].sort
849
883
  end
850
884
 
885
+ cppflags = concat_flags(ENV["CPPFLAGS"])
851
886
  cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
852
887
 
888
+ if cross_build_p
889
+ cppflags = concat_flags(cppflags, "-DNOKOGIRI_PRECOMPILED_LIBRARIES")
890
+ end
891
+
853
892
  if zlib_recipe
854
893
  recipe.configure_options << "--with-zlib=#{zlib_recipe.path}"
855
894
  end
@@ -880,6 +919,7 @@ else
880
919
  "--with-c14n",
881
920
  "--with-debug",
882
921
  "--with-threads",
922
+ "CPPFLAGS=#{cppflags}",
883
923
  "CFLAGS=#{cflags}",
884
924
  ]
885
925
  end
@@ -1023,7 +1063,7 @@ libgumbo_recipe = process_recipe("libgumbo", "1.0.0-nokogiri", static_p, cross_b
1023
1063
 
1024
1064
  env = { "CC" => gcc_cmd, "CFLAGS" => cflags }
1025
1065
  if config_cross_build?
1026
- if /darwin/.match?(host)
1066
+ if host.include?("darwin")
1027
1067
  env["AR"] = "#{host}-libtool"
1028
1068
  env["ARFLAGS"] = "-o"
1029
1069
  else
@@ -1057,12 +1097,16 @@ unless config_system_libraries?
1057
1097
  if cross_build_p
1058
1098
  # When precompiling native gems, copy packaged libraries' headers to ext/nokogiri/include
1059
1099
  # These are packaged up by the cross-compiling callback in the ExtensionTask
1060
- copy_packaged_libraries_headers(to_path: File.join(PACKAGE_ROOT_DIR, "ext/nokogiri/include"),
1061
- from_recipes: [libxml2_recipe, libxslt_recipe])
1100
+ copy_packaged_libraries_headers(
1101
+ to_path: File.join(PACKAGE_ROOT_DIR, "ext/nokogiri/include"),
1102
+ from_recipes: [libxml2_recipe, libxslt_recipe],
1103
+ )
1062
1104
  else
1063
1105
  # When compiling during installation, install packaged libraries' header files into ext/nokogiri/include
1064
- copy_packaged_libraries_headers(to_path: "include",
1065
- from_recipes: [libxml2_recipe, libxslt_recipe])
1106
+ copy_packaged_libraries_headers(
1107
+ to_path: "include",
1108
+ from_recipes: [libxml2_recipe, libxslt_recipe],
1109
+ )
1066
1110
  $INSTALLFILES << ["include/**/*.h", "$(rubylibdir)"]
1067
1111
  end
1068
1112
  end
@@ -144,8 +144,7 @@ rb_html_document_s_read_memory(VALUE klass, VALUE rb_html, VALUE rb_url, VALUE r
144
144
  static VALUE
145
145
  rb_html_document_type(VALUE self)
146
146
  {
147
- htmlDocPtr doc;
148
- Data_Get_Struct(self, xmlDoc, doc);
147
+ htmlDocPtr doc = noko_xml_document_unwrap(self);
149
148
  return INT2NUM(doc->type);
150
149
  }
151
150
 
@@ -1,5 +1,10 @@
1
1
  #include <nokogiri.h>
2
2
 
3
+ static const rb_data_type_t html4_element_description_type = {
4
+ .wrap_struct_name = "Nokogiri::HTML4::ElementDescription",
5
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
6
+ };
7
+
3
8
  VALUE cNokogiriHtml4ElementDescription ;
4
9
 
5
10
  /*
@@ -15,7 +20,7 @@ required_attributes(VALUE self)
15
20
  VALUE list;
16
21
  int i;
17
22
 
18
- Data_Get_Struct(self, htmlElemDesc, description);
23
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
19
24
 
20
25
  list = rb_ary_new();
21
26
 
@@ -41,7 +46,7 @@ deprecated_attributes(VALUE self)
41
46
  VALUE list;
42
47
  int i;
43
48
 
44
- Data_Get_Struct(self, htmlElemDesc, description);
49
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
45
50
 
46
51
  list = rb_ary_new();
47
52
 
@@ -67,7 +72,7 @@ optional_attributes(VALUE self)
67
72
  VALUE list;
68
73
  int i;
69
74
 
70
- Data_Get_Struct(self, htmlElemDesc, description);
75
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
71
76
 
72
77
  list = rb_ary_new();
73
78
 
@@ -90,7 +95,7 @@ static VALUE
90
95
  default_sub_element(VALUE self)
91
96
  {
92
97
  const htmlElemDesc *description;
93
- Data_Get_Struct(self, htmlElemDesc, description);
98
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
94
99
 
95
100
  if (description->defaultsubelt) {
96
101
  return NOKOGIRI_STR_NEW2(description->defaultsubelt);
@@ -112,7 +117,7 @@ sub_elements(VALUE self)
112
117
  VALUE list;
113
118
  int i;
114
119
 
115
- Data_Get_Struct(self, htmlElemDesc, description);
120
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
116
121
 
117
122
  list = rb_ary_new();
118
123
 
@@ -135,7 +140,7 @@ static VALUE
135
140
  description(VALUE self)
136
141
  {
137
142
  const htmlElemDesc *description;
138
- Data_Get_Struct(self, htmlElemDesc, description);
143
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
139
144
 
140
145
  return NOKOGIRI_STR_NEW2(description->desc);
141
146
  }
@@ -150,7 +155,7 @@ static VALUE
150
155
  inline_eh(VALUE self)
151
156
  {
152
157
  const htmlElemDesc *description;
153
- Data_Get_Struct(self, htmlElemDesc, description);
158
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
154
159
 
155
160
  if (description->isinline) { return Qtrue; }
156
161
  return Qfalse;
@@ -166,7 +171,7 @@ static VALUE
166
171
  deprecated_eh(VALUE self)
167
172
  {
168
173
  const htmlElemDesc *description;
169
- Data_Get_Struct(self, htmlElemDesc, description);
174
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
170
175
 
171
176
  if (description->depr) { return Qtrue; }
172
177
  return Qfalse;
@@ -182,7 +187,7 @@ static VALUE
182
187
  empty_eh(VALUE self)
183
188
  {
184
189
  const htmlElemDesc *description;
185
- Data_Get_Struct(self, htmlElemDesc, description);
190
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
186
191
 
187
192
  if (description->empty) { return Qtrue; }
188
193
  return Qfalse;
@@ -198,7 +203,7 @@ static VALUE
198
203
  save_end_tag_eh(VALUE self)
199
204
  {
200
205
  const htmlElemDesc *description;
201
- Data_Get_Struct(self, htmlElemDesc, description);
206
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
202
207
 
203
208
  if (description->saveEndTag) { return Qtrue; }
204
209
  return Qfalse;
@@ -214,7 +219,7 @@ static VALUE
214
219
  implied_end_tag_eh(VALUE self)
215
220
  {
216
221
  const htmlElemDesc *description;
217
- Data_Get_Struct(self, htmlElemDesc, description);
222
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
218
223
 
219
224
  if (description->endTag) { return Qtrue; }
220
225
  return Qfalse;
@@ -230,7 +235,7 @@ static VALUE
230
235
  implied_start_tag_eh(VALUE self)
231
236
  {
232
237
  const htmlElemDesc *description;
233
- Data_Get_Struct(self, htmlElemDesc, description);
238
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
234
239
 
235
240
  if (description->startTag) { return Qtrue; }
236
241
  return Qfalse;
@@ -246,7 +251,7 @@ static VALUE
246
251
  name(VALUE self)
247
252
  {
248
253
  const htmlElemDesc *description;
249
- Data_Get_Struct(self, htmlElemDesc, description);
254
+ TypedData_Get_Struct(self, htmlElemDesc, &html4_element_description_type, description);
250
255
 
251
256
  if (NULL == description->name) { return Qnil; }
252
257
  return NOKOGIRI_STR_NEW2(description->name);
@@ -266,7 +271,7 @@ get_description(VALUE klass, VALUE tag_name)
266
271
  );
267
272
 
268
273
  if (NULL == description) { return Qnil; }
269
- return Data_Wrap_Struct(klass, 0, 0, DISCARD_CONST_QUAL(void *, description));
274
+ return TypedData_Wrap_Struct(klass, &html4_element_description_type, DISCARD_CONST_QUAL(void *, description));
270
275
  }
271
276
 
272
277
  void
@@ -2,13 +2,6 @@
2
2
 
3
3
  VALUE cNokogiriHtml4SaxParserContext ;
4
4
 
5
- static void
6
- deallocate(xmlParserCtxtPtr ctxt)
7
- {
8
- ctxt->sax = NULL;
9
- htmlFreeParserCtxt(ctxt);
10
- }
11
-
12
5
  static VALUE
13
6
  parse_memory(VALUE klass, VALUE data, VALUE encoding)
14
7
  {
@@ -38,7 +31,7 @@ parse_memory(VALUE klass, VALUE data, VALUE encoding)
38
31
  }
39
32
  }
40
33
 
41
- return Data_Wrap_Struct(klass, NULL, deallocate, ctxt);
34
+ return noko_xml_sax_parser_context_wrap(klass, ctxt);
42
35
  }
43
36
 
44
37
  static VALUE
@@ -48,7 +41,13 @@ parse_file(VALUE klass, VALUE filename, VALUE encoding)
48
41
  StringValueCStr(filename),
49
42
  StringValueCStr(encoding)
50
43
  );
51
- return Data_Wrap_Struct(klass, NULL, deallocate, ctxt);
44
+
45
+ if (ctxt->sax) {
46
+ xmlFree(ctxt->sax);
47
+ ctxt->sax = NULL;
48
+ }
49
+
50
+ return noko_xml_sax_parser_context_wrap(klass, ctxt);
52
51
  }
53
52
 
54
53
  static VALUE
@@ -82,13 +81,8 @@ parse_with(VALUE self, VALUE sax_handler)
82
81
  rb_raise(rb_eArgError, "argument must be a Nokogiri::XML::SAX::Parser");
83
82
  }
84
83
 
85
- Data_Get_Struct(self, htmlParserCtxt, ctxt);
86
- Data_Get_Struct(sax_handler, htmlSAXHandler, sax);
87
-
88
- /* Free the sax handler since we'll assign our own */
89
- if (ctxt->sax && ctxt->sax != (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) {
90
- xmlFree(ctxt->sax);
91
- }
84
+ ctxt = noko_xml_sax_parser_context_unwrap(self);
85
+ sax = noko_sax_handler_unwrap(sax_handler);
92
86
 
93
87
  ctxt->sax = sax;
94
88
  ctxt->userData = (void *)NOKOGIRI_SAX_TUPLE_NEW(ctxt, sax_handler);
@@ -17,7 +17,7 @@ native_write(VALUE self, VALUE _chunk, VALUE _last_chunk)
17
17
  int status = 0;
18
18
  libxmlStructuredErrorHandlerState handler_state;
19
19
 
20
- Data_Get_Struct(self, xmlParserCtxt, ctx);
20
+ ctx = noko_xml_sax_push_parser_unwrap(self);
21
21
 
22
22
  if (Qnil != _chunk) {
23
23
  chunk = StringValuePtr(_chunk);
@@ -54,7 +54,7 @@ initialize_native(VALUE self, VALUE _xml_sax, VALUE _filename,
54
54
  htmlParserCtxtPtr ctx;
55
55
  xmlCharEncoding enc = XML_CHAR_ENCODING_NONE;
56
56
 
57
- Data_Get_Struct(_xml_sax, xmlSAXHandler, sax);
57
+ sax = noko_sax_handler_unwrap(_xml_sax);
58
58
 
59
59
  if (_filename != Qnil) { filename = StringValueCStr(_filename); }
60
60
 
@@ -18,21 +18,21 @@ extern "C" {
18
18
  *
19
19
  * the version string like "1.2.3"
20
20
  */
21
- #define LIBEXSLT_DOTTED_VERSION "0.8.20"
21
+ #define LIBEXSLT_DOTTED_VERSION "0.8.21"
22
22
 
23
23
  /**
24
24
  * LIBEXSLT_VERSION:
25
25
  *
26
26
  * the version number: 1.2.3 value is 10203
27
27
  */
28
- #define LIBEXSLT_VERSION 820
28
+ #define LIBEXSLT_VERSION 821
29
29
 
30
30
  /**
31
31
  * LIBEXSLT_VERSION_STRING:
32
32
  *
33
33
  * the version number string, 1.2.3 value is "10203"
34
34
  */
35
- #define LIBEXSLT_VERSION_STRING "820"
35
+ #define LIBEXSLT_VERSION_STRING "821"
36
36
 
37
37
  /**
38
38
  * LIBEXSLT_VERSION_EXTRA:
@@ -83,87 +83,101 @@ struct _htmlEntityDesc {
83
83
  /*
84
84
  * There is only few public functions.
85
85
  */
86
- XMLPUBFUN const htmlElemDesc * XMLCALL
86
+ XML_DEPRECATED
87
+ XMLPUBFUN void
88
+ htmlInitAutoClose (void);
89
+ XMLPUBFUN const htmlElemDesc *
87
90
  htmlTagLookup (const xmlChar *tag);
88
- XMLPUBFUN const htmlEntityDesc * XMLCALL
91
+ XMLPUBFUN const htmlEntityDesc *
89
92
  htmlEntityLookup(const xmlChar *name);
90
- XMLPUBFUN const htmlEntityDesc * XMLCALL
93
+ XMLPUBFUN const htmlEntityDesc *
91
94
  htmlEntityValueLookup(unsigned int value);
92
95
 
93
- XMLPUBFUN int XMLCALL
96
+ XMLPUBFUN int
94
97
  htmlIsAutoClosed(htmlDocPtr doc,
95
98
  htmlNodePtr elem);
96
- XMLPUBFUN int XMLCALL
99
+ XMLPUBFUN int
97
100
  htmlAutoCloseTag(htmlDocPtr doc,
98
101
  const xmlChar *name,
99
102
  htmlNodePtr elem);
100
- XMLPUBFUN const htmlEntityDesc * XMLCALL
103
+ XML_DEPRECATED
104
+ XMLPUBFUN const htmlEntityDesc *
101
105
  htmlParseEntityRef(htmlParserCtxtPtr ctxt,
102
106
  const xmlChar **str);
103
- XMLPUBFUN int XMLCALL
107
+ XML_DEPRECATED
108
+ XMLPUBFUN int
104
109
  htmlParseCharRef(htmlParserCtxtPtr ctxt);
105
- XMLPUBFUN void XMLCALL
110
+ XML_DEPRECATED
111
+ XMLPUBFUN void
106
112
  htmlParseElement(htmlParserCtxtPtr ctxt);
107
113
 
108
- XMLPUBFUN htmlParserCtxtPtr XMLCALL
114
+ XMLPUBFUN htmlParserCtxtPtr
109
115
  htmlNewParserCtxt(void);
116
+ XMLPUBFUN htmlParserCtxtPtr
117
+ htmlNewSAXParserCtxt(const htmlSAXHandler *sax,
118
+ void *userData);
110
119
 
111
- XMLPUBFUN htmlParserCtxtPtr XMLCALL
120
+ XMLPUBFUN htmlParserCtxtPtr
112
121
  htmlCreateMemoryParserCtxt(const char *buffer,
113
122
  int size);
114
123
 
115
- XMLPUBFUN int XMLCALL
124
+ XMLPUBFUN int
116
125
  htmlParseDocument(htmlParserCtxtPtr ctxt);
117
- XMLPUBFUN htmlDocPtr XMLCALL
126
+ XML_DEPRECATED
127
+ XMLPUBFUN htmlDocPtr
118
128
  htmlSAXParseDoc (const xmlChar *cur,
119
129
  const char *encoding,
120
130
  htmlSAXHandlerPtr sax,
121
131
  void *userData);
122
- XMLPUBFUN htmlDocPtr XMLCALL
132
+ XMLPUBFUN htmlDocPtr
123
133
  htmlParseDoc (const xmlChar *cur,
124
134
  const char *encoding);
125
- XMLPUBFUN htmlDocPtr XMLCALL
135
+ XMLPUBFUN htmlParserCtxtPtr
136
+ htmlCreateFileParserCtxt(const char *filename,
137
+ const char *encoding);
138
+ XML_DEPRECATED
139
+ XMLPUBFUN htmlDocPtr
126
140
  htmlSAXParseFile(const char *filename,
127
141
  const char *encoding,
128
142
  htmlSAXHandlerPtr sax,
129
143
  void *userData);
130
- XMLPUBFUN htmlDocPtr XMLCALL
144
+ XMLPUBFUN htmlDocPtr
131
145
  htmlParseFile (const char *filename,
132
146
  const char *encoding);
133
- XMLPUBFUN int XMLCALL
147
+ XMLPUBFUN int
134
148
  UTF8ToHtml (unsigned char *out,
135
149
  int *outlen,
136
150
  const unsigned char *in,
137
151
  int *inlen);
138
- XMLPUBFUN int XMLCALL
152
+ XMLPUBFUN int
139
153
  htmlEncodeEntities(unsigned char *out,
140
154
  int *outlen,
141
155
  const unsigned char *in,
142
156
  int *inlen, int quoteChar);
143
- XMLPUBFUN int XMLCALL
157
+ XMLPUBFUN int
144
158
  htmlIsScriptAttribute(const xmlChar *name);
145
- XMLPUBFUN int XMLCALL
159
+ XMLPUBFUN int
146
160
  htmlHandleOmittedElem(int val);
147
161
 
148
162
  #ifdef LIBXML_PUSH_ENABLED
149
163
  /**
150
164
  * Interfaces for the Push mode.
151
165
  */
152
- XMLPUBFUN htmlParserCtxtPtr XMLCALL
166
+ XMLPUBFUN htmlParserCtxtPtr
153
167
  htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax,
154
168
  void *user_data,
155
169
  const char *chunk,
156
170
  int size,
157
171
  const char *filename,
158
172
  xmlCharEncoding enc);
159
- XMLPUBFUN int XMLCALL
173
+ XMLPUBFUN int
160
174
  htmlParseChunk (htmlParserCtxtPtr ctxt,
161
175
  const char *chunk,
162
176
  int size,
163
177
  int terminate);
164
178
  #endif /* LIBXML_PUSH_ENABLED */
165
179
 
166
- XMLPUBFUN void XMLCALL
180
+ XMLPUBFUN void
167
181
  htmlFreeParserCtxt (htmlParserCtxtPtr ctxt);
168
182
 
169
183
  /*
@@ -188,63 +202,63 @@ typedef enum {
188
202
  HTML_PARSE_IGNORE_ENC=1<<21 /* ignore internal document encoding hint */
189
203
  } htmlParserOption;
190
204
 
191
- XMLPUBFUN void XMLCALL
205
+ XMLPUBFUN void
192
206
  htmlCtxtReset (htmlParserCtxtPtr ctxt);
193
- XMLPUBFUN int XMLCALL
207
+ XMLPUBFUN int
194
208
  htmlCtxtUseOptions (htmlParserCtxtPtr ctxt,
195
209
  int options);
196
- XMLPUBFUN htmlDocPtr XMLCALL
210
+ XMLPUBFUN htmlDocPtr
197
211
  htmlReadDoc (const xmlChar *cur,
198
212
  const char *URL,
199
213
  const char *encoding,
200
214
  int options);
201
- XMLPUBFUN htmlDocPtr XMLCALL
215
+ XMLPUBFUN htmlDocPtr
202
216
  htmlReadFile (const char *URL,
203
217
  const char *encoding,
204
218
  int options);
205
- XMLPUBFUN htmlDocPtr XMLCALL
219
+ XMLPUBFUN htmlDocPtr
206
220
  htmlReadMemory (const char *buffer,
207
221
  int size,
208
222
  const char *URL,
209
223
  const char *encoding,
210
224
  int options);
211
- XMLPUBFUN htmlDocPtr XMLCALL
225
+ XMLPUBFUN htmlDocPtr
212
226
  htmlReadFd (int fd,
213
227
  const char *URL,
214
228
  const char *encoding,
215
229
  int options);
216
- XMLPUBFUN htmlDocPtr XMLCALL
230
+ XMLPUBFUN htmlDocPtr
217
231
  htmlReadIO (xmlInputReadCallback ioread,
218
232
  xmlInputCloseCallback ioclose,
219
233
  void *ioctx,
220
234
  const char *URL,
221
235
  const char *encoding,
222
236
  int options);
223
- XMLPUBFUN htmlDocPtr XMLCALL
237
+ XMLPUBFUN htmlDocPtr
224
238
  htmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
225
239
  const xmlChar *cur,
226
240
  const char *URL,
227
241
  const char *encoding,
228
242
  int options);
229
- XMLPUBFUN htmlDocPtr XMLCALL
243
+ XMLPUBFUN htmlDocPtr
230
244
  htmlCtxtReadFile (xmlParserCtxtPtr ctxt,
231
245
  const char *filename,
232
246
  const char *encoding,
233
247
  int options);
234
- XMLPUBFUN htmlDocPtr XMLCALL
248
+ XMLPUBFUN htmlDocPtr
235
249
  htmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
236
250
  const char *buffer,
237
251
  int size,
238
252
  const char *URL,
239
253
  const char *encoding,
240
254
  int options);
241
- XMLPUBFUN htmlDocPtr XMLCALL
255
+ XMLPUBFUN htmlDocPtr
242
256
  htmlCtxtReadFd (xmlParserCtxtPtr ctxt,
243
257
  int fd,
244
258
  const char *URL,
245
259
  const char *encoding,
246
260
  int options);
247
- XMLPUBFUN htmlDocPtr XMLCALL
261
+ XMLPUBFUN htmlDocPtr
248
262
  htmlCtxtReadIO (xmlParserCtxtPtr ctxt,
249
263
  xmlInputReadCallback ioread,
250
264
  xmlInputCloseCallback ioclose,
@@ -266,10 +280,10 @@ typedef enum {
266
280
  /* Using htmlElemDesc rather than name here, to emphasise the fact
267
281
  that otherwise there's a lookup overhead
268
282
  */
269
- XMLPUBFUN htmlStatus XMLCALL htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
270
- XMLPUBFUN int XMLCALL htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
271
- XMLPUBFUN htmlStatus XMLCALL htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
272
- XMLPUBFUN htmlStatus XMLCALL htmlNodeStatus(const htmlNodePtr, int) ;
283
+ XMLPUBFUN htmlStatus htmlAttrAllowed(const htmlElemDesc*, const xmlChar*, int) ;
284
+ XMLPUBFUN int htmlElementAllowedHere(const htmlElemDesc*, const xmlChar*) ;
285
+ XMLPUBFUN htmlStatus htmlElementStatusHere(const htmlElemDesc*, const htmlElemDesc*) ;
286
+ XMLPUBFUN htmlStatus htmlNodeStatus(const htmlNodePtr, int) ;
273
287
  /**
274
288
  * htmlDefaultSubelement:
275
289
  * @elt: HTML element