meteor 0.9.7.5 → 0.9.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 79878cc14c8b93e9720ec698a24aa94195bae0ef
4
+ data.tar.gz: 295a3b24e45b67244a280bdebfe3454bcad79f78
5
+ SHA512:
6
+ metadata.gz: 53a2b9afe11e01ca2b83f6821a01b9c07102f23d0b484838023edd37445631b3f241d0b5e7cddc8c94435b0d0055766ff016e8797680e2890f9562814b91da86
7
+ data.tar.gz: 18019e1b871043796f52091f0efb8e64ecc3b7a2f7c554ef2e01bf7191b7c6a9a3f118c35e05984a930304eba8ca42ef7978b5e780f6daa4837a53047317f7e0
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .DS_Store
2
+ #.gitignore
3
+ .idea
4
+ Gemfile.lock
5
+ .bundle
6
+ .yardoc
7
+ doc
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.9.8 / 2014-01-07 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ ※ multi elements search support
4
+
1
5
  == 0.9.0.1 / 2008-10-03 Yasumasa Ashida <ys.ashida@gmail.com>
2
6
 
3
7
  * initial release
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in meteor.gemspec
4
+ gemspec name: 'meteor'
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+
2
+ Meteor
3
+ ==================
4
+ A lightweight (X)HTML(5) & XML Parser
5
+
6
+ ```shell
7
+ gem install meteor #gem installation
8
+ ```
9
+ ```shell
10
+ #archive installation
11
+ gem build meteor.gemspec
12
+ gem install meteor-*.gem
13
+ ```
14
+
15
+ ##Explanation
16
+ Sorry, written in Japanese.
17
+
18
+ 軽量(簡易?)(X)HTML(5)パーサです。
19
+ XMLパーサとしても使用可能です。
20
+ パーサもどきかもしれません。
21
+ (X)HTML(5)、XMLの仕様の全てをサポートしてはいません、
22
+ 日常的に必要と思われる範囲をサポートしています。
23
+
24
+ DOMのように全体をオブジェクトのツリー構造に変換するのではなく、
25
+ 操作対象の要素のみをオブジェクトにする仕組みになっています。
26
+ (内部では正規表現を使っていますが、ユーザがそれを意識する
27
+ 必要は全くありません。)
28
+
29
+
30
+ ## License
31
+ Licensed under the LGPL V2.1.
32
+
33
+ ##Author
34
+ Yasumasa Ashida (ys.ashida@gmail.com)
35
+
36
+ ##Copyright
37
+ (c) 2008-2014 Yasumasa Ashida
data/Rakefile CHANGED
@@ -27,7 +27,7 @@ RDOC_OPTS = [
27
27
  "--charset", "utf-8",
28
28
  "--opname", "index.html",
29
29
  "--line-numbers",
30
- "--main", "README",
30
+ "--main", "README.md",
31
31
  "--inline-source",
32
32
  ]
33
33
 
@@ -45,7 +45,7 @@ spec = Gem::Specification.new do |s|
45
45
  s.version = VERS
46
46
  s.platform = Gem::Platform::RUBY
47
47
  s.has_rdoc = false
48
- s.extra_rdoc_files = ["README", "ChangeLog"]
48
+ s.extra_rdoc_files = ["README.md", "ChangeLog"]
49
49
  s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
50
50
  s.summary = DESCRIPTION
51
51
  s.description = DESCRIPTION
@@ -62,7 +62,7 @@ spec = Gem::Specification.new do |s|
62
62
  #s.add_dependency('activesupport', '>=1.3.1')
63
63
  #s.required_ruby_version = '>= 1.8.2'
64
64
 
65
- s.files = %w(README ChangeLog Rakefile) +
65
+ s.files = %w(README.md ChangeLog Rakefile) +
66
66
  Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
67
67
  Dir.glob("ext/**/*.{h,c,rb}") +
68
68
  Dir.glob("examples/**/*.rb") +
@@ -96,7 +96,7 @@ Rake::RDocTask.new do |rdoc|
96
96
  if ENV['DOC_FILES']
97
97
  rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
98
98
  else
99
- rdoc.rdoc_files.include('README', 'ChangeLog')
99
+ rdoc.rdoc_files.include('README.md', 'ChangeLog')
100
100
  rdoc.rdoc_files.include('lib/**/*.rb')
101
101
  rdoc.rdoc_files.include('ext/**/*.c')
102
102
  end
data/demo/demo_html.rb ADDED
@@ -0,0 +1,133 @@
1
+ #!bin ruby
2
+ # -* coding: UTF-8 -*-
3
+
4
+ require 'rubygems'
5
+ require 'meteor'
6
+
7
+ #pf = Meteor::ParserFactory.new
8
+ #pf.bind(Meteor::HTML,'sample.html', 'UTF-8')
9
+
10
+ #root = pf.element('sample')
11
+
12
+ Meteor::ElementFactory.options= {:type => Meteor::HTML}
13
+ #Meteor::ElementFactory.bind(Meteor::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
+
83
+ #elm_select2 = ps.element('select','id'=>'select2')
84
+ #elm_select2['multiple'] = 'true'
85
+ #elm_option2 = ps.element('option','id'=>'option2')
86
+ #co_ps = elm_option2.child()
87
+ #10.times { |i|
88
+ # co_ps.attr('value'=>i.to_s)
89
+ # #'<' +
90
+ # if i == 1 then
91
+ # co_ps.attr('selected'=>'true')
92
+ # else
93
+ # #co_ps.attr('selected'=>'false')
94
+ # end
95
+ # co_ps.content(i.to_s)
96
+ # co_ps.remove_attr('id')
97
+ # co_ps.flush
98
+ #}
99
+
100
+ elm_tr1 = root.element('tr','id'=>'loop')
101
+ #elm_tr1 = ps.find('tr[id=loop]')
102
+ elm_ = root.element(elm_tr1)
103
+ elm_dt1_ = elm_.element('id'=>'aa')
104
+ elm_dt2_ = elm_.element('id'=>'bb')
105
+ elm_dt3_ = elm_.element('id'=>'cc')
106
+ 10.times do |i|
107
+ elm_['loop'] = i.to_s
108
+ elm_dt1 = elm_dt1_.clone
109
+ elm_dt2 = elm_dt2_.clone
110
+ elm_dt3 = elm_dt3_.clone
111
+ elm_dt1.content=i.to_s
112
+ elm_dt2.content=i.to_s
113
+ elm_dt3.content=i.to_s
114
+ #"< \n" +
115
+ elm_.flush
116
+ end
117
+
118
+ elms = root.elements('id' => 'sample')
119
+ #elms = root.find('div')
120
+ #elms = root.find('div[class=test]')
121
+
122
+ elms.each_with_index{ |elm_,i|
123
+ #puts elm_.document
124
+ elm_['style'] = i.to_s
125
+ }
126
+
127
+ root.flush
128
+
129
+ end_time = Time.new.to_f
130
+
131
+ puts root.document
132
+
133
+ puts '' + (end_time - start_time).to_s + ' sec'
@@ -0,0 +1,102 @@
1
+ #!bin ruby
2
+ # -* coding: UTF-8 -*-
3
+
4
+ require 'rubygems'
5
+ require 'meteor'
6
+
7
+ #pf = Meteor::ParserFactory.new
8
+ #pf.bind(Meteor::Parser::HTML5,'sample_5.html', 'UTF-8')
9
+
10
+ #root = pf.element('sample_5')
11
+
12
+ Meteor::ElementFactory.bind(Meteor::Parser::HTML5,"sample_5.html", 'UTF-8')
13
+ root = Meteor::ElementFactory.element('sample_5')
14
+
15
+ start_time = 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_attribute('color')
21
+
22
+ elm_hello2 = root.element('id'=>'hello2')
23
+ #elm_hello2.content('Hello,Tester')
24
+ elm_hello2.content = 'Hello,Tester'
25
+
26
+ elm_text1 = root.element('id','text1')
27
+ #elm_text1.attr('value','めも')
28
+ elm_text1['value'] = 'めも'
29
+ #elm_text1.attr('disabled'=>true)
30
+ elm_text1['disabled'] = true
31
+ #elm_text1.attr('required'=>true)
32
+ elm_text1['required'] = true
33
+
34
+ #elm_text1.remove_attr('disabled')
35
+ #map = elm_text1.attr_map
36
+ #map.names.each { |item|
37
+ # puts item
38
+ # puts map.fetch(item)
39
+ #}
40
+
41
+ #elm_radio1 = root.element('input','id'=>'radio1','type'=>'radio')
42
+ ##elm_radio1.attr(,'checked'=>'true')
43
+ #elm_radio1['checked'] = true
44
+ #puts elm_radio1.document
45
+
46
+ #elm_select1 = root.element('select','id'=>'select1')
47
+ #elm_select1 = root.element('select')
48
+ ##elm_select1.attr('multiple'=>'true')
49
+ #elm_select1['multiple'] = true
50
+ ##puts elm_select1.attr('multiple')
51
+ #puts elm_select1['multiple']
52
+
53
+ #elm_option1 = root.element('option','id'=>'option1')
54
+ ##elm_option1.attr('selected'=>'true')
55
+ #elm_option1['selected'] = true
56
+ #elm_option1.remove_attr('selected')
57
+ ##puts elm_option1.attr('selected')
58
+ #puts elm_option1['selected']
59
+ ##puts elm_text1.attr('readonly')
60
+ #puts elm_text1['readonly']
61
+
62
+ #elm_select2 = ps.element('select','id'=>'select2')
63
+ #elm_select2['multiple'] = 'true'
64
+ #elm_option2 = ps.element('option','id'=>'option2')
65
+ #co_ps = elm_option2.element()
66
+ #10.times { |i|
67
+ # co_ps.attr('value',i.to_s)
68
+ # #'<' +
69
+ # if i == 1 then
70
+ # co_ps.attr('selected'=>'true')
71
+ # else
72
+ # #co_ps.attr('selected'=>'false')
73
+ # end
74
+ # co_ps.content(i.to_s)
75
+ # co_ps.remove_attr('id')
76
+ # co_ps.flush
77
+ #}
78
+
79
+ elm_tr1 = root.element('tr','id'=>'loop')
80
+ elm_ = root.element(elm_tr1)
81
+ elm_dt1_ = elm_.element('id'=>'aa')
82
+ elm_dt2_ = elm_.element('id'=>'bb')
83
+ elm_dt3_ = elm_.element('id'=>'cc')
84
+ 10.times do |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=i.to_s
90
+ elm_dt2.content=i.to_s
91
+ elm_dt3.content=i.to_s
92
+ #"< \n" +
93
+ elm_.flush
94
+ end
95
+
96
+ root.flush
97
+
98
+ end_time = Time.new.to_f
99
+
100
+ puts root.document
101
+
102
+ puts '' + (end_time - start_time).to_s + ' sec'
@@ -0,0 +1,102 @@
1
+ #!bin ruby
2
+ # -* coding: UTF-8 -*-
3
+
4
+ require 'rubygems'
5
+ require 'meteor'
6
+
7
+ #pf = Meteor::ParserFactory.new
8
+ #pf.bind(Meteor::Parser::XHTML,"sample_x.html", "UTF-8")
9
+
10
+ #root = pf.element('sample_x')
11
+
12
+ Meteor::ElementFactory.bind(Meteor::Parser::XHTML,'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'