meteor 0.9.8.1 → 0.9.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +1 -1
- data/Gemfile.lock +18 -0
- data/README.md +8 -8
- data/demo/demo_html4.rb +110 -0
- data/demo/demo_html5.rb +65 -68
- data/demo/demo_xhtml4.rb +85 -0
- data/demo/demo_xhtml5.rb +50 -71
- data/demo/demo_xml.rb +49 -46
- data/demo/{sample.xml → ml/sample.xml} +1 -1
- data/demo/{sample.html → ml/sample_4.html} +0 -0
- data/demo/{sample_5.html → ml/sample_5.html} +0 -0
- data/demo/{sample_x.html → ml/sample_x4.html} +0 -0
- data/demo/{sample_x5.html → ml/sample_x5.html} +0 -0
- data/lib/meteor.rb +672 -531
- data/meteor.gemspec +2 -2
- metadata +24 -25
- data/demo/demo_html.rb +0 -134
- data/demo/demo_xhtml.rb +0 -102
data/meteor.gemspec
CHANGED
@@ -11,14 +11,14 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.description = %q{A lightweight (X)HTML(5) & XML parser}
|
12
12
|
spec.summary = %q{A lightweight (X)HTML(5) & XML parser}
|
13
13
|
spec.homepage = %q{https://github.com/asip/meteor}
|
14
|
-
spec.license = '
|
14
|
+
spec.license = 'LGPL-2.1'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features|demo)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "bundler", "~>
|
21
|
+
spec.add_development_dependency "bundler", "~> 2.2"
|
22
22
|
#spec.add_development_dependency "rake"
|
23
23
|
spec.has_rdoc = 'yard'
|
24
24
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: meteor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yasumasa Ashida
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.2'
|
27
27
|
description: A lightweight (X)HTML(5) & XML parser
|
28
28
|
email: ys.ashida@gmail.com
|
29
29
|
executables: []
|
@@ -33,27 +33,28 @@ files:
|
|
33
33
|
- ".gitignore"
|
34
34
|
- ChangeLog
|
35
35
|
- Gemfile
|
36
|
+
- Gemfile.lock
|
36
37
|
- README.md
|
37
38
|
- Rakefile
|
38
|
-
- demo/
|
39
|
+
- demo/demo_html4.rb
|
39
40
|
- demo/demo_html5.rb
|
40
|
-
- demo/
|
41
|
+
- demo/demo_xhtml4.rb
|
41
42
|
- demo/demo_xhtml5.rb
|
42
43
|
- demo/demo_xml.rb
|
43
|
-
- demo/sample.
|
44
|
-
- demo/
|
45
|
-
- demo/sample_5.html
|
46
|
-
- demo/
|
47
|
-
- demo/sample_x5.html
|
44
|
+
- demo/ml/sample.xml
|
45
|
+
- demo/ml/sample_4.html
|
46
|
+
- demo/ml/sample_5.html
|
47
|
+
- demo/ml/sample_x4.html
|
48
|
+
- demo/ml/sample_x5.html
|
48
49
|
- lib/meteor.rb
|
49
50
|
- meteor.gemspec
|
50
51
|
- test/meteor_test.rb
|
51
52
|
- test/test_helper.rb
|
52
53
|
homepage: https://github.com/asip/meteor
|
53
54
|
licenses:
|
54
|
-
-
|
55
|
+
- LGPL-2.1
|
55
56
|
metadata: {}
|
56
|
-
post_install_message:
|
57
|
+
post_install_message:
|
57
58
|
rdoc_options: []
|
58
59
|
require_paths:
|
59
60
|
- lib
|
@@ -68,22 +69,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
69
|
- !ruby/object:Gem::Version
|
69
70
|
version: '0'
|
70
71
|
requirements: []
|
71
|
-
|
72
|
-
|
73
|
-
signing_key:
|
72
|
+
rubygems_version: 3.2.3
|
73
|
+
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: A lightweight (X)HTML(5) & XML parser
|
76
76
|
test_files:
|
77
|
-
- demo/
|
77
|
+
- demo/demo_html4.rb
|
78
78
|
- demo/demo_html5.rb
|
79
|
-
- demo/
|
79
|
+
- demo/demo_xhtml4.rb
|
80
80
|
- demo/demo_xhtml5.rb
|
81
81
|
- demo/demo_xml.rb
|
82
|
-
- demo/sample.
|
83
|
-
- demo/
|
84
|
-
- demo/sample_5.html
|
85
|
-
- demo/
|
86
|
-
- demo/sample_x5.html
|
82
|
+
- demo/ml/sample.xml
|
83
|
+
- demo/ml/sample_4.html
|
84
|
+
- demo/ml/sample_5.html
|
85
|
+
- demo/ml/sample_x4.html
|
86
|
+
- demo/ml/sample_x5.html
|
87
87
|
- test/meteor_test.rb
|
88
88
|
- test/test_helper.rb
|
89
|
-
has_rdoc: yard
|
data/demo/demo_html.rb
DELETED
@@ -1,134 +0,0 @@
|
|
1
|
-
#!bin ruby
|
2
|
-
# -* coding: UTF-8 -*-
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'meteor'
|
6
|
-
|
7
|
-
#pf = Meteor::ParserFactory.new
|
8
|
-
#pf.bind(:html,'sample.html', 'UTF-8')
|
9
|
-
|
10
|
-
#root = pf.element('sample')
|
11
|
-
|
12
|
-
Meteor::ElementFactory.options= {:type => :html}
|
13
|
-
#Meteor::ElementFactory.bind(:html,'sample.html', 'UTF-8')
|
14
|
-
Meteor::ElementFactory.bind('sample.html')
|
15
|
-
|
16
|
-
root = Meteor::ElementFactory.element('sample')
|
17
|
-
|
18
|
-
start_time = Time.new.to_f
|
19
|
-
|
20
|
-
elm_hello = root.element('id'=>'hello')
|
21
|
-
#elm_hello = root.css('[id=hello]')
|
22
|
-
#elm_hello.attr('color'=>'red')
|
23
|
-
elm_hello['color'] = 'red'
|
24
|
-
|
25
|
-
#elm_hello.remove_attribute('color')
|
26
|
-
|
27
|
-
elm_hello2 = root.element('id','hello2')
|
28
|
-
#elm_hello2.content('Hello,Tester')
|
29
|
-
elm_hello2.content = 'Hello,Tester'
|
30
|
-
|
31
|
-
#elm_hello3 = ps.cxtag('hello3')
|
32
|
-
#elm_hello3.content = "Hello,Hello\ntt"
|
33
|
-
#elm_hello3.content = "Hello,Hello"
|
34
|
-
#puts elm_hello3.pattern
|
35
|
-
#puts elm_hello3.mixed_content
|
36
|
-
#puts elm_hello3.document
|
37
|
-
#puts elm_hello3.content
|
38
|
-
#puts elm_hello3.mixed_content
|
39
|
-
|
40
|
-
elm_text1 = root.element('input','id'=>'text1')
|
41
|
-
#elm_text1.attr('value'=>'めも')
|
42
|
-
#elm_text1['value'] = 'めも'
|
43
|
-
#elm_text1.attr = {'value' => 'メモ'}
|
44
|
-
#elm_text1.attr('disabled'=>true)
|
45
|
-
#elm_text1['disabled'] = true
|
46
|
-
elm_text1.attrs = {value: 'メモ','disabled' => true, 'readonly' => true}
|
47
|
-
#puts elm_text1.attrs
|
48
|
-
#elm_text1.remove_attr('disabled')
|
49
|
-
#map = elm_text1.attr_map
|
50
|
-
#map.names.each { |item|
|
51
|
-
# puts item
|
52
|
-
# puts map.fetch(item)
|
53
|
-
#}
|
54
|
-
|
55
|
-
#elm_radio1 = root.element('input','id'=>'radio1','type'=>'radio')
|
56
|
-
#elm_radio1 = root.css('input[id=radio1][type=radio]')
|
57
|
-
#elm_radio1 = root.find('#radio1')
|
58
|
-
#elm_radio1 = root.find('input#radio1')
|
59
|
-
#elm_radio1 = root.find('.test')
|
60
|
-
#elm_radio1 = root.find('input.test')
|
61
|
-
#elm_radio1 = root.find('[id=radio1][type=radio]')
|
62
|
-
##elm_radio1.attr('checked','true')
|
63
|
-
#elm_radio1['checked'] = 'true'
|
64
|
-
#puts elm_radio1.document
|
65
|
-
|
66
|
-
#elm_select1 = root.element('select','id'=>'select1')
|
67
|
-
#elm_select1 = root.element('select')
|
68
|
-
##elm_select1 = root.find('select')
|
69
|
-
#elm_select1.attr('multiple','true')
|
70
|
-
#elm_select1['multiple'] = true
|
71
|
-
##puts elm_select1.attr('multiple')
|
72
|
-
#puts elm_select1['multiple']
|
73
|
-
|
74
|
-
#elm_option1 = root.element('option','id'=>'option1')
|
75
|
-
##elm_option1.attr('selected'=>'true')
|
76
|
-
#elm_option1['selected'] = true
|
77
|
-
#ps.remove_attr(elm_option1,'selected')
|
78
|
-
#elm_option1.remove_attr('selected')
|
79
|
-
##puts elm_option1.attr('selected')
|
80
|
-
#puts elm_option1['selected']
|
81
|
-
#puts elm_text1.attr('readonly')
|
82
|
-
#puts elm_text1['readonly']
|
83
|
-
|
84
|
-
#elm_select2 = ps.element('select','id'=>'select2')
|
85
|
-
#elm_select2['multiple'] = 'true'
|
86
|
-
#elm_option2 = ps.element('option','id'=>'option2')
|
87
|
-
#co_ps = elm_option2.child()
|
88
|
-
#10.times { |i|
|
89
|
-
# co_ps.attr('value'=>i.to_s)
|
90
|
-
# #'<' +
|
91
|
-
# if i == 1 then
|
92
|
-
# co_ps.attr('selected'=>'true')
|
93
|
-
# else
|
94
|
-
# #co_ps.attr('selected'=>'false')
|
95
|
-
# end
|
96
|
-
# co_ps.content(i.to_s)
|
97
|
-
# co_ps.remove_attr('id')
|
98
|
-
# co_ps.flush
|
99
|
-
#}
|
100
|
-
|
101
|
-
elm_tr1 = root.element('tr',id: 'loop')
|
102
|
-
#elm_tr1 = ps.find('tr[id=loop]')
|
103
|
-
elm_ = root.element(elm_tr1)
|
104
|
-
elm_dt1_ = elm_.element(id: 'aa')
|
105
|
-
elm_dt2_ = elm_.element('id'=>'bb')
|
106
|
-
elm_dt3_ = elm_.element('id'=>'cc')
|
107
|
-
10.times do |i|
|
108
|
-
elm_['loop'] = i.to_s
|
109
|
-
elm_dt1 = elm_dt1_.clone
|
110
|
-
elm_dt2 = elm_dt2_.clone
|
111
|
-
elm_dt3 = elm_dt3_.clone
|
112
|
-
elm_dt1.content=i.to_s
|
113
|
-
elm_dt2.content=i.to_s
|
114
|
-
elm_dt3.content=i.to_s
|
115
|
-
#"< \n" +
|
116
|
-
elm_.flush
|
117
|
-
end
|
118
|
-
|
119
|
-
elms = root.elements('id' => 'sample')
|
120
|
-
#elms = root.find('div')
|
121
|
-
#elms = root.find('div[class=test]')
|
122
|
-
|
123
|
-
elms.each_with_index{ |elm_,i|
|
124
|
-
#puts elm_.document
|
125
|
-
elm_['style'] = i.to_s
|
126
|
-
}
|
127
|
-
|
128
|
-
root.flush
|
129
|
-
|
130
|
-
end_time = Time.new.to_f
|
131
|
-
|
132
|
-
puts root.document
|
133
|
-
|
134
|
-
puts '' + (end_time - start_time).to_s + ' sec'
|
data/demo/demo_xhtml.rb
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
#!bin ruby
|
2
|
-
# -* coding: UTF-8 -*-
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
require 'meteor'
|
6
|
-
|
7
|
-
#pf = Meteor::ParserFactory.new
|
8
|
-
#pf.bind(:html,"sample_x.html", "UTF-8")
|
9
|
-
|
10
|
-
#root = pf.element('sample_x')
|
11
|
-
|
12
|
-
Meteor::ElementFactory.bind(:html,'sample_x.html', 'UTF-8')
|
13
|
-
root = Meteor::ElementFactory.element('sample_x')
|
14
|
-
|
15
|
-
startTime = Time.new.to_f
|
16
|
-
|
17
|
-
elm_hello = root.element("id","hello")
|
18
|
-
#elm_hello.attr("color"=>"red")
|
19
|
-
elm_hello['color'] = 'red'
|
20
|
-
#elm_hello.remove_attr('color')
|
21
|
-
|
22
|
-
elm_hello2 = root.element("id"=>"hello2")
|
23
|
-
#elm_hello2.content("Hello,Tester")
|
24
|
-
elm_hello2.content = "Hello,Tester"
|
25
|
-
#elm_hello2.remove
|
26
|
-
#elm_hello3 = root.cxtag("hello3")
|
27
|
-
##elm_hello3.content("Hello,Hello\ntt")
|
28
|
-
#elm_hello3.content = "Hello,Hello\ntt"
|
29
|
-
#puts elm_hello3.content
|
30
|
-
#puts elm_hello3.mixed_content
|
31
|
-
|
32
|
-
#elm_text1 = root.element("id"=>"text1")
|
33
|
-
##elm_text1.attr("value","めも")
|
34
|
-
#elm_text1['value'] = 'めも'
|
35
|
-
##elm_text1.attr("disabled"=>true)
|
36
|
-
#elm_text1['diaabled'] = true
|
37
|
-
#map = elm_text1.attr_map
|
38
|
-
#map.names.each { |item|
|
39
|
-
# puts item
|
40
|
-
# puts map.fetch(item)
|
41
|
-
#}
|
42
|
-
|
43
|
-
elm_radio1 = root.element("input","id"=>"radio1","type"=>"radio")
|
44
|
-
##elm_radio1.attribute("checked"=>"true")
|
45
|
-
elm_radio1['checked'] = true
|
46
|
-
|
47
|
-
#elm_select1 = root.element("select","id"=>"select1")
|
48
|
-
#elm_select1 = root.element("select")
|
49
|
-
##elm_select1.attr("multiple"=>true)
|
50
|
-
#elm_select1('multiple') = true
|
51
|
-
##puts elm_select1.attr("multiple")
|
52
|
-
#puts elm_select1['multiple']
|
53
|
-
#elm_option1 = root.element("option","id"=>"option1")
|
54
|
-
##elm_option1.attr("selected"=>"true")
|
55
|
-
#elm_option1['selected'] = true
|
56
|
-
#puts elm_option1.attr("selected")
|
57
|
-
#puts elm_text1.attr("readonly")
|
58
|
-
|
59
|
-
#elm_select2 = root.element("select","id"=>"select2")
|
60
|
-
#elm_select2["multiple"] = "true"
|
61
|
-
#elm_option2 = root.element("option","id"=>"option2")
|
62
|
-
#co_ps = elm_option2.child()
|
63
|
-
#10.times { |i|
|
64
|
-
# if i == 1 then
|
65
|
-
# #co_ps.attr("selected"=>"true")
|
66
|
-
# co_ps['selected'] = true
|
67
|
-
# else
|
68
|
-
# #co_ps.attr("selected"=>"false")
|
69
|
-
# co_ps['selected'] = false
|
70
|
-
# end
|
71
|
-
# #co_ps.attr("value"=>i.to_s)
|
72
|
-
# co_ps['value'] = i.to_s
|
73
|
-
# co_ps.remove_attr("id")
|
74
|
-
# #co_ps.content(i.to_s)
|
75
|
-
# co_ps.content = i.to_s
|
76
|
-
# co_ps.flush
|
77
|
-
#}
|
78
|
-
|
79
|
-
elm_tr1 = root.element('tr','id'=>'loop')
|
80
|
-
elm_ = elm_tr1.element
|
81
|
-
elm_dt1_ = elm_.element('id'=>'aa')
|
82
|
-
elm_dt2_ = elm_.element('id'=>'bb')
|
83
|
-
elm_dt3_ = elm_.element('id'=>'cc')
|
84
|
-
10.times { |i|
|
85
|
-
elm_['loop'] = i.to_s
|
86
|
-
elm_dt1 = elm_dt1_.clone
|
87
|
-
elm_dt2 = elm_dt2_.clone
|
88
|
-
elm_dt3 = elm_dt3_.clone
|
89
|
-
#elm_dt1.content("<>\"' \n" << i.to_s)
|
90
|
-
elm_dt1.content=i.to_s
|
91
|
-
elm_dt2.content=i.to_s
|
92
|
-
elm_dt3.content=i.to_s
|
93
|
-
elm_.flush
|
94
|
-
}
|
95
|
-
|
96
|
-
root.flush
|
97
|
-
|
98
|
-
endTime = Time.new.to_f
|
99
|
-
|
100
|
-
puts root.document
|
101
|
-
|
102
|
-
puts '' + (endTime - startTime).to_s + ' sec'
|