libxml-ruby 2.0.6-x86-mingw32 → 2.0.9-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/HISTORY CHANGED
@@ -1,5 +1,11 @@
1
1
  = Release History
2
2
 
3
+ == 2.0.8 / 2011-06-23 Charlie Savage
4
+
5
+ * Add in 2 new HTML Parser constants - NODEFDTD and NOIMPLIED.
6
+
7
+ * Fix compile issue on Ruby 1.9.3
8
+
3
9
  == 2.0.6 / 2011-05-23 Charlie Savage
4
10
 
5
11
  * Fix segfault that sometimes occurred when looking up encodings on 1.9.
data/Rakefile CHANGED
@@ -3,7 +3,9 @@
3
3
  require "rubygems"
4
4
  require "rake/extensiontask"
5
5
  require "rake/testtask"
6
- require 'hanna/rdoctask'
6
+ require "rubygems/package_task"
7
+ ##require 'hanna/rdoctask'
8
+ require "rdoc/task"
7
9
  require "grancher/task"
8
10
  require "yaml"
9
11
 
@@ -20,10 +22,11 @@ Rake::ExtensionTask.new do |ext|
20
22
  ext.ext_dir = "ext/libxml"
21
23
  ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
22
24
  ext.config_options << "--with-xml2-include=C:/MinGW/local/include/libxml2"
25
+ ext.config_options << "--with-zlib-dir=C:/MinGW/local"
23
26
  end
24
27
 
25
28
  # Setup generic gem
26
- Rake::GemPackageTask.new(spec) do |pkg|
29
+ Gem::PackageTask.new(spec) do |pkg|
27
30
  pkg.package_dir = 'pkg'
28
31
  pkg.need_tar = false
29
32
  end
@@ -42,7 +45,7 @@ if RUBY_PLATFORM.match(/win32|mingw32/)
42
45
  win_spec.extensions = nil
43
46
 
44
47
  # Rake task to build the windows package
45
- Rake::GemPackageTask.new(win_spec) do |pkg|
48
+ Gem::PackageTask.new(win_spec) do |pkg|
46
49
  pkg.package_dir = 'pkg'
47
50
  pkg.need_tar = false
48
51
  end
@@ -50,7 +53,7 @@ end
50
53
 
51
54
  # RDoc Task
52
55
  desc "Generate rdoc documentation"
53
- Rake::RDocTask.new("rdoc") do |rdoc|
56
+ RDoc::Task.new("rdoc") do |rdoc|
54
57
  rdoc.rdoc_dir = 'doc/libxml-ruby/rdoc'
55
58
  rdoc.title = "LibXML"
56
59
  # Show source inline with line numbers
@@ -86,4 +89,4 @@ Grancher::Task.new do |g|
86
89
  end
87
90
 
88
91
  desc "Build docs, and publish the website"
89
- task :publish_with_docs => [:rdoc, :publish]
92
+ task :publish_with_docs => [:rdoc, :publish]
@@ -2,15 +2,6 @@
2
2
 
3
3
  require 'rbconfig'
4
4
 
5
- def method_missing(s, *args)
6
- if v = Config::CONFIG[s] || Config::CONFIG[s.upcase]
7
- return v
8
- else
9
- puts "missing: #{s}"
10
- super
11
- end
12
- end
13
-
14
5
  require 'mkmf'
15
6
 
16
7
  if defined?(CFLAGS)
@@ -284,11 +284,21 @@ static VALUE rxml_html_parser_context_disable_cdata_set(VALUE self, VALUE bool)
284
284
  static VALUE rxml_html_parser_context_options_set(VALUE self, VALUE options)
285
285
  {
286
286
  int result;
287
+ int xml_options = NUM2INT(options);
287
288
  htmlParserCtxtPtr ctxt;
288
289
  Check_Type(options, T_FIXNUM);
289
290
 
290
291
  Data_Get_Struct(self, htmlParserCtxt, ctxt);
291
- result = htmlCtxtUseOptions(ctxt, NUM2INT(options));
292
+ result = htmlCtxtUseOptions(ctxt, xml_options);
293
+
294
+ #if LIBXML_VERSION >= 20707
295
+ /* Big hack here, but htmlCtxtUseOptions doens't support HTML_PARSE_NOIMPLIED.
296
+ So do it ourselves. There must be a better way??? */
297
+ if (xml_options & HTML_PARSE_NOIMPLIED)
298
+ {
299
+ ctxt->options |= HTML_PARSE_NOIMPLIED;
300
+ }
301
+ #endif
292
302
 
293
303
  return self;
294
304
  }
@@ -20,6 +20,10 @@ void rxml_init_html_parser_options(void)
20
20
  #if LIBXML_VERSION >= 20621
21
21
  /* 1: Relax parsing. */
22
22
  rb_define_const(mXMLHtmlParserOptions, "RECOVER", INT2NUM(HTML_PARSE_RECOVER));
23
+ #endif
24
+ #if LIBXML_VERSION >= 20708
25
+ /* 2: Do not default a doctype if not found */
26
+ rb_define_const(mXMLHtmlParserOptions, "NODEFDTD", INT2NUM(HTML_PARSE_NODEFDTD));
23
27
  #endif
24
28
  /* 32: Suppress error reports. */
25
29
  rb_define_const(mXMLHtmlParserOptions, "NOERROR", INT2NUM(HTML_PARSE_NOERROR));
@@ -35,4 +39,8 @@ void rxml_init_html_parser_options(void)
35
39
  /* 65536: Compact small text nodes. */
36
40
  rb_define_const(mXMLHtmlParserOptions, "COMPACT", INT2NUM(HTML_PARSE_COMPACT));
37
41
  #endif
42
+ #if LIBXML_VERSION >= 20707
43
+ /* 8192: Do not add implied html/body... elements */
44
+ rb_define_const(mXMLHtmlParserOptions, "NOIMPLIED", INT2NUM(HTML_PARSE_NOIMPLIED));
45
+ #endif
38
46
  }
@@ -1056,7 +1056,7 @@ static VALUE rxml_node_attributes_get(VALUE self)
1056
1056
  * node.property("name") -> "string"
1057
1057
  * node["name"] -> "string"
1058
1058
  *
1059
- * Obtain the named pyroperty.
1059
+ * Obtain the named property.
1060
1060
  */
1061
1061
  static VALUE rxml_node_attribute_get(VALUE self, VALUE name)
1062
1062
  {
@@ -1,9 +1,9 @@
1
1
  /* Don't nuke this block! It is used for automatically updating the
2
2
  * versions below. VERSION = string formatting, VERNUM = numbered
3
3
  * version for inline testing: increment both or none at all.*/
4
- #define RUBY_LIBXML_VERSION "2.0.6"
5
- #define RUBY_LIBXML_VERNUM 206
4
+ #define RUBY_LIBXML_VERSION "2.0.9"
5
+ #define RUBY_LIBXML_VERNUM 209
6
6
  #define RUBY_LIBXML_VER_MAJ 2
7
7
  #define RUBY_LIBXML_VER_MIN 0
8
- #define RUBY_LIBXML_VER_MIC 6
8
+ #define RUBY_LIBXML_VER_MIC 9
9
9
  #define RUBY_LIBXML_VER_PATCH 0
Binary file
Binary file
@@ -137,4 +137,11 @@ class HTMLParserTest < Test::Unit::TestCase
137
137
  assert_instance_of XML::Node, world
138
138
  assert_equal 'World', world.content
139
139
  end
140
+
141
+ def test_no_implied
142
+ html = "hello world"
143
+ parser = XML::HTMLParser.string(html, :options => XML::HTMLParser::Options::NOIMPLIED)
144
+ doc = parser.parse
145
+ assert_equal("<p>#{html}</p>", doc.root.to_s)
146
+ end
140
147
  end
@@ -0,0 +1,24 @@
1
+ # encoding: UTF-8
2
+
3
+ require './test_helper'
4
+
5
+ require 'test/unit'
6
+
7
+ class TestHtmlParserContext < Test::Unit::TestCase
8
+ def test_default_options
9
+ context = XML::HTMLParser::Context.new
10
+ assert_equal(0, context.options)
11
+ end
12
+
13
+ def test_no_options
14
+ context = XML::HTMLParser::Context.new
15
+ context.options = 0
16
+ assert_equal(0, context.options)
17
+ end
18
+
19
+ def test_options
20
+ context = XML::HTMLParser::Context.new
21
+ context.options = XML::HTMLParser::Options::NOERROR
22
+ assert_equal(XML::HTMLParser::Options::NOERROR, context.options)
23
+ end
24
+ end
@@ -13,6 +13,7 @@ require './tc_document_write'
13
13
  require './tc_dtd'
14
14
  require './tc_error'
15
15
  require './tc_html_parser'
16
+ require './tc_html_parser_context'
16
17
  require './tc_namespace'
17
18
  require './tc_namespaces'
18
19
  require './tc_node'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libxml-ruby
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 6
10
- version: 2.0.6
9
+ - 9
10
+ version: 2.0.9
11
11
  platform: x86-mingw32
12
12
  authors:
13
13
  - Ross Bamform
@@ -20,7 +20,7 @@ autorequire:
20
20
  bindir: bin
21
21
  cert_chain: []
22
22
 
23
- date: 2011-05-23 00:00:00 Z
23
+ date: 2011-06-25 00:00:00 Z
24
24
  dependencies: []
25
25
 
26
26
  description: " The Libxml-Ruby project provides Ruby language bindings for the GNOME\n Libxml2 XML toolkit. It is free software, released under the MIT License.\n Libxml-ruby's primary advantage over REXML is performance - if speed\n is your need, these are good libraries to consider, as demonstrated\n by the informal benchmark below.\n"
@@ -164,6 +164,7 @@ files:
164
164
  - test/tc_dtd.rb
165
165
  - test/tc_error.rb
166
166
  - test/tc_html_parser.rb
167
+ - test/tc_html_parser_context.rb
167
168
  - test/tc_namespace.rb
168
169
  - test/tc_namespaces.rb
169
170
  - test/tc_node.rb
@@ -240,6 +241,7 @@ test_files:
240
241
  - test/tc_dtd.rb
241
242
  - test/tc_error.rb
242
243
  - test/tc_html_parser.rb
244
+ - test/tc_html_parser_context.rb
243
245
  - test/tc_namespace.rb
244
246
  - test/tc_namespaces.rb
245
247
  - test/tc_node.rb