nokogiri-streaming-reader 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -86,7 +86,9 @@ module Nokogiri
86
86
  end
87
87
 
88
88
  def cdata_block(string)
89
- characters(string)
89
+ if @current
90
+ @current.add_child(@current.document.create_cdata(string))
91
+ end
90
92
  end
91
93
 
92
94
  end
@@ -1,5 +1,5 @@
1
1
  module Nokogiri
2
2
  module Streaming
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  end
5
5
  end
@@ -37,4 +37,31 @@ describe Nokogiri::Streaming::Reader do
37
37
  expect(meats).to eq ["<type>beef</type>"]
38
38
  end
39
39
 
40
+ it 'preserves CDATA nodes' do
41
+ doc = %{
42
+ <root><![CDATA[banana]]></root>
43
+ }
44
+
45
+ reader = subject.new(doc)
46
+ reader.on('/root') do |e|
47
+ expect(e.children.length).to eq 1
48
+ expect(e.children.first.cdata?).to be_true
49
+ end
50
+ reader.run
51
+ end
52
+
53
+ it 'preserves text nodes' do
54
+ doc = %{
55
+ <root>banana</root>
56
+ }
57
+
58
+ reader = subject.new(doc)
59
+ reader.on('/root') do |e|
60
+ expect(e.children.length).to eq 1
61
+ expect(e.children.first.text?).to be_true
62
+ expect(e.children.first.cdata?).to be_false
63
+ end
64
+ reader.run
65
+ end
66
+
40
67
  end
metadata CHANGED
@@ -1,32 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri-streaming-reader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Alexander Staubo
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-04-12 00:00:00.000000000 Z
12
+ date: 2014-10-21 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: nokogiri
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '1.4'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - '>='
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '1.4'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: bundler
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ~>
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :development
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ~>
39
44
  - !ruby/object:Gem::Version
@@ -41,29 +46,33 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: rake
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - '>='
51
+ - - ! '>='
46
52
  - !ruby/object:Gem::Version
47
53
  version: '0'
48
54
  type: :development
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - '>='
59
+ - - ! '>='
53
60
  - !ruby/object:Gem::Version
54
61
  version: '0'
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rspec
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - '>='
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - '>='
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  description: Simple streaming reader for Nokogiri.
@@ -86,28 +95,28 @@ files:
86
95
  homepage: ''
87
96
  licenses:
88
97
  - MIT
89
- metadata: {}
90
98
  post_install_message:
91
99
  rdoc_options: []
92
100
  require_paths:
93
101
  - lib
94
102
  required_ruby_version: !ruby/object:Gem::Requirement
103
+ none: false
95
104
  requirements:
96
- - - '>='
105
+ - - ! '>='
97
106
  - !ruby/object:Gem::Version
98
107
  version: '0'
99
108
  required_rubygems_version: !ruby/object:Gem::Requirement
109
+ none: false
100
110
  requirements:
101
- - - '>='
111
+ - - ! '>='
102
112
  - !ruby/object:Gem::Version
103
113
  version: '0'
104
114
  requirements: []
105
115
  rubyforge_project:
106
- rubygems_version: 2.0.3
116
+ rubygems_version: 1.8.23.2
107
117
  signing_key:
108
- specification_version: 4
118
+ specification_version: 3
109
119
  summary: Simple streaming reader for Nokogiri.
110
120
  test_files:
111
121
  - spec/reader_spec.rb
112
122
  - spec/spec_helper.rb
113
- has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: ea2154d42b35ed8dc47cd084b06c6ea6dc83e110
4
- data.tar.gz: 5fc2ab3f1509644fca55b05beb4a0325f1256e7e
5
- SHA512:
6
- metadata.gz: a5056fc8a8048574873aeac0d0df2f0eab42fa4b03608339fb976e9f00bd4040220330960e1f04654c98d62585f5ca13b56e4756e233cc177c1abb41dc3bce11
7
- data.tar.gz: 4e0f468a2a5af3f7eab6a04482ebc359cf8f152ca972148ba0298e438a02a1cb509a21a298385942a0996bdbb17223f71ae5367d5451928166682173319d509d