meteor 0.9.8.1 → 0.9.9.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e08d7846e20f1e7fcb1aa755175cafcbb3a451f6
4
- data.tar.gz: 2130feb4f92b95ef53cfd2e9cbb03f7aee73a408
2
+ SHA256:
3
+ metadata.gz: 44f0769bd5122d05e1fa025620a663590e01682ed91f0df6a97ee16179991345
4
+ data.tar.gz: 76a7e658e3102717c1bc6447378a914c85ad82c96d091bd37506b622f1877e92
5
5
  SHA512:
6
- metadata.gz: bf2618e5090b829294e39707bd9c237ed0bf913f41c9d46e330b7c42c0b0e8fac5a4040b04051672486a7796b7e230b58824bd56f7e478c4683c2e5475783e3c
7
- data.tar.gz: 60d6f332459a50e624e21f70425b1e1f108366c091a1212ba9398a51bfeff5f337c99c1a79e83b4ff191c6cdf1b0b60471643e666619e5c3c11baf62b743622a
6
+ metadata.gz: 93acc94e943e01b72f093bdc89ec4cb30e4b66f4f60cf892884aafaf1de3c5a8276e3aa04b062623c1223e814431e6e21971eec512d1a6fc8a2dc0236626a593
7
+ data.tar.gz: d7930e3a667e9a6fd9f8edbaaca0d59498113c31d2a58682fc428e4f715b041825aeb9238cb0b9ab4f32a97736f42283209b3bdcd98fe839d855c2fc620e23a4
data/.gitignore CHANGED
@@ -1,7 +1,7 @@
1
1
  .DS_Store
2
2
  #.gitignore
3
3
  .idea
4
- Gemfile.lock
4
+ .ruby-version
5
5
  .bundle
6
6
  .yardoc
7
7
  doc
@@ -0,0 +1,18 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ meteor (0.9.9.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ ruby
12
+
13
+ DEPENDENCIES
14
+ bundler (~> 2.2)
15
+ meteor!
16
+
17
+ BUNDLED WITH
18
+ 2.2.3
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
  Meteor
3
3
  ==================
4
- A lightweight (X)HTML(5) & XML Parser
4
+ A lightweight HTML & XML Parser
5
5
 
6
6
  ```shell
7
7
  gem install meteor #gem installation
@@ -13,19 +13,19 @@ Meteor
13
13
  ```
14
14
 
15
15
  ## Explanation
16
- This libarary is lightweight (X)HTML(5) parser.
16
+ This libarary is lightweight HTML parser.
17
17
  This can use as XML parser.
18
18
  This may be false parser.
19
19
 
20
- This libarary doesn't support all of XML spec.
21
- This supports a range of xml spec
20
+ This libarary doesn't support all of HTML & XML spec.
21
+ This supports a range of HTML & XML spec
22
22
  thought to be the need routinely.
23
23
 
24
- 軽量(簡易?)(X)HTML(5)パーサです。
24
+ 軽量(簡易?)HTMLパーサです。
25
25
  XMLパーサとしても使用可能です。
26
26
  パーサもどきかもしれません。
27
27
 
28
- (X)HTML(5)、XMLの仕様の全てをサポートしてはいません、
28
+ HTML、XMLの仕様の全てをサポートしてはいません、
29
29
  日常的に必要と思われる範囲をサポートしています。
30
30
 
31
31
  This doesn't convert the whole into objects but
@@ -39,7 +39,7 @@ DOMのように全体をオブジェクトのツリー構造に変換するの
39
39
  必要は全くありません。)
40
40
 
41
41
  ## API
42
- http://rubydoc.info/github/asip/meteor/master/frames
42
+ http://rubydoc.info/github/asip/meteor/frames
43
43
 
44
44
  ## Gem
45
45
  https://rubygems.org/gems/meteor
@@ -54,4 +54,4 @@ Licensed under the LGPL V2.1.
54
54
  Yasumasa Ashida (ys.ashida@gmail.com)
55
55
 
56
56
  ## Copyright
57
- (c) 2008-2014 Yasumasa Ashida
57
+ (c) 2008-2021 Yasumasa Ashida
@@ -0,0 +1,110 @@
1
+ #!bin ruby
2
+ # -* coding: UTF-8 -*-
3
+
4
+ #require 'rubygems'
5
+ require 'meteor'
6
+
7
+ #Meteor::ElementFactory.link(:html4,'ml/sample_4.html', 'UTF-8')
8
+ Meteor::ElementFactory.options= {type: :html4}
9
+ Meteor::ElementFactory.link('ml/sample_4.html')
10
+
11
+ root = Meteor::ElementFactory.element('/ml/sample_4')
12
+
13
+ start_time = Time.new.to_f
14
+
15
+ elm_hello = root.element(id: 'hello')
16
+ elm_hello['color'] = 'red' #elm_hello.attr(color: 'red')
17
+ #elm_hello['color'] = nil #elm_hello.remove_attr('color')
18
+
19
+ elm_hello2 = root.element(id: 'hello2')
20
+ elm_hello2.content = 'Hello,Tester' #elm_hello2.content('Hello,Tester')
21
+
22
+ #elm_hello3 = root.cxtag('hello3')
23
+ #elm_hello3.content = "Hello,Hello\ntt" #elm_hello3.content = "Hello,Hello"
24
+ #puts elm_hello3.pattern
25
+ #puts elm_hello3.mixed_content
26
+ #puts elm_hello3.document
27
+ #puts elm_hello3.content
28
+ #puts elm_hello3.mixed_content
29
+
30
+ elm_text1 = root.element('input', id: 'text1')
31
+ #elm_text1['value'] = 'めも' #elm_text1.attr(value: 'めも')
32
+ #elm_text1.attr = {value: 'メモ'}
33
+ #elm_text1['disabled'] = true #elm_text1.attr(disabled: true)
34
+ elm_text1.attrs = {value: 'メモ', disabled: true, readonly: true}
35
+ #puts elm_text1.attrs
36
+ #elm_text1['disabled'] = nil #elm_text1.remove_attr('disabled')
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 = root.css('input[id=radio1][type=radio]')
45
+ ##elm_radio1 = root.css('#radio1') #elm_radio1 = root.css('input#radio1')
46
+ ##elm_radio1 = root.css('.test') #elm_radio1 = root.css('input.test')
47
+ ##elm_radio1 = root.css('[id=radio1][type=radio]')
48
+ #elm_radio1['checked'] = true #elm_radio1.attr(checked: true)
49
+ #puts elm_radio1.document
50
+
51
+ #elm_select1 = root.element('select', id: 'select1')
52
+ #elm_select1 = root.element('select')
53
+ #elm_select1['multiple'] = true #elm_select1.attr('multiple',true)
54
+ #puts elm_select1['multiple'] #puts elm_select1.attr('multiple')
55
+
56
+ #elm_option1 = root.element('option', id: 'option1')
57
+ #elm_option1['selected'] = true #elm_option1.attr(selected: true)
58
+ #elm_option1['selected'] = nil #elm_option1.remove_attr('selected')
59
+ #puts elm_option1['selected'] #puts elm_option1.attr('selected')
60
+ #puts elm_text1['readonly'] #puts elm_text1.attr('readonly')
61
+
62
+
63
+ elm_select2 = root.element('select', id: 'select2')
64
+ elm_select2['multiple'] = true
65
+ elm_option2 = elm_select2.element('option',id: 'option2')
66
+ co_elm = elm_option2.element()
67
+ 10.times { |i|
68
+ co_elm['value'] = i #co_elm.attr(value: i)
69
+ #'<' +
70
+ if i == 1 then
71
+ co_elm['selected'] = true #co_elm.attr(selected: 'true')
72
+ else
73
+ co_elm['selected'] = false #co_elm.attr(selected: 'false')
74
+ end
75
+ co_elm.content = i #co_elm.content(i)
76
+ co_elm['id'] = nil #co_elm.remove_attr('id')
77
+ co_elm.flash
78
+ }
79
+
80
+ elm_tr1 = root.element('tr',id: 'loop') #elm_tr1 = root.css('tr[id=loop]')
81
+ elm_ = root.element(elm_tr1)
82
+ elm_dt1_ = elm_.element(id: 'aa')
83
+ elm_dt2_ = elm_.element(id: 'bb')
84
+ elm_dt3_ = elm_.element(id: 'cc')
85
+ 10.times do |i|
86
+ elm_['loop'] = i
87
+ elm_dt1 = elm_dt1_.clone
88
+ elm_dt2 = elm_dt2_.clone
89
+ elm_dt3 = elm_dt3_.clone
90
+ elm_dt1.content = i
91
+ elm_dt2.content = i
92
+ elm_dt3.content = i
93
+ #"< \n" +
94
+ elm_.flash
95
+ end
96
+
97
+ elms = root.elements(id: 'sample')
98
+ #elms = root.css('div') #elms = root.css('div[class=test]')
99
+
100
+ elms.each_with_index{ |elm_,i|
101
+ elm_['style'] = i.to_s
102
+ }
103
+
104
+ root.flash
105
+
106
+ end_time = Time.new.to_f
107
+
108
+ puts root.document
109
+
110
+ puts '' + (end_time - start_time).to_s + ' sec'
@@ -1,102 +1,99 @@
1
1
  #!bin ruby
2
2
  # -* coding: UTF-8 -*-
3
3
 
4
- require 'rubygems'
4
+ #require 'rubygems'
5
5
  require 'meteor'
6
6
 
7
- #pf = Meteor::ParserFactory.new
8
- #pf.bind(:html5,'sample_5.html', 'UTF-8')
9
-
10
- #root = pf.element('sample_5')
11
-
12
- Meteor::ElementFactory.bind(:html5,"sample_5.html", 'UTF-8')
13
- root = Meteor::ElementFactory.element('sample_5')
7
+ Meteor::ElementFactory.link(:html5,"ml/sample_5.html", 'UTF-8')
8
+ root = Meteor::ElementFactory.element('/ml/sample_5')
14
9
 
15
10
  start_time = Time.new.to_f
16
11
 
17
- elm_hello = root.element('id','hello')
18
- #elm_hello.attr('color'=>'red')
19
- elm_hello['color'] = 'red'
20
- #elm_hello.remove_attribute('color')
12
+ elm_hello = root.element(id: 'hello')
13
+ elm_hello['color'] = 'red' #elm_hello.attr(color: 'red')
14
+ #elm_hello['color'] = nil #elm_hello.remove_attr('color')
21
15
 
22
- elm_hello2 = root.element('id'=>'hello2')
23
- #elm_hello2.content('Hello,Tester')
24
- elm_hello2.content = 'Hello,Tester'
16
+ elm_hello2 = root.element(id: 'hello2')
17
+ elm_hello2.content = 'Hello,Tester' #elm_hello2.content('Hello,Tester')
25
18
 
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
19
+ elm_text1 = root.element(id: 'text1')
20
+ elm_text1['value'] = 'めも' #elm_text1.attr(value: めも')
21
+ elm_text1['disabled'] = true #elm_text1.attr(disabled: true)
22
+ elm_text1['required'] = true #elm_text1.attr(required: true)
33
23
 
34
- #elm_text1.remove_attr('disabled')
24
+ #elm_text1['disabled'] = nil #elm_text1.remove_attr('disabled')
35
25
  #map = elm_text1.attr_map
36
26
  #map.names.each { |item|
37
27
  # puts item
38
28
  # puts map.fetch(item)
39
29
  #}
40
30
 
41
- #elm_radio1 = root.element('input','id'=>'radio1','type'=>'radio')
42
- ##elm_radio1.attr(,'checked'=>'true')
43
- #elm_radio1['checked'] = true
31
+ #elm_radio1 = root.element('input', id: 'radio1', type: 'radio')
32
+ #elm_radio1['checked'] = true #elm_radio1.attr(checked: true)
44
33
  #puts elm_radio1.document
45
34
 
46
- #elm_select1 = root.element('select','id'=>'select1')
35
+ #elm_select1 = root.element('select', id: 'select1')
47
36
  #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')
37
+ #elm_select1['multiple'] = true #elm_select1.attr(multiple: true)
38
+ #puts elm_select1['multiple'] #puts elm_select1.attr('multiple')
39
+
40
+ #elm_option1 = root.element('option', id: 'option1')
41
+ #elm_option1['selected'] = true #elm_option1.attr(selected: true)
42
+ #elm_option1['selected'] = nil #elm_option1.remove_attr('selected')
43
+ #puts elm_option1['selected'] #puts elm_option1.attr('selected')
44
+ #puts elm_text1['readonly'] #puts elm_text1.attr('readonly')
45
+
46
+ elm_select2 = root.element('select',id: 'select2')
47
+ elm_select2['multiple'] = true
48
+ elm_option2 = elm_select2.element('option',id: 'option2')
49
+ co_elm = elm_option2.element()
50
+ 10.times { |i|
51
+ co_elm['value'] = i #co_elm.attr(value: i)
52
+ #'<' +
53
+ if i == 1 then
54
+ co_elm['selected'] = true #co_elm.attr(selected: true)
55
+ else
56
+ co_elm['selected'] = false #co_elm.attr(selected: false)
57
+ end
58
+ co_elm.content = i #co_elm.content(i)
59
+ co_elm['id'] = nil #co_elm.remove_attr('id')
60
+ co_elm.flash
61
+ }
62
+
63
+ elm_tr1 = root.element('tr',id: 'loop')
80
64
  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')
65
+ elm_dt1_ = elm_.element(id: 'aa')
66
+ elm_dt2_ = elm_.element(id: 'bb')
67
+ elm_dt3_ = elm_.element(id: 'cc')
84
68
  10.times do |i|
85
- elm_['loop'] = i.to_s
69
+ elm_['loop'] = i
86
70
  elm_dt1 = elm_dt1_.clone
87
71
  elm_dt2 = elm_dt2_.clone
88
72
  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
73
+ elm_dt1.content = i
74
+ elm_dt2.content = i
75
+ elm_dt3.content = i
92
76
  #"< \n" +
93
- elm_.flush
77
+ elm_.flash
94
78
  end
95
79
 
96
- root.flush
80
+ root.flash
97
81
 
98
82
  end_time = Time.new.to_f
99
83
 
100
84
  puts root.document
101
85
 
86
+ elms = root.elements('tr', id: 'loop')
87
+ #elms = root.elements('input', id: 'radio1', type: 'radio')
88
+ #elms = root.css('input[id=radio1][type=radio]')
89
+ elms.each{|elm|
90
+ puts '-------'
91
+ puts 'doc----'
92
+ puts elm.document
93
+ puts 'attrs--'
94
+ puts elm.attributes
95
+ puts 'mixed--'
96
+ puts elm.mixed_content
97
+ }
98
+
102
99
  puts '' + (end_time - start_time).to_s + ' sec'
@@ -0,0 +1,85 @@
1
+ #!bin ruby
2
+ # -* coding: UTF-8 -*-
3
+
4
+ #require 'rubygems'
5
+ require 'meteor'
6
+
7
+ Meteor::ElementFactory.link(:xhtml4,'ml/sample_x4.html', 'UTF-8')
8
+ root = Meteor::ElementFactory.element('/ml/sample_x4')
9
+
10
+ startTime = Time.new.to_f
11
+
12
+ elm_hello = root.element("id","hello")
13
+ elm_hello['color'] = 'red' #elm_hello.attr(color: "red")
14
+ #elm_hello['color'] = nil #elm_hello.remove_attr('color')
15
+
16
+ elm_hello2 = root.element(id: "hello2")
17
+ elm_hello2.content = "Hello,Tester" #elm_hello2.content("Hello,Tester")
18
+ #elm_hello2.remove
19
+
20
+ #elm_hello3 = root.cxtag("hello3")
21
+ #elm_hello3.content = "Hello,Hello\ntt" #elm_hello3.content("Hello,Hello\ntt")
22
+ #puts elm_hello3.content
23
+ #puts elm_hello3.mixed_content
24
+
25
+ #elm_text1 = root.element(id: "text1")
26
+ #elm_text1['value'] = 'めも' #elm_text1.attr(value: 'めも')
27
+ #elm_text1['disabled'] = true #elm_text1.attr(disabled: true)
28
+ #map = elm_text1.attr_map
29
+ #map.names.each { |item|
30
+ # puts item
31
+ # puts map.fetch(item)
32
+ #}
33
+
34
+ elm_radio1 = root.element("input", id: "radio1", type: "radio")
35
+ elm_radio1['checked'] = true #elm_radio1.attribute(checked: true)
36
+
37
+ #elm_select1 = root.element("select",id: "select1")
38
+ #elm_select1 = root.element("select")
39
+ #elm_select1('multiple') = true #elm_select1.attr(multiple: true)
40
+ #puts elm_select1['multiple'] #puts elm_select1.attr("multiple")
41
+
42
+ #elm_option1 = root.element("option",id: "option1")
43
+ #elm_option1['selected'] = true #elm_option1.attr(selected: true)
44
+ #puts elm_option1['selected'] #puts elm_option1.attr("selected")
45
+ #puts elm_option1['readonly'] #puts elm_text1.attr("readonly")
46
+
47
+ elm_select2 = root.element("select",id: "select2")
48
+ elm_select2["multiple"] = true
49
+ elm_option2 = elm_select2.element("option",id: "option2")
50
+ co_elm = elm_option2.element()
51
+ 10.times { |i|
52
+ if i == 1 then
53
+ co_elm['selected'] = true #co_elm.attr(selected: true)
54
+ else
55
+ co_elm['selected'] = false #co_elm.attr(selected: false)
56
+ end
57
+ co_elm['value'] = i #co_elm.attr(value: i)
58
+ co_elm['id'] = nil #co_elm.remove_attr("id")
59
+ co_elm.content = i #co_elm.content(i)
60
+ co_elm.flash
61
+ }
62
+
63
+ elm_tr1 = root.element('tr',id: 'loop')
64
+ elm_ = elm_tr1.element
65
+ elm_dt1_ = elm_.element(id: 'aa')
66
+ elm_dt2_ = elm_.element(id: 'bb')
67
+ elm_dt3_ = elm_.element(id: 'cc')
68
+ 10.times { |i|
69
+ elm_['loop'] = i
70
+ elm_dt1 = elm_dt1_.clone
71
+ elm_dt2 = elm_dt2_.clone
72
+ elm_dt3 = elm_dt3_.clone
73
+ elm_dt1.content = i #elm_dt1.content("<>\"' \n" << i.to_s)
74
+ elm_dt2.content = i
75
+ elm_dt3.content = i
76
+ elm_.flash
77
+ }
78
+
79
+ root.flash
80
+
81
+ endTime = Time.new.to_f
82
+
83
+ puts root.document
84
+
85
+ puts '' + (endTime - startTime).to_s + ' sec'